Skip to content

fix(brain): narrow intent credential admission - #587

Merged
vladimirrott merged 5 commits into
lacs-project:mainfrom
QinXi-ai:fix/543-intent-secret-boundaries
Oct 12, 2026
Merged

vladimirrott merged 5 commits into
lacs-project:mainfrom
QinXi-ai:fix/543-intent-secret-boundaries

Conversation

@QinXi-ai

@QinXi-ai QinXi-ai commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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=hunter2 and --token=abc123def remain refused. Natural-language value detection accepts punctuation throughout the value and includes use, so with password P@ssw0rd and use password hunter2 are 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

  • Tests added or updated: four new Rust tests in the original change cover ordinary administrative intents, realistic credential formats and boundaries, assignments and log redaction. The review extends an existing test with four credential intents plus PGP headers; it adds no new test functions.
  • Documentation updated if behavior changed.
  • Security impact considered: known value-bearing credentials remain refused; acceptance is never described as proof of secret absence.
  • Trust boundary preserved (daemon remains the only privileged executor).
  • CI passes on the updated head: all executed upstream checks passed, including Rust, frontend, docs/hygiene, scripts, PostgreSQL contract, dependency/security audit, secret scan, CodeQL and container-image. Container-smoke was intentionally skipped.

The review regression was observed red on the previous branch matcher (--password=hunter2 was 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-postgres reported one failed check because the remote host lacks gh for 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 head 8efbd97193275c5201b11664f52b65ae4be07c70.

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.

@QinXi-ai
QinXi-ai requested a review from vladimirrott as a code owner October 6, 2026 18:14

@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 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:

  1. Every label pattern opens with (?:^|[^\p{L}\p{N}_-]), so a - cannot precede password or token, and --password= never matches. That boundary is right for the prefixes (it keeps disk- and task-sk- out) and wrong for labels. A label boundary of (?:^|[^A-Za-z0-9_]) lets --password= match and still keeps password_max_days out.
  2. The with|using password <value> pattern needs the value to be [a-z0-9_+/-]* with a digit or symbol in it, so P@ssw0rd stops at @ before it reaches the 0. use password hunter2 has no with or using at all. A value class of \S*[^\p{L}\s]\S*, and use added 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 at PRIVATE 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.

@QinXi-ai
QinXi-ai force-pushed the fix/543-intent-secret-boundaries branch from b237935 to 8efbd97 Compare October 9, 2026 02:27
vladimirrott
vladimirrott previously approved these changes Oct 9, 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.

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
@QinXi-ai

Copy link
Copy Markdown
Contributor Author

Merged current main to clear the conflicts. The only conflicting lines were the published Rust test count (README, docs/introduction.md, docs/distro-support.md, tests/evidence/workspace-tests.json). Per CONTRIBUTING ("whoever merges carries it"), I dropped this PR's count bump and left those four files at main's value, so the open PRs no longer conflict with each other on the figure. This PR adds 4 Rust tests, so rust may be red on the baseline alone until the figure is regenerated at merge. No other changes since approval. @vladimirrott could you re-approve when convenient?

@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.

Approving again at 61adefd. Since my review at 8efbd97 the branch only picked up main and the test count: I merged main after #573 landed and set 1,962 (1,958 on main plus your 4). Your value-bearing-labels test still fails when I put back the old left boundary, same as before.

@vladimirrott
vladimirrott merged commit f3143d8 into lacs-project:main Oct 12, 2026
13 checks passed
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.

Intent admission matches substrings, so "disk-full", "/etc/passwd" and "password aging" are refused as secrets

2 participants