Skip to content

fix(crafter): bound AccessChk memory use during policy evaluation - #3341

Merged
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6922-sysinternals_accesschk-large-materials-can-oom-the-ci-runner
Aug 11, 2026
Merged

fix(crafter): bound AccessChk memory use during policy evaluation#3341
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6922-sysinternals_accesschk-large-materials-can-oom-the-ci-runner

Conversation

@javirln

@javirln javirln commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

The SYSINTERNALS_ACCESSCHK material type could drive the CLI to very high peak memory during client-side policy evaluation, risking an OOM kill of the CI runner for large materials. This bounds that memory use.

  • Stream the AccessChk parser line by line instead of building a normalized full-text copy and splitting all lines at once, and stop pinning the whole input in memory via stored substrings.
  • Size-gate the verbatim raw-text fallback fields (raw and per-object raw_lines): retain them for inputs below a threshold and omit them above it, keeping the JSON projection handed to the policy engine from ballooning to multiples of the original file size. These fields are not attested and are unused by current policies, so recorded evidence and evaluations are unchanged.
  • Make AccessChk output detection independent of the raw field so oversized descriptor-only materials are still recognized.
  • Warn at craft time when a material exceeds the retention threshold.

Closes PFM-6922.

AI assistance

This change was produced with the assistance of Claude Code.

Review in cubic

Stream the AccessChk parser and size-gate the verbatim raw-text fallback
fields so large materials no longer drive peak memory to many GB and
OOM-kill the CI runner during client-side policy evaluation.

The parser now reads the input line by line instead of building a
normalized full-text copy and splitting every line at once, and it stops
pinning the whole input via stored substrings. The Raw and per-object
RawLines fallback fields are retained only for inputs below a size limit
and omitted above it; they are not attested and unused by policies, so
the recorded evidence and current evaluations are unchanged. Object
detection no longer depends on the Raw field, and the crafter warns when
a material exceeds the retention limit.

Assisted-by: Claude Code
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>

Chainloop-Trace-Sessions: 3216ee57-5895-4c05-8891-8bd110d70aa2
@chainloop-platform

chainloop-platform Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

AI Session Checks — ⚠️ 1 session(s) missing

Missing AI Coding Sessions

We detected commits in this PR that were AI-assisted, but the matching Chainloop Trace session(s) could not be found in Chainloop.

Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the skip-ai-session label to this PR to bypass this check.

Learn more about Chainloop Trace.


Security Checks — ✅ 2 passing

PR info

Status Policy Messages
✅ Passed pr-description-required -
✅ Passed pr-user-story-linked -

⏭️ 3 scans not applied

Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed
iac-scan no IaC files changed

View attestation ↗


Powered by Chainloop and Chainloop Trace

@javirln javirln self-assigned this Aug 11, 2026
@javirln
javirln requested a review from a team August 11, 2026 15:48
@javirln
javirln marked this pull request as ready for review August 11, 2026 15:48

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread pkg/attestation/crafter/materials/accesschk/accesschk.go

@matiasinsaurralde matiasinsaurralde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@javirln
javirln merged commit 30c1063 into chainloop-dev:main Aug 11, 2026
16 of 17 checks passed
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.

3 participants