Skip to content

fix(security): accept verified referenced images in partial SkillSpector scans - #299

Merged
rng1995 merged 4 commits into
mainfrom
naren/port-skillspector-raster-exclusions
Nov 2, 2026
Merged

rng1995 merged 4 commits into
mainfrom
naren/port-skillspector-raster-exclusions

Conversation

@rng1995

@rng1995 rng1995 commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A skill that references a PNG or JPEG no longer ends Tier 1 INCOMPLETE solely 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.

  • Accept only nonfatal, whole-file opaque_content or binary_content ledger rows from static_patterns_* analyzers. Every analyzer, limitation, component and uninspected-file count must account exactly for the image gaps, and before/after finding counts must match.
  • Verify each file in the original skill tree with descriptor-anchored 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.
  • Exclude agent instruction/executable directories at any depth (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.
  • Validate PNG chunks, CRCs, header/palette rules, contiguous IDAT and final IEND. Validate JPEG frame/table/scan segments, reject reserved extension and out-of-place markers, require entropy-coded bytes in every scan and final EOI.
  • Apply the rule to static and LLM stages. Suppress duplicate plain warnings while retaining each finding's warning when an incomplete LLM stage prevents finding deduplication.
  • Document the file/link conditions, limits and unassessed content. Merge current 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 wrapper FFD8 FFDA 0002 <payload> FFD9, and a PNG with an unknown critical chunk stay INCOMPLETE. A payload embedded in the unassessed regions described above can pass the structure check. Any image under an excluded agent-control directory stays INCOMPLETE regardless of its bytes.

SkillSpector's High AE1 findings 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 on AE1.

Not in this PR

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.
  • The original pre-change baseline has 9 accepted-case failures and 2 bound-case failures; the bound cases raise AttributeError because its limit constants do not exist. Its 26 rejection cases pass, and the structure test requires the new helpers.
  • Latest-main helper and plugin-risk regression modules: 265 passed.
  • Ruff check passes on changed Python files; OSS boundary scan passes.
  • Fern check passes; redirect validation produces the existing warning because Fern authentication is unavailable.

rng1995 and others added 2 commits October 30, 2026 12:49
…tor scans

SkillSpector's static_patterns_* analyzers read text, so a skill that
references a PNG or JPEG file (a logo rendered with ![Logo](assets/logo.png),
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]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
  1. 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_bounded cases fail instead. They patch() skillevaluator.validators.security._PASSIVE_RASTER_MAX_FILES / _PASSIVE_RASTER_MAX_BYTES, and main doesn't define those names, so patch raises AttributeError: <module 'skillevaluator.validators.security' ...> does not have the attribute '_PASSIVE_RASTER_MAX_FILES'. I ran TestSkillspectorReferencedImages against main's security.py, with the _is_png/_is_jpeg import stubbed so the module loads. The result was 12 failed and 26 passed. The failures are the 9 accepted cases, the 2 bound cases and test_image_structure_checks.

  2. Why section. It says an ELF "or any other non-text payload named logo.png" stays INCOMPLETE because of the structure and file checks, "including a payload wrapped in a few image header bytes". That is true for the trivial FFD8 FFDA 0002 <payload> FFD9 wrapper. It is not true for a payload behind a minimal well-formed header:

    • PNG. _is_png checks only the first two IDAT bytes. It returns True for IHDR (1x1 RGB), then one IDAT whose data is 78 9C followed by ELF bytes, then IEND, all with valid CRCs.
    • JPEG. _is_jpeg returns 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.png and ran it with the v2.12.0 image-reference fixture. The scan is passed, 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.

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.

Comment thread CHANGELOG.md Resolved
Comment thread docs/tier1-validation.mdx Resolved
Comment thread tests/validators/test_security.py Resolved
@rng1995
rng1995 enabled auto-merge (squash) November 2, 2026 20:30
@rng1995
rng1995 merged commit f4287e3 into main Nov 2, 2026
21 checks passed
@rng1995
rng1995 deleted the naren/port-skillspector-raster-exclusions branch November 2, 2026 20:36
rng1995 added a commit that referenced this pull request Nov 2, 2026
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]>
rng1995 added a commit that referenced this pull request Nov 6, 2026
* 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]>
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.

1 participant