Repository navigation
feat(pii): add evidence-bound PII waivers and skip Proton profile paths - #307
Conversation
The PII scan reported Proton (Steam Play) prefix paths such as compatdata/<appid>/pfx/drive_c/users/steamuser/ as personal macOS paths and failed the run, although steamuser is the Windows profile name Proton uses for every player. Personal-path matches that are exactly pfx/drive_c/users/steamuser/, with pfx starting a path component and no ".." segment later on the line, are now skipped. More generally, the only way to accept a reviewed PII value was a PII.* severity override, which relaxes every finding of that check, everywhere, with no expiry. --pii-waivers PATH on validate, tier1 and pii-scan applies a version-1 waiver file. Each waiver names the PII check, the file (relative to the waiver file's directory), the line, the evidence_sha256 digest that PII findings now carry, a reason, an owner and a created/expires window, and stops applying when any of them no longer matches. Reports list each waiver for a scanned skill as applied (INFO), stale (LOW) or expired (MEDIUM), at the path base of the PII findings, so one file serves single-skill, folder and catalog runs. The CLI rejects a malformed file with exit code 2; through the API it applies no waivers and fails the PII scan with a HIGH invalid-pii-waiver-file finding. Waivers are never discovered automatically inside the scanned skill. To keep the credential masking in reports intact, findings carry a digest only for values they show unmasked, and credential checks cannot be waived: a digest of a masked password would let anyone holding the report test guesses for it offline. The Proton, home-path and Luhn filters and the waiver check now drop candidates before the first match on a line is chosen. A waiver is therefore consulted only for a value the scan would report, and a value that is not reported no longer hides a personal path or home path later on the same line. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Automated review: 9 findings (0 P1, 2 P2, 7 P3); 8 posted inline.
Findings outside the diff or about the description:
PR_DESCRIPTION: P3: Under Tests > Results, the second bullet says the 2155-test run was done "After rebasing onto the v0.7.0 release commit". That commit no longer applies here. The branch is based ona61e1f3f, which reverts the v0.7.0 release commit (#302). There is no v0.7.0 tag,CHANGELOG.mdhas no 0.7.0 section, and this PR's entries sit under## Unreleasedabove## 0.6.0. A reader may think the PR targets a v0.7.0 release, or that the numbers come from a different base than the one under review. I re-ran the same test set at the current head on basea61e1f3fand got 2154 passed. The PR still holds up; only the description is out of date.
Suggested fix: Drop the v0.7.0 reference. Report the result for the base the branch is actually on (a61e1f3f, or current main after an update), using the count from that run.
No conflicts. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Parallel catalog children received the waiver path after resolve(), which follows a symlinked waiver file to its target. The loader resolves file entries against the directory the link sits in, so each child looked under the target's directory and silently skipped every waiver. Forward the absolute path instead; children run in the parent's working directory. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Proton steamuser exemption only treated a .. after a path separator as traversal, so lines that build a path with "+ \"../x\"", / ".." /, os.path.join(..., "..", ...) or "cd ../x" were suppressed. Count a .. as a segment whenever a separator, whitespace, a quote or another delimiter bounds it on both sides. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
A waiver file entry with an embedded NUL loaded, then crashed the scan when its path was resolved: pii-scan exited 1 with a traceback and the Python API raised instead of reporting an invalid waiver file. Reject control characters in `file` and treat a path the OS refuses as unlocatable. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
matcher() compared the scanned file's resolved path, as a string, with the waiver's literal `file`, while findings() located the waiver's file through symlinks before judging it. A waiver written as .claude/skills/foo/SKILL.md for a symlinked skill directory was therefore judged stale next to the very finding it matched. Compare located paths in both places, and resolve each waiver's path once per scan. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Applied, stale and expired waiver findings copied the waiver's evidence_sha256 into their metadata even when the scan now masks that value, for example because it became, or sits beside, a credential. The report then held the offline-testable digest the masked PII finding leaves out. waiver_id and waiver_file identify the entry; the waiver file keeps the digest. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
A short credential elsewhere in the skill can occur inside the hex digest of an unrelated value. The digest is added after metadata redaction so it stays usable in a waiver; no test failed when the two steps were swapped. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The matcher applies a waiver through `expires` and findings() reports it as expired only after that day, but no test used the expiry day itself, so the two comparisons could drift apart unnoticed. The test pins the UTC date. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The created-in-future case used a date computed at collection time. A run that crosses 00:00 UTC between collection and the test left it only one day ahead, which the loader accepts, so the case failed. Compute the date from the loader's clock inside the test. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
I read the loader, the matcher, the new Proton pattern and the CLI change. The symlink handling, the control-character check in file, the digest handling in waiver findings and the Proton .. guard all look right, and the waiver and Proton tests pass. Nothing blocks; two non-blocking points on YAML loading and the expiry window are inline.
Conflicts: src/skillevaluator/tier_workflows.py, src/skillevaluator/validators/security.py. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…days Load waiver files with load_bounded_yaml so chained merge expansion is rejected up front instead of stalling argument parsing, keeping the line/column message for plain syntax errors. Reject an expires date more than 366 days after created so a waiver cannot be permanent. Tests build their waiver dates relative to today so the cap cannot drift into a failure. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
The earlier merge of main placed the Proton profile and unrelated home path entries under the Security subsection that main added at the end of Unreleased. Move both into the existing Fixed subsection, blank-line separated, and leave Security with main's entries only. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
`cd pfx/drive_c/users/steamuser/ && cd ..&& cd alice` and the unspaced `&&cd ..&&cd alice` form were still suppressed, because `&` did not bound a `..` segment. Accept shell `&` and path-list `:` as `..` boundaries without adding them to the characters that may precede `pfx`, and pin four more stay-reported cases. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nto naren/port-pii-waivers-proton No conflicts. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ntry ruff format folds the new window-too-long case onto one line, and the waiver entry under Unreleased Added is rewrapped to the file's line width after the 366-day window wording was added. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
Follow-up on the current head. Waiver files now load through load_bounded_yaml. The chained-merge file I used before is rejected at once instead of stalling, also with a duplicate key added, and the fallback keeps the line and column for plain syntax errors. expires more than 366 days after created is rejected. The & and : boundaries for a Proton .. segment look right. Nothing further from me.
Keep this branch's PII waiver plumbing (--pii-waivers, pii_waiver_path, Proton profile skip) alongside main's SkillSpector baseline plumbing (skillspector_baseline) in run_validation, run_tier1_workflow, and SecurityValidator. The PII line scan filters matches with main's _is_card_number_candidate before applying waivers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Pick up the Tier 2 contained directory alias fix (#282); no conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Pick up the PII timestamp, matrix, and vector false-positive fix (#304); no conflicts. Its numeric filters run before the waiver filter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Resolve the src/skillevaluator/cli.py and docs/cli-reference.mdx conflicts: keep this PR's new --pii-waivers option and add main's reworded --profile help (#334, default profile with external as a compatibility alias) after it. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Two changes to the Tier 1 PII check, both about handling false positives without weakening the scan. They are in one commit; review fixes follow it as separate commits.
Proton profile paths are no longer personal paths.
personal_pathsmatch is skipped only when all of these hold:/users/steamuser/(ASCII, any case).pfx/drive_corpfx\drive_c, withpfxstarting a path component...segment (plain or percent-encoded) appears anywhere later on the line. Windows folder names often contain spaces and quotes (My Games,Assassin's Creed), so the end of the path cannot be found reliably. A line with a..segment after the profile stays reported...counts as a segment when a path separator (plain or percent-encoded), whitespace, a quote, a shell&, a path-list:or another delimiter bounds it on both sides. Sosteamuser/" + "../alice/",Path(...) / ".." / "alice",os.path.join(..., "..", "alice"),cd ../alice,cd ..&& cd aliceandbin:..:/usr/binall stay reported.&and:bound only a..; they are not accepted beforepfx. Dots inside a folder name, such asSaves..oldorv1.., do not count._scan_lines_for_patternpicks the first match on a line. A native path such as/Users/alice/on the same line is still reported. Before this change, the steamuser match hid it.steamuseroutside apfx/drive_cprefix (~/.wine/drive_c/...,/Users/steamuser/,notpfx/...), lookalike characters, andC:\Users\steamuser.--pii-waivers PATHaccepts one reviewed PII value at a time.The option is available on
validate,tier1/tier1 validate, andpii-scan/tier1 pii-scan. Catalogvalidateforwards it to each per-skill child as an absolute path without resolving symlinks, so a symlinked waiver file keeps the link's directory as the base of its entries in every child.The new module
validators/pii_waivers.pyloads a strict version-1 YAML file through the bounded YAML loader, so chained merge expansion is rejected before it is expanded. Each waiver has exactly these fields:id,category,file,line,evidence_sha256,reason,owner,created,expires.The loader rejects:
database_credentials,hardcoded_secrets,jwt_tokens,github_tokens,aws_identifiers,webhook_urls,private_keys). The message says to remove or rotate the credential;.., backslash or non-normalized paths, and paths containing a control character such as NUL;createddate more than one day after the UTC date, or anexpiresdate beforecreatedor more than 366 days after it. The one-day allowance lets a reviewer east of UTC enter their local date; the 366-day cap brings every waiver up for review at least yearly.fileis relative to the directory that holds the waiver file (the link's directory when the waiver file is a symlink), so a waiver can only name a path under that directory.Applying a waiver and judging it locate the file the same way, following symlinked directories. A waiver written as
.claude/skills/foo/SKILL.md, where.claude/skills/foolinks toskills/foo, applies to a scan of either path, as doesskills/foo/SKILL.md.One waiver file serves single-skill, folder and catalog runs. Each run judges only the waivers whose file lies in a skill or folder it scanned:
--workers), reports only that skill's waivers. Its siblings' waivers are not reported as stale.A grouped PII finding whose value the report shows in full now has
evidence_sha256in its metadata: SHA-256 ofcategory, a NUL byte, and the case-folded matched value. The waiver file stores this digest, never the value.Waivers are matched per candidate, before the first-match-per-line choice. A waiver applies only while the check, file, line, digest and review window all match. A waived value never hides another value on the same line.
A waiver is consulted only for a value the scan would report. The
home_pathsidentity check and thecredit_cardsLuhn check now run in the same filter pass as the IP version-literal and Proton filters. So:/home/<user>/path no longer hides a personal home path later on the same line.After the scan (and after any LLM verification), each judged waiver's outcome is reported once, under the new
PII_WAIVERcategory:applied-pii-waiverstale-pii-waiverexpired-pii-waiverinvalid-pii-waiver-filePII_WAIVERfindings use the same path base as the PII findings in the same report:contact.mdfor a single-skill run,[skill] SKILL.mdin a folder run. SARIF locations therefore agree. The waiver's ownfilevalue is kept inmetadata.waiver_file.PII_WAIVERfindings do not repeat the waiver's digest. The scan may now mask the waived value (for example, it became, or sits beside, a credential), andwaiver_idandwaiver_filealready identify the entry.On the CLI, a malformed file is a usage error (exit 2) that names the problem. This follows the
--quality-configpattern. Through the Python API (SecurityValidator(pii_waiver_path=...)), it fails closed with the HIGH finding instead. Messages and file paths in reports name only the waiver file's basename.Waivers are never discovered automatically inside the scanned skill; the operator passes the file with
--pii-waivers. If an operator keeps it inside the scanned tree, it is PII-scanned like any other file, owners and reasons included, because it ships with the skill. The docs recommend keeping it outside. Digests, dates and paths in the file raise no findings.Docs: a new "PII waivers" section in
docs/tier1-validation.mdx(UTC dates, per-run scope, path base, which findings carry a digest, credential checks not waivable), a Proton note in thepiiaccordion, the exit-code-2 row, and the three option tables indocs/cli-reference.mdx. CHANGELOG entries under Unreleased / Added and Fixed. A comment inpii_patterns.yamlpoints to the Proton exemption.tests/golden/cli_surface.jsonis regenerated for the new option.Why
~/.local/share/Steam/steamapps/compatdata/<appid>/pfx/drive_c/users/steamuser/AppData/.... These appear in Markdown, shell scripts and Python. The/Users/[^/\s]+/pattern matched/users/steamuser/case-insensitively, so each such skill got a blocking HIGHpersonal_pathsfinding for a name that identifies no one. The only workarounds were rewriting the paths or--llm-verify.PII.<check>severity override in a policy file. That relaxes every finding of the check, everywhere, with no expiry. A waiver covers one value at one place for a bounded time, and it stops applying visibly when the evidence changes.Kept from public
matched_value, messages and source lines stay masked for credential categories. Masked values get no digest, and credential checks cannot be waived, so a report never holds an offline-testable stand-in for a masked secret.home_pathscheck, the Luhn check, author-email exemption and comment-line skipping. The Proton and waiver filters, and now thehome_pathsand Luhn checks, run as per-candidate filters before the first match is chosen.C:\\Users\\[^\\\s]+) is unchanged.--pii-waiversreuses the--quality-configapproach: a validatingclick.Pathtype, catalog-child forwarding, and the YAML loader that rejects duplicate keys with line and column errors.pii_pipelinetelemetry block, detector-version pinning of waivers, and a replay corpus.test_security.py.Notes for reviewers of open PRs
_scan_lines_for_pattern(as_is_card_number_candidate, which adds GUID handling) and announces and tests "a non-Luhn number no longer hides a later card". This PR moves the Luhn check only because the waiver check must run after it. It does not repeat fix(tier1): avoid false positives for argument hints and GUIDs #273's CHANGELOG entry or its test. Whichever PR lands second resolves the one-line conflict by keeping_is_card_number_candidate(match, line, previous_line)as thecredit_cardsfilter, before the waiver check.matched_valuetomatch.group("value")for patterns with a namedvaluegroup. On this branch, the waiver check andevidence_sha256both take their value fromSecurityValidator._reported_value(match). When feat(plugin): Add Plugin evaluation support across all tiers #28 lands, that change belongs in_reported_value, so thatmatched_value, the digest and waiver matching stay on the same value.test_waiver_digest_follows_the_value_findings_reportpins this.Tests
tests/validators/test_pii_waivers.py(new, 66 tests):waiver_file.expiresday (the UTC date is pinned).createdone day ahead of UTC is accepted; two days ahead, computed when the test runs, is rejected.file, and windows longer than 366 days. A 366-day window is accepted, and a file with chained YAML merges is rejected without expanding them.[one] SKILL.md.artifactLocationis the same for PII andPII_WAIVERresults._reported_value.tests/validators/test_security.py(28 new tests):.md,.sh,.pyand.txtfiles: code spans, prose, quoted shell arguments, shell assignment, Python literal, backslash prefix, mixed case, dots inside folder names.steamuser,notpfx, Wine prefix, other user,..and%2e%2e%2ftraversal,..after a segment with a space (My Games) or an apostrophe,..in string concatenation, apathlib/chain,os.path.join, a latercd ../alice,cd ..&& cd alice(spaced and unspaced),cd ..&cd alice, a:-separated path list with a..entry, lookalikeſ, WindowsC:\Users\steamuser.tests/test_commands.py: forpii-scan,tier1 pii-scan,tier1andvalidate:validaterun with one shared waiver file, serial and with--workers 2, each with a plain and a symlinked waiver file: each child report holds only its ownapplied-pii-waiver, andcatalog-summary.jsonhasseverity_totals.low == 0.main): 10 of the 28 newtest_security.pytests fail (the 8 Proton cases, the same-line native path that the steamuser match hid, and the home path behind an unrelated one; the other controls already pass), all 16 newtest_commands.pytests fail, andtest_pii_waivers.pycannot import its module.mainmerged at847bdb41):tests/validators,tests/cli,tests/golden,tests/reporting,tests/utils,tests/ci/test_secret_redaction.py,test_commands.py,test_cli.py,test_quality_config.py,test_checks_routing.py,test_oss_boundary.py,test_oss_source_hygiene.py,test_progress_output.py,test_evaluation_service.py,test_oss_packaging.py: 5471 passed, 6 skipped.ruff checkpasses on all changed Python files.ruff format --checkpasses onpii_waivers.py,test_pii_waivers.py,cli.py,tier1/commands.pyandtier_workflows.py.security.py,test_commands.pyandtest_security.pyalready fail it onmainin unrelated places. The formatter makes the same number of changes to them before and after this change, so the new lines are formatted.scripts/check_oss_boundary.pypasses.🤖 Generated with Claude Code