Repository navigation
fix(audit): skip absolute metadata keys on Windows too - #345
Merged
Merged
Conversation
checkContentIntegrity rejects absolute `file_hashes` keys with filepath.IsAbs, but that predicate is platform-dependent: on Windows "/etc/passwd" carries no volume, so IsAbs returns false and filepath.Join folds the key inside the skill directory. The scan then reports `content-missing /etc/passwd` for a key the guard means to drop, so the same metadata audits clean on Linux and noisy on Windows. Reject a leading separator as well, which is a no-op on Unix where IsAbs already covers it. TestScanSkill_ContentIntegrity_PathTraversal covers the key set and fails on Windows without the change.
Owner
|
@codex review |
runkids
approved these changes
Oct 3, 2026
5 tasks done
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.
What
checkContentIntegritydrops absolutefile_hasheskeys withfilepath.IsAbs, but thatpredicate is platform-dependent: on Windows
/etc/passwdcarries no volume, soIsAbsreports
false. The key then survives the guard andfilepath.Join(skillPath, "/etc/passwd")folds it inside the skill directory, so the scan walks a path the guard exists to reject.
Same metadata, two different audits:
file_hashes: {"/etc/passwd": "…"}content-missing /etc/passwdfinding for a path inside the skill dirReleases ship
windows_amd64/windows_arm64, so this is a supported-platform difference,not a lab case. Part of #344.
Fix
Also reject a leading separator, which is what "absolute" means for the POSIX-style keys this
metadata actually carries. On Unix this is a no-op —
IsAbsalready covers those inputs — soexisting behavior is unchanged there; the volume-form Windows absolute paths (
C:\…) keepbeing caught by
IsAbsas before.Tests
TestScanSkill_ContentIntegrity_PathTraversalalready covers the key set. Verified on awindows/amd64build of./internal/audit:7043ca3a:--- FAIL: TestScanSkill_ContentIntegrity_PathTraversalPASS, 0 failures./internal/audit/): unchanged before and after