Skip to content

Policy: a .pth file in site-packages is held as "writing a model weights file" #747

Closed

Description

@LoopGlitch26

The coding pack holds a write to a .pth file as "writing a model weights file" (TK-A058 for the file tools, TK-A059 for the shell; tracekit/policy2/packs/coding.yaml L472-489). That's right for a PyTorch checkpoint (checkpoints/model.pth). But a .pth file in a site-packages or dist-packages folder is something else: Python's site module reads every one of them at each interpreter start, adds its lines to sys.path and runs its lines that start with import. Holding that write is right, and it matters more than a weights file, but the reason a person sees is wrong, so they can't tell what they are approving.

On main, with dev.yaml, coding.yaml and server.yaml alike:

call decision
Write to /home/u/proj/.venv/lib/python3.11/site-packages/src.pth ask, TK-A058, "writing a model weights file"
Bash cp src.pth /home/u/proj/.venv/lib/python3.11/site-packages/src.pth ask, TK-A059, "writing a model weights file"
Bash cp model.pth checkpoints/model.pth ask, TK-A059 (right)

What's needed

  • A .pth written directly in a site-packages or dist-packages folder, by a file tool or by the shell (the same write targets TK-A059 reads, WRITE_TARGET:), is held with a reason that says what it is, for example "writing a Python .pth file, which runs at every Python start", and a rationale to match.
  • Those paths no longer match TK-A058 and TK-A059, so one call shows one reason. A .pth anywhere else keeps the weights reason.
  • New rules take the next free ids after the open PRs' (Hold CI workflow writes that upload secrets #663 adds TK-A061, Policy: raw Docker or Podman socket calls and cgroup release_agent writes are held (TK-A063 to TK-A066) #731 TK-A063 to TK-A066), and the coding pack's version moves on, as for any pack change; say in the PR which one you used and we'll settle it at merge.
  • docs/policy-v2.md (the TK-A058 and TK-A059 entries in the coding pack's ask row, L711) names the new rule.

Acceptance

  • In tests/test_signer_policy.py, next to the TK-A058/TK-A059 tests (L1002-1078): the three calls above, plus a dist-packages path and a redirect (echo /src > …/site-packages/src.pth), each give ask with exactly the expected rule ids, on dev.yaml and server.yaml (today each of the three gives one rule id, as the table shows).
  • tracekit policy lint is clean on every shipped pack, and make eval shows no verdict change but these (re-record the eval results the pack's hash moves).

Comment here to claim it. Commits need a DCO sign-off (git commit -s).

Activity

  1. nx9161 commented on Nov 12, 2026

    @nx9161
    Contributor

    I'd like to claim this. Plan: add site-packages/dist-packages .pth rules ahead of TK-A058/TK-A059 in the coding pack, add the acceptance cases in tests/test_signer_policy.py, update docs/policy-v2.md, bump the pack version, and re-record evals. I'll state the new rule ID I used in the PR.

  2. LoopGlitch26 commented on Nov 12, 2026

    @LoopGlitch26
    MemberAuthor

    It's yours, and the plan matches the issue. Two notes:

    • Rule IDs and the coding pack's version are both in demand right now (several open PRs bump the pack), so take the next free ones on main when you open the PR and say which you used; the final numbers are settled at merge.
    • Check the new rule on dev.yaml, coding.yaml and server.yaml, as in the issue's table, and keep the checkpoints/model.pth case on TK-A059.

    Commits need a DCO sign-off (git commit -s).

  3. tylrcc commented on Nov 12, 2026

    @tylrcc
    Contributor

    I'd like to work on this.

  4. LoopGlitch26 commented on Nov 12, 2026

    @LoopGlitch26
    MemberAuthor

    This one is taken: nx9161 claimed it above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions