Repository navigation
fix(security): accept verified referenced images in partial SkillSpector scans - #299
Conversation
…tor scans SkillSpector's static_patterns_* analyzers read text, so a skill that references a PNG or JPEG file (a logo rendered with , a screenshot, a template background) gets one nonfatal, whole-file static ledger exception per image and an analysis status of "partial". Tier 1 turned every partial analysis into an INCOMPLETE security scan, so ordinary skills that ship images could not pass, even with SkillSpector v2.12.0 and v2.13.x, which already drop their AE1 finding for a rendered PNG. The partial analysis now becomes a warning when referenced images are its only gap: every ledger exception is a nonfatal, whole-file static opaque_content or binary_content row from static_patterns_* analyzers on a .png, .jpg or .jpeg component; each such analyzer is degraded by exactly one partial work item per image; every other analyzer completed; and the uninspected-file counts and limitations match. Each image is then read with the existing descriptor-anchored SecureRoot reader, so it must be a regular, single-link file that is not reached through a symlink, and it must not be executable. Its bytes must be a well-formed PNG (whole chunk stream with valid CRCs) or JPEG (marker segments up to SOS, EOI at the end) matching its suffix, within 256 files and 128 MiB. Anything else, including a binary payload named logo.png, stays INCOMPLETE. SkillSpector's LOW-severity CAUTION recommendation for a partial analysis is accepted, and its own High AE1 findings are kept unchanged. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…or scans The image structure checks accepted a payload wrapped in a few image header bytes. SOI, an empty SOS segment, the payload and EOI passed as a JPEG. A PNG passed with no image data, an all-zero header, or an unknown critical chunk carrying the payload. The checks now corroborate the file type more fully, without decoding the image: - PNG: valid IHDR fields (nonzero size, a bit depth the colour type allows, known compression, filter and interlace methods), a palette exactly when the colour type needs or allows one, one contiguous IDAT run that starts a zlib stream, no unknown critical chunk and no reserved-bit chunk type. - JPEG: one SOF, valid DQT and DHT or DAC tables before the first scan, SOS components that belong to the frame with a matching length, entropy-coded data after each scan, and no reserved or misplaced marker. Entropy-coded data is skipped with a linear regex search. Ancillary PNG chunks and JPEG APPn or COM segments are still not inspected. The docs and CHANGELOG now describe the check as corroborating the file type, not as proving a well-formed image. An image in a directory whose files agents run, load as instructions or read as configuration is no longer accepted. That covers any hooks, scripts, tools, agents, commands, prompts, rules, team-rules or workflows directory, and a top-level config, skills, .mcp, .agents, .claude, .codex, .continue, .cursor, .gemini or .windsurf directory, compared without regard to case. A fatal or malformed scope exclusion also keeps the partial scan INCOMPLETE. With --llm both stages added the same warning. The LLM stage's word for word repeat is now dropped when the two results are merged. The path-reference fixture is recaptured with SkillSpector v2.12.0 for a complete baseline JPEG. Only the scan time, the JPEG component size and the finding IDs change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
e5b6238 to
6528825
Compare
rng1995
left a comment
There was a problem hiding this comment.
Automated review: 8 findings (0 P1, 0 P2, 8 P3); 7 posted inline.
Findings outside the diff or about the description:
PR_DESCRIPTION: P3: Two statements in the PR text don't match what the tests and code do.
-
Tests section. It says that without the fix, "The 26 rejection cases and the 2 bound cases pass." On main, the two
test_image_verification_is_boundedcases fail instead. Theypatch()skillevaluator.validators.security._PASSIVE_RASTER_MAX_FILES/_PASSIVE_RASTER_MAX_BYTES, and main doesn't define those names, sopatchraisesAttributeError: <module 'skillevaluator.validators.security' ...> does not have the attribute '_PASSIVE_RASTER_MAX_FILES'. I ranTestSkillspectorReferencedImagesagainst main'ssecurity.py, with the_is_png/_is_jpegimport stubbed so the module loads. The result was 12 failed and 26 passed. The failures are the 9 accepted cases, the 2 bound cases andtest_image_structure_checks. -
Why section. It says an ELF "or any other non-text payload named
logo.png" staysINCOMPLETEbecause of the structure and file checks, "including a payload wrapped in a few image header bytes". That is true for the trivialFFD8 FFDA 0002 <payload> FFD9wrapper. It is not true for a payload behind a minimal well-formed header:- PNG.
_is_pngchecks only the first two IDAT bytes. It returns True for IHDR (1x1 RGB), then one IDAT whose data is78 9Cfollowed by ELF bytes, then IEND, all with valid CRCs. - JPEG.
_is_jpegreturns True for DQT, SOF0, DHT and SOS, then the ELF bytes as entropy-coded data (0xFF stuffed), then EOI. - End to end. I wrote that PNG to
assets/logo.pngand ran it with the v2.12.0 image-reference fixture. The scan ispassed, with the referenced-image warning.
The Summary says the image data is not decoded, and the docs and CHANGELOG say ancillary chunks and APPn/COM segments are not inspected. But the Why sentence reads as if any non-text payload is rejected, and reviewers deciding on this security-gate relaxation are likely to rely on it.
- PNG.
Suggested fix: In Tests, say that without the fix the 9 accepted cases and the 2 bound cases fail (the bound cases with AttributeError, because they patch constants main lacks), only the 26 rejection cases pass, and the structure test cannot run. In Why, limit the claim to the trivial wrapper, and say that a payload in PNG IDAT data or JPEG entropy-coded data behind a well-formed header is not detected either, just like one in ancillary chunks or APPn/COM segments.
Signed-off-by: Narendran Raghavan <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Resolve conflicts with #299 in security.py: keep both sets of new helpers, and keep #299's passive-raster warning path while the remaining partial-analysis error uses _skillspector_incomplete_analysis_error. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
* docs(changelog): move entries released in 0.7.0-0.7.2 out of Unreleased 0.7.0 (#314) and 0.7.1 (#327) never cut their sections on main, and 0.7.2 (#335) added its section below the whole Unreleased block, so Unreleased still listed work that had already shipped. Place each Unreleased entry under the release that shipped the PR that added it: - 0.7.0: the published section from the 0.7.0 tag, verbatim. It already holds the six entries that main had filed under 0.6.0, so 0.6.0 again matches the v0.6.0 tag, including the original run_config.json entry. - 0.7.1: #264 #271 #274 #281 #284 #289 #293 #299 #316 #317 #318 #323 #324 #326 #327, plus the #320 wording of the Windows Git-root entry, since #320 changed that 0.7.0 fix in 0.7.1. - 0.7.2: #263 #265 #269 #270 #276 #279 #287 #290 #296 #309 #328 #330 merged with the existing #335 entries. Only post-v0.7.2 entries stay under Unreleased, with one heading per subsection. Entry text is unchanged, apart from the published tag wording in 0.7.0 and 0.6.0. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(release): prepare v0.8.0 Set the package, fallback, lock, citation and developer-guide versions to 0.8.0 and move every entry merged since v0.7.2 under '## 0.8.0 - 2026-11-05', leaving Unreleased empty. The refusal-fallback documentation test now reads the release section that names CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK, requires it to be 0.8.0, and requires exactly one entry there to name the switch. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(release): pin the verified 0.8.0 Tier 1 image and add its CI bundle Pin onboarding to the Tier 1 image published by the reviewed main revision 55d2d04 in "Build and publish Tier 1 image" run 42158955180: ghcr.io/nvidia/skillevaluator-tier1@sha256:9d5483243918937be4f2178f74cf7c622a531dee41e3176906994d52fa14950a (config sha256:d17d6f5105ec5f1bf0cbe4dff0d693aae4ecf01e9c1c6a6ddb7830518acace33). The workflow and publisher refs both move to 55d2d04. ci/bundles/0.8.0 mirrors the 0.7.2 bundle. The templates, README and release.json are the run's github-actions-onboarding artifact and match ci/render_templates.py output for these pins byte for byte. The scanner inventory and verification receipt come from the build's runtime-stage version step, the five-case smoke receipt, the onboarding job's anonymous pull, and the public manifest, whose config digest equals the smoke-tested image ID. The ZIP uses the 0.7.2 layout (sorted members, inner checksums, 1980 timestamps, 0644, deflate level 9) and rebuilds to identical bytes. Point the current-bundle links at 0.8.0 and list 0.7.2 as historical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]> --------- Signed-off-by: Narendran Raghavan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
A skill that references a PNG or JPEG no longer ends Tier 1
INCOMPLETEsolely because SkillSpector's text analyzers cannot read the image. The image gap becomes a warning only after strict report accounting and local file verification; existing scanner findings keep their severity and can still fail the check.opaque_contentorbinary_contentledger rows fromstatic_patterns_*analyzers. Every analyzer, limitation, component and uninspected-file count must account exactly for the image gaps, and before/after finding counts must match.SecureRoot.read_bytes: regular, single-link, non-executable, no symlink traversal, a matching PNG/JPEG structure, at most 256 images and 128 MiB total. Staging does not bypass the original tree's hard-link protection.agents,commands,hooks,prompts,rules,scripts,team-rules,tools,workflows) and top-level configuration/skill roots (config,skills,.mcp,.agents,.claude,.codex,.continue,.cursor,.gemini,.windsurf), case-insensitively.main, preserving its timeout, LLM provenance and other changes.Limits of the check
The structure check corroborates the format; it does not decode images or prove that they render. PNG compressed IDAT data beyond the zlib header and ancillary chunks, and JPEG entropy-coded data and APPn/COM segments, are not inspected and can carry arbitrary payloads behind otherwise well-formed headers. The warning explicitly says image content was not assessed.
A plain ELF payload named
logo.png, the trivial JPEG wrapperFFD8 FFDA 0002 <payload> FFD9, and a PNG with an unknown critical chunk stayINCOMPLETE. A payload embedded in the unassessed regions described above can pass the structure check. Any image under an excluded agent-control directory staysINCOMPLETEregardless of its bytes.SkillSpector's High
AE1findings remain unchanged. In the captured versions, only Markdown-rendered PNG references omit that finding from v2.12.0 onward; inline-code PNG references and JPEG references still fail onAE1.Not in this PR
recalculate_from_findings(keep_legacy=True)support is also needed to retain plain warnings when successful LLM-stage finding deduplication rebuilds them.validators/skillspector_scope.py; that module is not yet onmain. Whichever PR merges second should derive the raster sets from_AGENT_INSTRUCTION_DIRS | _AGENT_EXECUTABLE_DIRSand_HIDDEN_AGENT_CONFIG_DIRS | {_AGENT_CONFIG_DIR, ".mcp", "skills"}to keep future directory additions consistent.Validation
TestSkillspectorReferencedImages: 65 passed, including captured v2.12.0/v2.13.2 reports, malformed images, link/mode/location rejection, image budgets, unequal finding counts, extra uninspected files, incomplete-LLM finding warnings, original-tree hard-link verification, reserved JPEG extension markers and empty scans.AttributeErrorbecause its limit constants do not exist. Its 26 rejection cases pass, and the structure test requires the new helpers.