Repository navigation
Conversation
Add three ask rules to tracekit/policy2/packs/coding.yaml: - TK-A056 (class: fs): Write/Edit/MultiEdit/NotebookEdit to *.safetensors, *.gguf, *.pt, *.pth, or *.ckpt paths. - TK-A057 (class: shell, field: effects): shell write targets ending in the same extensions (cp, mv, tee, dd, sed -i, redirections, …), as TK-D008 reads them. - TK-A058 (class: shell, field: argv): huggingface-cli upload, hf upload, ollama push (up to eight options before the subcommand); downloads (download, pull) are not held. All three fire in coding.yaml, dev.yaml, server.yaml and strict.yaml. Also: - Bump pack version to 2026.10-v2-64. - Add corpus cases to tests/data/policy/deny/shell.jsonl, deny/fs.jsonl, benign/shell.jsonl and benign/fs.jsonl. - Add test_writing_or_publishing_model_weights_asks_in_every_pack in tests/test_signer_policy.py covering all four packs and both engines. - Update docs/policy-v2.md coding pack ask table with TK-A056..A058. - Add docs/limits.md row for what the rules don't cover (torch.save inside a Python script, unlisted formats .bin/.h5/.onnx/.pkl, Python SDK uploads). - Re-record eval/results/e17_policy_corpus.json and e21_policy_robustness.json. E17: 100% deny recall, 0.11% benign FP, no engine mismatches. E21 latency: p99 <= 853 us on the fallback engine (new patterns under 7 ms on 64 KiB each, well within the 50 ms budget). tracekit policy lint: ok on all packs. Closes Cygnux-Labs#560 Signed-off-by: coughlmao <coughlmao@users.noreply.github.com> Signed-off-by: Mohit Anand <anandm.mohit@gmail.com>
|
Thanks. I loaded this pack into main's engine and compared its verdicts with main's on the policy corpus, E21's pools and the strings in the policy tests (11,760 calls, every pack, both engines): nothing main stops runs now, no benign corpus call changes, the engines agree, and each new pattern takes at most 5 ms on 64 KiB on the fallback engine (0.1 ms on RE2). These need fixing before it can merge:
The pack version can stay |
|
Hi @LoopGlitch26, I've done what you've asked for. Please take a look at it. Thanks! |
- Updated policy hash in e17_policy_corpus.json and e21_policy_robustness.json for consistency. - Modified rule IDs in tests/test_signer_policy.py to reflect new identifiers for model weights operations. - Adjusted counts in e21_robustness.json to reflect changes in contained and total cases. - Updated coding.yaml to change rule IDs and patterns related to writing and publishing model weights. Signed-off-by: Mohit Anand <anandm.mohit@gmail.com>
abaea2b to
8b7e115
Compare
…e test that guards the fix e21_policy_robustness.json carries main's gates and latency rows again, re-run without --record: only the policy hashes and E17's benign counts change, and tests/test_eval_docs.py passes. The policy page names TK-A058 to TK-A060 in the coding pack's ask row (it still said TK-A056 to TK-A058) instead of a second table. The newline test writes to the path with the newline, which the old [^\n]*? pattern didn't hold. Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com>
|
Thanks, almost everything from the review is in. I pushed one commit on top (
Nothing that main holds or denies is allowed now, and each new pattern takes 3 ms or less on 64 KiB. Once CI is green, it goes to the final check and merge. |
|
Hi @LoopGlitch26, thanks for the fixes. I've checked the CI logs, and I've found a consistent pattern across the failing jobs. The failures are concentrated in Observations:
Since the same tests fail across different Python versions and operating systems, this seems more likely to be a shared issue with the model receipt functionality or its test environment than a Python-version-specific issue. Could you please take a look? I'm happy to investigate further if needed. |
|
Thanks for digging in. It comes from #570 (model receipts): those tests write |
|
Thanks for identifying the issue and for looking into it! That makes sense. Appreciate your help! |
Summary
Add three ask rules to tracekit/policy2/packs/coding.yaml:
All three fire in coding.yaml, dev.yaml, server.yaml and strict.yaml.
Also:
E17: 100% deny recall, 0.11% benign FP, no engine mismatches. E21 latency: p99 <= 853 us on the fallback engine (new patterns under 7 ms on 64 KiB each, well within the 50 ms budget).
tracekit policy lint: ok on all packs.
Closes #560
What and why
Overwriting a model's weights, or publishing them to a model hub, changes what every user of that model gets, and nothing held it before this change. Motivated by a recent MIT CSAIL result showing a model editing another model's weights from a text prompt, changing 0.016% of them — a change invisible in the file and hard to catch by evaluation, so the write or publish moment is the right place to hold.
Three
askrules added totracekit/policy2/packs/coding.yaml(and inherited bydev.yaml,server.yamlandstrict.yaml):class: fs, field: path): holds Write, Edit, MultiEdit and NotebookEdit to*.safetensors,*.gguf,*.pt,*.pthor*.ckptpaths. Reads are not held.class: shell, field: effects): holds shell commands whose write targets (as TK-D008 reads them: redirections,cp,mv,tee,dd,sed -i, …) end in those extensions. Reads, listings and writes to other extensions are not held.class: shell, field: argv): holdshuggingface-cli upload,hf uploadandollama push, after up to eight options. Downloads (download, pull) are not held.How I ran it as a user
Ran tracekit policy lint on every pack in tracekit/policy2/packs/:
Ran the E17 corpus against
server.yaml(which composes coding, browser andserver-* packs), both engines:
The five commands from the issue (
huggingface-cli upload,hf upload,ollama push,cp new.safetensors …,andWrite to .safetensors) each came back ask with the matching rule ID.The benign lookalikes (
download,pull, head -c 100 model.safetensors, and a commit message naming the file) each came back allow with no rule hit on TK-A056–TK-A058.Regression coverage
Added
test_writing_or_publishing_model_weights_asks_in_every_packtotests/test_signer_policy.py.The test covers all four packs (
coding,dev,server,strict) and both engines (RE2 and regex), with 248 subtests covering held file-tool operations, shell writes, model-hub publishing, and benign cases.Added corpus cases to:
tests/data/policy/deny/shell.jsonltests/data/policy/deny/fs.jsonltests/data/policy/benign/shell.jsonltests/data/policy/benign/fs.jsonlE21 robustness evaluation
Re-recorded
eval/results/e21_policy_robustness.json.Documentation
docs/policy-v2.mdwith TK-A056–TK-A058 in the coding pack ask table.docs/limits.mdwith the boundaries of these rules.The rules do not cover
torch.save()inside a Python script, unlisted formats such as.bin,.h5,.onnx,.pkland.npz, or Python SDK uploads such ashuggingface_hub.upload_folder(...).Checklist
make checkpasses (lint, tests, build);make test-tstoo ifsdk/typescript/changedCHANGELOG.md)docs/threat-model-laptop.md,docs/threat-model-server.md)git commit -s, seeCONTRIBUTING.md)Security invariants
approval identity) is newly trusted by the signer or verifier
Evidence format
core.sig_message,ledger.make_record, the v1 schema, howthe verifier treats existing bundles) or the published v2 format
docs/sample/andtests/fixtures/) still verify, and the change is called out above