Skip to content

perf(crafter): de-duplicate AccessChk security descriptors in the policy projection - #3364

Merged
javirln merged 2 commits into
chainloop-dev:mainfrom
javirln:javirln/accesschk-memory
Aug 25, 2026
Merged

perf(crafter): de-duplicate AccessChk security descriptors in the policy projection#3364
javirln merged 2 commits into
chainloop-dev:mainfrom
javirln:javirln/accesschk-memory

Conversation

@javirln

@javirlnjavirln commented Aug 24, 2026

Copy link
Copy Markdown
Member

The SYSINTERNALS_ACCESSCHK material is projected to JSON client-side for policy evaluation. AccessChk evidence for a registry hive or service database applies a small number of distinct security descriptors to hundreds of thousands of objects through inheritance, and the flat projection repeats each descriptor inline on every object. The policy engine materializes every copy in memory, so a large material drives the CLI to very high peak memory and can OOM-kill the CI runner during evaluation.

This projects the material to a de-duplicated shape: the distinct security descriptors are emitted once in a descriptors table, and each object references one by index (descriptor). For a large registry material this reduces the projection by roughly 20x (hundreds of thousands of objects collapse to a few hundred distinct descriptors) and brings evaluation peak memory down by an order of magnitude. No object, name, or ACE is dropped — descriptors are shared only when byte-for-byte identical — so recorded evidence and policy findings are unchanged.

Policies read a descriptor via input.descriptors[obj.descriptor].

Closes PFM-6922.

AI assistance

This change was produced with the assistance of Claude Code.

Review in cubic

…icy projection
The SYSINTERNALS_ACCESSCHK material is projected to JSON client-side for policy
evaluation. AccessChk evidence for a registry hive or service database applies a
small number of distinct security descriptors to hundreds of thousands of objects
through inheritance, and the flat projection repeats each descriptor inline on
every object. The policy engine materializes every copy in memory, so a large
material drives the CLI to very high peak memory and can OOM-kill the CI runner
during evaluation.
Project the material to a de-duplicated shape instead: the distinct security
descriptors are emitted once in a descriptors table, and each object references
one by index. Descriptors are shared only when byte-for-byte identical, so no
object, name, or ACE is dropped and policy findings are unchanged. For a large
registry material this collapses hundreds of thousands of inline descriptors to a
few hundred table entries and brings evaluation peak memory down by an order of
magnitude.
Policies read a descriptor via input.descriptors[obj.descriptor].
Closes PFM-6922.
Assisted-by: Claude Code
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Chainloop-Trace-Sessions: bcafbeb2-90ea-4ff6-89b5-b896e6c68b2f
@chainloop-platform

chainloop-platformBot commented Aug 24, 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

StatusPolicyMessages
✅ Passedpr-description-required-
✅ Passedpr-user-story-linked-

⏭️ 3 scans not applied

ScanReason
vulnerability-scanno manifest/lockfile changed
github-actions-scanno workflow files changed
iac-scanno IaC files changed

View attestation ↗


Powered by Chainloop and Chainloop Trace

@javirln
javirln requested a review from a teamAugust 24, 2026 15:08

@cubic-dev-aicubic-dev-aiBot 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

Add a test that marshals the projection and verifies the serialized contract the
policy engine consumes: the descriptors table, objects referencing a descriptor
index (with no inline DACL), the retained/omitted raw_lines fallback, and the
top-level raw field.
Assisted-by: Claude Code
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Chainloop-Trace-Sessions: bcafbeb2-90ea-4ff6-89b5-b896e6c68b2f
Comment threadpkg/attestation/crafter/api/attestation/v1/crafting_state.go
@javirln
javirln merged commit 7880f99 into chainloop-dev:mainAug 25, 2026
16 of 17 checks passed
Sign up for freeto 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

@javirln@jiparis