Repository navigation
fix(tier1): keep file scans inside the skill directory - #837
Merged
Merged
Conversation
Tier 1 file walkers returned symlinked files wherever they pointed, and readers such as the PII scan opened them with Path.read_text, which follows the link. A skill holding references/notes.md -> /some/host/file made a default Tier 1 run copy matching lines from that host file into the JSON, HTML and SARIF reports as line_content. iter_scannable_files now drops a symlinked file whose target resolves outside the skill root or does not exist; links that resolve inside the skill are returned as before, and symlinked directories are still not descended. The boundary check lives in a small path_resolves_inside helper, and _scan_file_for_pii applies it directly so callers that hand it a path bypassing the walker get the same protection. A new iter_outside_symlinks helper lets Code Integrity & Hygiene record a low-severity symlink_outside_skill finding for each skipped link, named by its path inside the skill and never by its target. Refs #833 Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
chrisknvidia
marked this pull request as ready for review
November 20, 2026 18:15
chrisknvidia
requested review from
mosheabr,
rmalani-nv and
rng1995
as code owners
November 20, 2026 18:16
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
The skipped-symlink finding stored the escaped and truncated display text in file_path. SARIF reads file_path as a real path, so a non-ASCII or long link name pointed at a file that does not exist. Store the exact relative path in file_path and apply the display helper to the message only. Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
rng1995
reviewed
Nov 20, 2026
rng1995
left a comment
Collaborator
There was a problem hiding this comment.
I reproduced two ways an outside link can still affect a Tier 1 report.
rng1995
reviewed
Nov 20, 2026
rng1995
left a comment
Collaborator
There was a problem hiding this comment.
I also reproduced a license-policy result based on a file outside the skill.
The dependency audit built requirements.txt and requirements-dev.txt paths directly and read them with read_text, so a symlink at either name pointed the audit at a file outside the skill, and every unpinned line was quoted verbatim in a warning. The same run also reported that link as skipped, so the two checks contradicted each other. The audit now skips a requirements file that is a symlink resolving outside the skill, leaving the symlink_outside_skill finding as the only record of it, and the unpinned-dependency warning quotes only the parsed package name instead of the whole line. Refs #833 Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Collaborator
Author
|
Follow-up pushed: the hygiene dependency audit opened |
os.walk only withholds symlinked directories, so it entered a junction as a plain directory and the scanners read files behind it. Drop junctions before the walk descends and report the ones whose target is outside the skill with the same symlink_outside_skill finding. Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
The license check read root LICENSE and COPYING files directly, so a symlink to an outside Apache-2.0 file made a skill with no declared license report Apache-2.0 as allowed. Skip links that leave the skill without reading them; symlink_outside_skill still reports them. Update the changelog entry to cover junctions and these root files. Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
This was referenced Nov 22, 2026
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.
Summary
Tier 1 file walkers returned symlinked files wherever they pointed, and readers such as the PII scan opened them with
Path.read_text, which follows the link. A skill holdingreferences/notes.md -> /some/host/filemade a default Tier 1 run copy matching lines (emails, IPs, phone numbers, home paths) from that host file into the JSON, HTML and SARIF reports asline_content.Changes
iter_scannable_filesskips a symlinked file whose target resolves outside the skill root or does not exist. Links that resolve inside the skill are returned as before; symlinked directories are still not descended. Only symlinks pay theresolve()cost.path_resolves_insidehelper holds the boundary check;_scan_file_for_piiapplies it directly so a caller that hands it a path without going through the walker gets the same protection.iter_outside_symlinkshelper; Code Integrity & Hygiene records a low-severitysymlink_outside_skillfinding for each skipped link, named by its path inside the skill and never by its target, so authors know the content was not scanned.Audit of other readers: unicode, license header, dead-link and PII/secrets scans all take files from
iter_scannable_files, so they are covered. Bandit and Semgrep walk the directory themselves and would still follow a symlinked.py; that is a smaller, separate path worth its own follow-up.Verification
Repro from the issue (with a non-placeholder address, since
example.comis exempt from the email pattern): before, the JSON report quoted the host file's line; after, it does not, the PII scan counts one file, and the report namesreferences/notes.mdas skipped.Tests cover the walker (outside link skipped, inside link kept, dangling link skipped, symlinked directory not descended), the PII scan, the hygiene finding, and an end-to-end check that JSON/Markdown/HTML reports contain none of the host file's content.
tests/validators/: 5408 passed, 2 skipped locally.Refs #833