Skip to content

docs: align Security Model wording with sudoers and pin the claim - #487

Merged
vladimirrott merged 6 commits into
lacs-project:mainfrom
yuee3:docs/security-model-wording
Sep 23, 2026
Merged

vladimirrott merged 6 commits into
lacs-project:mainfrom
yuee3:docs/security-model-wording

Conversation

@yuee3

@yuee3 yuee3 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

What

Rewrite the Security Model preamble in SECURITY.md so it matches the trust boundary already described in packaging/sysknife-sudoers, and pin the replacement wording in scripts/check_public_claims.sh.

  • Say what the model gives: each layer gates a different stage of one request path, and the sysknife service account is root-equivalent by design.
  • Put the daemon-compromise case in the preamble, where an operator sizing blast radius will read it.
  • Add the ROOT_SHELL_UNITS example: the denylist stops unit names from the LLM/MCP path; it is not containment.
  • Retire the "every layer is independent / a bypass of one does not bypass the others" sentence.
  • Soften the Known Limitations line that leaned on independence ("the downstream enforcement layers cap their blast radius") to "the later gates on the same request path still apply".

Why

Closes #483. SECURITY.md:43-44 and packaging/sysknife-sudoers:9-12 describe the same trust boundary and disagree. All five layers run inside one process as sysknife, and that account holds useradd, systemctl, and a trailing-wildcard apt-get — each reaches root on its own. The sudoers header is accurate; the independence sentence invites a reader to treat ROOT_SHELL_UNITS as containment.

check_public_claims.sh

Yes, the replacement wording can be pinned there, and this PR pins it:

reject_pattern 'Every layer is independent|a bypass of one does not bypass the others' \
    'layers are sequential gates on one request path, not independent walls' "${claim_files[@]}"

A sentence that drifted once will drift again.

How checked

  • Read SECURITY.md against packaging/sysknife-sudoers and packaging/sysknife-daemon.service.
  • Read ROOT_SHELL_UNITS in crates/sysknife-daemon/src/actions/validate.rs (refuses debug-shell/emergency/rescue/runlevel1/single for typed actions) and kept both what it does and what it does not do in one place.
  • Scanned the rest of SECURITY.md for sentences leaning on independence; Layer 4 already carries the right register ("This boundary protects against an untrusted MCP agent, not against arbitrary malware already running as the same Linux user").
  • Documentation-only change. No code, config, or sudoers grant touched.

Note

#483 was offered to @mikevillari. If that work is already underway, please close this in favour of it — happy to rebase or drop.

@yuee3
yuee3 requested a review from vladimirrott as a code owner September 22, 2026 10:23

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this, and welcome. You took the part of #483 that was easiest to skip, the request to pin the wording so it cannot drift back, and you did it rather than writing a sentence saying why it was hard. The preamble rewrite is accurate: it names the sequential-gate framing, the User=sysknife line, and the three grants that reach root on their own, and it points the reader at packaging/sysknife-sudoers where the honest wording already lived.

One blocking item, and it is the guard rather than the prose.

The pin cannot fire on the file it was written for. reject_pattern runs over claim_files, which check_public_claims.sh reads from CLAIM_FILES in check_evidence_claims.py. SECURITY.md is not in that list:

$ python3 -c "
import importlib.util
spec = importlib.util.spec_from_file_location('c','scripts/check_evidence_claims.py')
m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
print('SECURITY.md screened:', 'SECURITY.md' in m.CLAIM_FILES)
print('files:', len(m.CLAIM_FILES))"
SECURITY.md screened: False
files: 16

I applied your reject_pattern line verbatim to main, put the retired sentence back into SECURITY.md, and ran the check:

$ grep -c 'Every layer is independent' SECURITY.md
1
$ bash scripts/check_public_claims.sh; echo "rc=$?"
Published figures match the evidence artifacts.
Public claims are internally consistent.
rc=0

Green, with the exact sentence the pin exists to reject sitting live in the tree. Adding SECURITY.md to CLAIM_FILES is the fix. Please check what else that turns red before you push: the file is long and the other reject_pattern calls will start seeing it for the first time, which may surface real wording to fix or may need the pattern scoped.

Whatever you land, show the mutation in the PR: the sentence restored, the check red, the sentence removed, the check green. A guard that has never been observed failing is the defect this tracker catches most, and it is the one thing #483 asked for that nothing else in the diff can demonstrate.

Two smaller notes, neither blocking:

scripts/check_public_claims.sh goes from mode 100755 to 100644 in the diff. The release rehearsal calls it as bash scripts/check_public_claims.sh so nothing breaks today, but it is almost certainly not what you meant. chmod +x and amend.

The apt-get grant you cite as trailing-wildcard is spelled env DEBIAN_FRONTEND=... NEEDRESTART_MODE=a /usr/bin/apt-get *, and v0.19.0 and v0.20.0 have since narrowed sixteen of the grant families your text describes, including systemctl and useradd. Rebase on main and the ROOT_SHELL_UNITS section will need one adjustment: systemctl now carries per-subcommand constraints, so sudo -n /usr/bin/systemctl start rescue.target is refused by the grant itself. The denylist-is-not-containment point still stands and is still worth making; the worked example needs a different verb.

Once the pin bites and the mode bit is back, this merges. Say the word if you would rather I take the CLAIM_FILES half and leave you the prose.

If you administer Linux boxes yourself, sysknife doctor and sysknife audit verify are read-only and take nothing but a checkout, and I would rather hear what they get wrong on a real host than guess.

SECURITY.md was not in CLAIM_FILES, so the reject_pattern added for it
ran over a list that did not include the file. Add it, restore the
executable bit on check_public_claims.sh, spell the grants the way
packaging/sysknife-sudoers writes them, and switch the denylist example
to the systemctl enable grant. Extend public-claims.test.sh with the
mutation: sentence restored -> red, sentence removed -> green.
@yuee3

yuee3 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review — and for catching that the pin could not fire. Pushed 53b0dc3 addressing every blocking item.

The pin now bites

SECURITY.md is in CLAIM_FILES. The fixture in tests/release/public-claims.test.sh copies claim files from that list, so the new mutation actually exercises the pin:

printf '
SysKnife uses a layered enforcement model. Every layer is independent; a
bypass of one does not bypass the others.
' >> "$fixture/SECURITY.md"
assert_rejected 'layer-independence framing restored in SECURITY.md'
cp "$repo_root/SECURITY.md" "$fixture/SECURITY.md"

Mutation, observed

=== sentence removed (current PR) ===
reject_pattern rc=0  (pin silent)

=== sentence restored ===
413:SysKnife uses a layered enforcement model. Every layer is independent; a
reject_pattern rc=1  (pin fires)

=== sentence removed again ===
reject_pattern rc=0  (pin silent)

The other notes

  • Mode bit: scripts/check_public_claims.sh is back to 100755.
  • Worked example: systemctl start rescue.target is gone. The section now names the enable grant — sudo -n /usr/bin/systemctl enable --now debug-shell.service — which is a different verb and is matched by systemctl enable *.
  • Grant spellings: the preamble now quotes the sudoers lines verbatim — useradd --create-home *, one systemctl grant per subcommand, and env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a /usr/bin/apt-get *. Dropped "trailing-wildcard apt-get".

What adding SECURITY.md to CLAIM_FILES turns red

Nothing in the numeric checker: SECURITY.md states no <n> Rust tests / typed actions / N/M stories figures. The only reject_pattern that sees it is the independence pin, which is the one written for it. The new mutation above is the observed proof.

I did not touch packaging/sysknife-sudoers — the prose now describes what main already ships, including the per-subcommand systemctl narrowing and the --create-home prefix on useradd. The denylist-is-not-containment point is unchanged in substance.

Happy to take another look at the example verb if enable --now is not the worked example you had in mind.

vladimirrott
vladimirrott previously approved these changes Sep 23, 2026

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 53b0dc3b. You fixed the right thing and then proved it: SECURITY.md is in CLAIM_FILES, and the new fixture puts the retired sentence back and asserts the check rejects it. I ran tests/release/public-claims.test.sh on your branch merged with current main, in a container, clean and with two mutations:

=== clean rc=0
Public claims contract passed.
=== m1 rc=1      ("SECURITY.md" removed from CLAIM_FILES)
FAIL: checker accepted stale claim: layer-independence framing restored in SECURITY.md
=== m2 rc=1      (the independence reject_pattern deleted)
FAIL: checker accepted stale claim: layer-independence framing restored in SECURITY.md

My merge tooling observed the same thing independently (receipt recorded for #487 at 53b0dc3b (observed: clean pass, mutated fail)). markdownlint-cli2 0.23.2 reports 0 issues on the new SECURITY.md, and your branch merges into main with no conflicts.

I owe you a correction. Last round I told you sudo -n /usr/bin/systemctl start rescue.target is refused by the grant itself. That was wrong. packaging/sysknife-sudoers on main still has:

sysknife ALL=(root) NOPASSWD: /usr/bin/systemctl start *

The narrowing split the bare systemctl grant into one line per subcommand, but each of those lines takes any arguments, so your original example was correct. Your new one, enable --now debug-shell.service under systemctl enable *, is also correct, so keep it. I'm sorry for costing you a rewrite on my mistake.

One small item, not blocking. This push flips two files from 100755 to 100644, the reverse of the fix you made to check_public_claims.sh:

$ git diff ca8ad237 53b0dc3b | grep -A2 '^diff --git a/\(scripts/check_evidence\|tests/release/public\)'
diff --git a/scripts/check_evidence_claims.py b/scripts/check_evidence_claims.py
old mode 100755
new mode 100644
--
diff --git a/tests/release/public-claims.test.sh b/tests/release/public-claims.test.sh
old mode 100755
new mode 100644

CI calls both through python3 and bash, so nothing breaks today. If you push again, git update-index --chmod=+x on both puts the bits back. If you don't, I'll restore them at merge.

Approving. The CI runs for this head are waiting on my approval as a first-time contributor's; that part is on me, not you.

This branch's Security Model rewrite cited `useradd --create-home *` and the
per-subcommand `systemctl` grants as the examples of what the daemon account can
reach root with, and `systemctl enable --now debug-shell.service` as the path
around ROOT_SHELL_UNITS. Both were true when it was written and stopped being
true in 0.21.0, which routed those verbs through the validating helper and
dropped the grants.

The point the section makes is unchanged and still correct: the layers are
sequential gates on one request path, and the account is root-equivalent. The
examples now name grants that are actually in the file, and the denylist section
says what 0.21.0 did and does not overstate it.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving at 28a52540. The extra commit on this branch is mine: 0.21.0 landed while this was open and removed the grants your Security Model text cited as examples, so the paragraph naming useradd --create-home * and the per-subcommand systemctl grants, and the one saying systemctl enable --now debug-shell.service walks around ROOT_SHELL_UNITS, were about to publish claims that are no longer true. They now name grants that are actually in the file (apt-get, snap install, rpm-ostree install) and say what 0.21.0 changed without overstating it.

Your point is unchanged and it is the reason this PR matters: the layers are sequential gates on one request path, sharing one root-equivalent account.

The pin earns its own receipt:

maintainer-merge verify 487 a2be2080 tests/release/public-claims.test.sh "s|reject_pattern 'Every layer|reject_pattern 'ZZZEvery layer|" shell
  shell suite: evidence of 1 executed unit(s), passing unmutated
  applying the mutation and re-running
  receipt recorded for #487 at a2be2080 (observed: clean pass, mutated fail)

My first attempt at that mutation edited the pattern string itself, which the fixture in your test also contains, so both sides changed together and the gate reported THE GUARD DOES NOT BITE. That was my mutation being self-cancelling, not your test.

@vladimirrott
vladimirrott merged commit ac2c8b9 into lacs-project:main Sep 23, 2026
13 checks passed
vladimirrott added a commit that referenced this pull request Sep 23, 2026
Both files went 100755 -> 100644 in that merge, which was mine to catch and I
did not. CI calls them through an interpreter so nothing went red, and
CONTRIBUTING.md:236 tells contributors to run check_evidence_claims.py
directly, where it fails with Permission denied. Found by the 11:16 review run.

The CHANGELOG lines are the ones that run listed as owed: #505's preflight fix
and #487's Security Model rewrite. #506 is test-only and needs none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SECURITY.md says the enforcement layers are independent; the sudoers file says they are not

2 participants