Repository navigation
Policy: hold logins, setuid bits, cron spool writes and startup-file reverse shells (#750; carries #752) - #788
Merged
Merged
Conversation
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
… an expansion
TK-A069's option run backed off quadratically under the regex fallback, over the speed budget on CI. TK-A070 now reads tee options of any shape (a glued ${X}-a too), so an unset variable in a tee option is read both ways.
Regenerated the E17 and E21 results and the docs that quote them.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
…tern linear
- TK-A067: gpasswd -a/-M/-A into sudo, wheel or admin; usermod -u 0 (with or
without -o); -g and --gid; a group option joined to its value (-Gsudo).
The cluster read was `-[a-zA-Z]*[Gg][a-zA-Z]*`, which the fallback engine
took seconds over on `usermod -gggg…`; now the letters before G can't be G.
- TK-A068: /etc/group and /etc/gshadow.
- TK-A069: modes starting with 3, 5 or 7, leading zeros (04755), + or =
before a number, an s among other letters (u+sx, +sx), in any clause
(g+s,u+x) and after = (u=rwxs). u-s and 1777 stay unheld. Up to eight
options before the mode: the unbounded option list was quadratic on the
fallback engine (315-509 ms on `chmod -a -a …`).
- TK-A070: read with field: line, so `tee ${X}-a` is read as `tee -a`;
nc/ncat/netcat with -e, -c, --exec or --sh-exec after up to four words,
/dev/udp/, and TK-F011's startup files. The shell and the write are read
within 128 characters of each other: the lazy scan to the end of the line
rescanned it from every /dev/tcp/ (965-1660 ms on 64 KiB).
- TK-A011: cron's /etc/cron* (cron.daily, cron.hourly, ...) and a copy two
parts under /var/spool/cron (Debian's crontabs/<user>).
- Remove the committed bash.exe.stackdump.
- Coding pack 2026.11-v2-87 (settled at merge).
Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com>
Recorded on Linux (python 3.11) in a sealed container. The docs quote the new numbers: E17 873 harmful and 906 benign calls (1 benign held), E21 held out 272 of 420 caught by the server pack (persistence 26 of 33, was 21), and strict now holds 3 of E17's new startup-file edits through TK-F011, as it holds every startup-file edit. Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com>
This was referenced Nov 12, 2026
Member
Author
|
This lands in #799 (a merge train of the policy PRs), which renumbers rule ids and re-records the evals once; your commits stay as they are and this PR will show as merged. |
tylrcc
pushed a commit
to tylrcc/Tracekit
that referenced
this pull request
Nov 13, 2026
Rule ids: Cygnux-Labs#780's TK-A063 to TK-A066 become TK-A071 to TK-A074, and Cygnux-Labs#788's TK-A067 to TK-A070 become TK-A075 to TK-A078 (Cygnux-Labs#778 keeps TK-A063 to TK-A065 and Cygnux-Labs#787 TK-A067 and TK-A068; TK-A066, TK-A069 and TK-A070 stay unused, so no id names two rules across the members), in the coding pack, its tests and docs. Packs: coding 2026.11-v2-82, strict 2026.11-strict-11 and dev 2026.11-dev-5, one step above main's each. dev maps Claude Code's Workflow to `harness` (TK-A062 held it as an unmapped tool given a script), with a benign test. Harness lists: gptme, OpenHands, Copilot CLI, CodeBuddy Code and Cline in AGENTS.md, README (badge 39, the --agent list, "another of the 17"), docs/coding-agents.md's init lines, docs/doctor.md, docs/integrations.md and docs/support.md; gptme's paths in TK-F009's comment. Docs: a limits row for Cygnux-Labs#788's known gaps; two bare | in Cygnux-Labs#781's limits row escaped. The plugin's SKILL.md is tracekit-skills 4bda57a. Evals re-recorded once: E17 (901 harmful stopped, 1 false alarm in 944), E21 policy robustness (held-out 279 / 420 default, 305 / 420 strict; latency rows kept as main's) and E21 robustness (901 originals and 2,701 rewrites contained). Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This carries #752 by @jay23606. Their two commits are here as they wrote them, with author and sign-off kept. My commits on top finish the review of #752 (#752 (review)). A push to their branch was blocked, so this is a separate PR from main.
The bug
On main, the coding pack lets a shell command create a login, set the setuid or setgid bit, write the cron spool, or append a network shell (
/dev/tcp/,nc -e,ncat -e,socat) to a shell startup file. Each of these keeps access to a machine after the agent's session ends, and each was allowed or only flagged.The change
The coding pack's
asksection now holds these commands so a person can decide. The rules cover account creation and group changes (useradd,adduser,usermod,dscl), writes to/etc/passwd,/etc/shadowand sudoers, setuid and setgid modes, cron spool writes, and network shells appended to startup files. Ordinary startup-file edits,crontab -l,chmod 755andidstay allowed.How it was tested
PYTHONPATH=.:tests .venv/bin/python -m unittest test_signer_policy.CodingPack.test_a_login_setuid_cron_or_network_shell_is_held_and_its_lookalikes_are_not: passes on the fix. On the base coding pack it fails withAssertionError: 'allow' != 'ask'.PYTHONPATH=.:tests .venv/bin/python -m unittest test_signer_policy: OK.Regression test: fails on base three times (/AssertionError: 'allow' != 'ask'/), passes on fix three times (
PYTHONPATH=.:tests .venv/bin/python -m unittest test_signer_policy.CodingPack.test_a_login_setuid_cron_or_network_shell_is_held_and_its_lookalikes_are_not)What the carry adds (the review's remaining items)
Their second commit (8b968ac) bounded TK-A069's options and read tee's words in TK-A070. TK-A070 still scanned to the end of the line from every
/dev/tcp/: 2,086 ms on the speed test's fillers on the fallback engine. These patterns replace both.bash.exe.stackdump.>. TK-A069 reads up to eight options before the mode. On the fallback engine an unbounded option list, and a greedy run before a character class, backtracked quadratically. TK-A067's-[a-zA-Z]*[Gg][a-zA-Z]*took about 7 s onusermod -gggg…. Its letters beforeGcan't beGnow, and its words are bounded to 16. Each of these limits has alean:comment.field: line, sotee ${X}-ais read astee -a.7755,5755,3755,04755,=4755,u+sx,+sx,g+s,u+x,u=rwxsandu-x+sare held.u-s,1777and0755aren't.nc host port -e,nc -nv host port -e,nc -c,ncat --execand--sh-exec,netcat,/dev/udp/, and TK-F011's startup files.gpasswd -a/-M/-Ainto sudo, wheel or admin,usermod -u 0(with or without-o),-gand--gid, and-Gsudo. TK-A068 holds writes to/etc/groupand/etc/gshadow./etc/cron*(cron.daily,cron.hourly, …), and a copy into/var/spool/cron/crontabs/<user>.test_other_spellings_of_a_login_setuid_cron_or_network_shell_are_heldruns on every pack and both engines. It fails on 89ddb52. I added 17 deny rows and 6 benign rows.2026.11-v2-87(we settle the final number at merge). E17, E21 and E21's rewrites are recorded again and the docs quote them. The persistence count and thepolicy lintresult are below.Results
strict.yamlalso holds three of the new benign startup-file edits throughTK-F011, as it holds every startup-file edit; no new rule holds them.tracekit policy lint: ok forcoding.yaml,dev.yaml,server.yamlandstrict.yaml.2026.11-v2-87for now; other open policy PRs also take numbers, so the final one is settled at merge.docs/evaluation.mdanddocs/limits.mdquote the new numbers (this changes the E17 and E21 numbers in README.md).How the carry was tested
I ran everything in a sealed Linux container (python 3.11, no network):
test_other_spellings_of_a_login_setuid_cron_or_network_shell_are_held, run on every pack and both engines: it fails on 89ddb52 and passes here;tests/test_policy2.py::Speed::test_every_pack_pattern_searches_64_kib_within_budgetandTimedAndBraced::test_a_word_of_only_expansions_is_also_read_as_gone: both fail on 89ddb52 and pass here;tests/test_eval_docs.py,tests/test_e21_policy.py,tests/test_e21_robustness.py,test_signer_policy.py::ServerCorporaand pyflakes: pass.The tree is the same one tested there, and CI runs the full matrix.
Fixes #750. Carries #752.