Repository navigation
fix(brain): narrow intent credential admission - #587
Conversation
vladimirrott
left a comment
There was a problem hiding this comment.
Reviewed at b2379359. One blocking item: four value-bearing intents that main refuses now get through.
The three false positives from #543 are gone, and moving the prefixes behind a single RegexSet with a token boundary is a cleaner design than the substring lists. The regex crate was already in Cargo.lock at 1.12.3 from crates.io, so the only lockfile change is the new edge from sysknife-brain.
I ran contains_sensitive over a fixed list of intents on main and on this branch, from a small example binary inside a --network=none container. I did not build this branch on my machine.
main this PR
run mysqldump --password=hunter2 mydb refused admitted
run curl with --token=abc123def refused admitted
connect with password P@ssw0rd refused admitted
use password hunter2 for the backup user refused admitted
my wifi password is hunter2 refused refused
set OPENAI_API_KEY=sk-proj-<48 chars> refused refused
show disk-full events refused admitted
check /etc/passwd permissions refused admitted
configure password aging for alice refused admitted
The last three rows are #543 working. The first four are the blocking item. Each one sends a password or token to the provider, and loggable_intent writes it to the log verbatim. Two causes:
- Every label pattern opens with
(?:^|[^\p{L}\p{N}_-]), so a-cannot precedepasswordortoken, and--password=never matches. That boundary is right for the prefixes (it keepsdisk-andtask-sk-out) and wrong for labels. A label boundary of(?:^|[^A-Za-z0-9_])lets--password=match and still keepspassword_max_daysout. - The
with|using password <value>pattern needs the value to be[a-z0-9_+/-]*with a digit or symbol in it, soP@ssw0rdstops at@before it reaches the0.use password hunter2has nowithorusingat all. A value class of\S*[^\p{L}\s]\S*, anduseadded to the verbs, would cover both.
Adding --password=hunter2, --token=abc123def, with password P@ssw0rd and use password hunter2 to contains_sensitive_detects_value_bearing_labels_and_assignments would pin them.
Optional, not blocking:
-----BEGIN PGP PRIVATE KEY BLOCK-----no longer matches, since the pattern ends atPRIVATE KEY-----.PRIVATE KEY(?: BLOCK)?-----covers it.regex = "1"sits at the end of[dependencies]as a direct pin. It's fine as is; I mention it only because most shared crates here go through[workspace.dependencies].
#573 also edits crates/sysknife-brain/tests/planner.rs and moves the test count, so whichever lands second needs a rebase and a regenerated baseline. That part is mechanical.
b237935 to
8efbd97
Compare
vladimirrott
left a comment
There was a problem hiding this comment.
Approving at 8efbd971.
You split the boundary the way I hoped: labels now open on [^A-Za-z0-9_], so --password= matches and password_max_days stays out, while the prefixes keep the stricter class that holds disk- and task-sk- back. All four of my intents are in contains_sensitive_detects_value_bearing_labels_and_assignments, and you picked up the PGP BLOCK form too.
My merge gate ran that test in a container, then again with the first label pattern's boundary put back to [^\p{L}\p{N}_-]:
running 'contains_sensitive_detects_value_bearing_labels_and_assignments' unmutated
rust suite: evidence of 1 executed unit(s), passing unmutated
applying the mutation and re-running
receipt recorded for #587 at 8efbd971 (observed: clean pass, mutated fail)
Your count holds after the rebase: four new tests and 1943 → 1947 in the evidence file and all three docs. I did not build this branch on my machine.
Nothing blocks on the code. #571 and #573 also move the test count from 1943, and #573 edits crates/sysknife-brain/tests/planner.rs as well, so this one will need a rebase and a regenerated baseline after whichever lands first. That part is mechanical. When you push it, I'll merge without a new round of review provided four things hold: the push changes no file under crates/**/src, apps/*/src, packaging/ or .github/; this same mutation still turns the test red on the new head; the board is fully green; and my approval is still on the PR.
…-boundaries * origin/main: fix(audit): chain SQLite status transitions and expose verdicts (lacs-project#571) fix(security): cover setup provider credential formats (lacs-project#578) # Conflicts: # README.md # docs/distro-support.md # docs/introduction.md # tests/evidence/workspace-tests.json
|
Merged current |
Main now carries 1,958 after lacs-project#573, and this branch adds four tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UpyrhbDTW1gBwzGAC44GYU
Entries for #570, #571, #572, #573, #575, #576, #577, #578, #579, #584, #586, #587, #589, #592, #594 and #603, plus the dependency bumps in #595, #596, #597, #599 and #600. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UpyrhbDTW1gBwzGAC44GYU
Summary
Substring admission refused ordinary intents such as disk-full alerts, /etc/passwd permissions and password aging. Replace bare keywords with value-bearing labels and known credential formats at token boundaries with plausible bodies. Cache the matcher; the regex dependency was already locked transitively and no dependency versions change.
Credential variable names must end in a credential term, preserving provider-qualified API keys and AWS access keys while allowing PASSWORD_MAX_DAYS, TOKEN_LIFETIME and API_KEY_FILE settings. Intent and preference documentation states the heuristic's limits and the absence of a separate credential entry path.
Related Issue
Closes #543.
Review fixes
Label boundaries now admit the leading dashes of command-line options while known key prefixes retain the stricter token boundary.
--password=hunter2and--token=abc123defremain refused. Natural-language value detection accepts punctuation throughout the value and includesuse, sowith password P@ssw0rdanduse password hunter2are refused too. The existing regression table asserts refusal and log withholding for all four reported intents. PGP private-key block headers are also covered.Rebased onto current main at
d4a702e60f53b4a2a9b2150b4050be16e37c7d05. Published test counts are regenerated from the resulting branch.Validation
The review regression was observed red on the previous branch matcher (
--password=hunter2was admitted) before changing the implementation. That focused red run used the previous dependency lock; all final validation uses the rebased current-main lock.Ubuntu validation on the rebased branch: cargo fmt; 14 focused sensitive-intent tests; full workspace nextest (1,947 passed, six configured skips); strict all-features/all-targets Clippy; Rust documentation with warnings denied; frontend install/audit/TypeScript/Vitest (72 tests); release/E2E shell fixtures; configured Markdown/YAML checks and all five changed Markdown documents. The measured baseline and three published Rust counts are synchronized.
scripts/ci-local.sh --no-postgresreported one failed check because the remote host lacksghfor live action-pin resolution. Its result is also INCOMPLETE: Markdown-link-check, ShellCheck, cargo-audit and live PostgreSQL were skipped locally; the new privileged action-steps assertion was skipped because the SSH account is not root. Other local gates passed. The upstream docs/hygiene, scripts, security-audit and PostgreSQL jobs subsequently passed on the updated head8efbd97193275c5201b11664f52b65ae4be07c70.Notes for Reviewers
The filter cannot identify arbitrary unlabelled passwords or every unknown credential format. ConfigureWifi and ProAttach credential entry remain outside this issue. Direct preference-file edits do not run this filter. Natural-language labels remain heuristic and may still classify ambiguous status descriptions as values.
Assisted by OpenAI Codex; the diff was reviewed and validation figures come from actual runs.