Skip to content

fix(audit): skip absolute metadata keys on Windows too - #345

Merged
runkids merged 1 commit into
runkids:mainfrom
star-nebula:fix/audit-abs-key-on-windows
Oct 3, 2026
Merged

runkids merged 1 commit into
runkids:mainfrom
star-nebula:fix/audit-abs-key-on-windows

Conversation

@star-nebula

Copy link
Copy Markdown
Contributor

What

checkContentIntegrity drops absolute file_hashes keys with filepath.IsAbs, but that
predicate is platform-dependent: on Windows /etc/passwd carries no volume, so IsAbs
reports false. The key then survives the guard and filepath.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:

host file_hashes: {"/etc/passwd": "…"}
Linux key skipped by the guard
Windows content-missing /etc/passwd finding for a path inside the skill dir

Releases 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 — IsAbs already covers those inputs — so
existing behavior is unchanged there; the volume-form Windows absolute paths (C:\…) keep
being caught by IsAbs as before.

Tests

TestScanSkill_ContentIntegrity_PathTraversal already covers the key set. Verified on a
windows/amd64 build of ./internal/audit:

  • stock 7043ca3a: --- FAIL: TestScanSkill_ContentIntegrity_PathTraversal
  • with this commit: package PASS, 0 failures
  • Linux (./internal/audit/): unchanged before and after

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

runkids commented Oct 3, 2026

Copy link
Copy Markdown
Owner

@codex review

@runkids
runkids merged commit b931c2a into runkids:main Oct 3, 2026
7 checks passed
@star-nebula
star-nebula deleted the fix/audit-abs-key-on-windows branch October 3, 2026 11:38
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.

2 participants