Skip to content

fix(controlplane): limit dependent attestations to the run's organization - #3873

Open
migmartri wants to merge 2 commits into
mainfrom
fix/dependent-attestation-org-scope
Open

migmartri wants to merge 2 commits into
mainfrom
fix/dependent-attestation-org-scope

Conversation

@migmartri

@migmartri migmartri commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

When an attestation is stored, every dependent material of type ATTESTATION must already exist in the control plane. That existence check looked up the digest across all organizations. As a result, an attestation in one organization could reference, and be linked in the referrer graph to, an attestation of another organization. The response also told the caller whether a digest existed in another organization.

The lookup is now scoped to the organization of the run that is being saved. A dependent attestation in another organization is rejected with the same "dependent attestation not found" validation error as a nonexistent one. GetByDigestInOrg uses the same scoped lookup instead of filtering after the query. The repository method also uses First() instead of Only(), because the attestation digest index is not unique.

Refs SEC-625.

AI disclosure: this change was made with the help of Claude Code.

🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri

View guided diff

…tion

SaveAttestation checked that a dependent ATTESTATION material exists with an
organization-blind lookup. An attestation in one organization could reference,
and be linked to, an attestation of another organization, and the response told
whether a digest existed in another organization.

The lookup is now scoped to the organization of the run. A digest in another
organization is rejected exactly like a nonexistent one. The repository method
also uses First() instead of Only(), since the digest index is not unique.

Refs SEC-625

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 9e0c17ce-ea72-4a65-bc94-5e7bab1bf288
@chainloop-platform

chainloop-platform Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ⚠️ 1 failing

Status Policy Material Messages
⚠️ Failed pr-min-approvals pr-info PR/MR #3873 has 0 approving reviews, 1 required.
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟢 89% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 89% 1 ✅ 0 94% AI / 6% Human 4 +115 / -35 25m42s

🟢 89% — 94% AI — ✅ All policies passing

Dec 2, 2026 19:12 UTC · 25m42s · $7.26 · 220 in / 71.0k out · claude-code 2.1.334 (claude-opus-5-5)

View session details ↗

Change Summary

Scopes dependent-attestation lookups to the run organization and returns the same error for foreign or nonexistent digests. Selects the most recent matching run without duplicate-result failures, updates callers and mocks, and adds three regression controls.

AI Session Overall Score

🟢 89% — Focused tenant isolation fix with passing regressions; complete signing and persistence checks remain unconfirmed.

AI Session Analysis Breakdown

🟢 97% · scope-discipline

No notes.

🟢 94% · alignment

🟢 The save path now scopes dependent lookups and uses identical errors for foreign and nonexistent digests. · High Impact

🟢 93% · context-and-planning

No notes.

🟢 92% · solution-quality

🟢 Organization filtering happens in the repository query; real query errors still propagate. · High Impact

🟢 90% · user-trust-signal

No notes.

🟡 76% · verification

🟢 The new regression failed before the fix; scoped suites passed again after the final query changes. · High Impact

🟠 The test checks digest non-persistence; keyless signing provenance and absence of bundle persistence are not established. · Medium Severity

💡 Check bundle storage as well as the digest, and expose the signing fixture provenance.


File Attribution

██████████████████░░ 94% AI / 6% Human

Status Attribution File Lines
modified ai app/controlplane/pkg/biz/workflowrun_integration_test.go +56 / -0
modified ai app/controlplane/pkg/biz/mocks/WorkflowRunRepo.go +26 / -20
modified ai app/controlplane/pkg/biz/workflowrun.go +20 / -12
modified ai app/controlplane/pkg/data/workflowrun.go +13 / -3

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-9e0c17 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-9e0c17 -
✅ Passed ai-config-no-secrets ai-coding-session-9e0c17 -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-9e0c17 -

Security Checks — ✅ 6 passing

✅ AI Security Analysis

Reviewed this change against the project's security context (4 concerns hunted) — no introduced risk found.

View in Chainloop ↗ · How this works ↗

✅ Secret Scan

Status Policy Messages
✅ Passed secrets-detection -

✅ SAST Scan

Status Policy Messages
✅ Passed owasp-top10-2025 -
✅ Passed sast -
✅ Passed cwe-top25 -
✅ Passed cwe-top26-40-cusp -
Scans not applied (3)
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

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 4 files

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

View guided diff | Re-trigger cubic

…on column

Use the denormalized workflow_runs.organization_id column, as List does, and
return the most recent run when a digest matches more than one run.

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 9e0c17ce-ea72-4a65-bc94-5e7bab1bf288
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