Skip to content

fix(controlplane): apply workflow-scoped credentials to attestation state RPCs - #3872

Merged
migmartri merged 1 commit into
mainfrom
miguel/sec-3114-attestation-state-workflow-scope
Dec 3, 2026
Merged

migmartri merged 1 commit into
mainfrom
miguel/sec-3114-attestation-state-workflow-scope

Conversation

@migmartri

@migmartri migmartri commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

A workflow-scoped API token could act on the remote attestation state of a run that belongs to another workflow in the same project. Through AttestationStateService Initialized, Save, Read and Reset, the caller could check whether another workflow's run has remote state, overwrite it (which breaks the owner's attestation, because the owner can no longer decrypt it) or delete it.

These handlers got the workflow from the run ID and checked only project RBAC. Both workflows are in the same project, so that check passed, and the token's workflow scope was never applied.

This change calls the shared caller workflow scope check (from #3871) from these handlers. The check covers workflow-scoped API tokens and legacy robot accounts. The attestation state service now always gets the workflow from the run, so it no longer needs the workflow use case.

Fixes SEC-3114.

This PR was written with AI assistance (Claude Code).

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

@chainloop-platform

chainloop-platform Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ✅ 3 passing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟢 90% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 90% 1 ✅ 0 95% AI / 5% Human 2 +275 / -20 2h38m59s

🟢 90% — 95% AI — ✅ All policies passing

Dec 2, 2026 19:07 UTC · 2h38m59s · $14.18 · 410 in / 133.7k out · claude-code 2.1.334 (claude-opus-5-5)

View session details ↗

Change Summary

Routes all four state operations through run resolution and the shared workflow authorization guard. Removes the obsolete workflow lookup dependency and adds cross-workflow denial and permitted-access regressions.

AI Session Overall Score

🟢 90% — Focused confinement repair with passing regressions; explicit user behavior confirmation remains absent.

AI Session Analysis Breakdown

🟢 96% · scope-discipline

No notes.

🟢 94% · solution-quality

🟢 Run resolution reuses the shared workflow guard and returns its error before proceeding. · High Impact

🟢 94% · user-trust-signal

No notes.

🟢 93% · context-and-planning

🟡 Structured cleanup guidance arrived after the initial fix, before the cleanup phase. · Low Severity

🟢 90% · alignment

🟢 After upstream fixed upload credentials, the agent revised the commit message and reused upstream authorization. · High Impact

🟡 79% · verification

🟢 Named cross-workflow regressions passed for all four state operations after rebase. · High Impact

🟠 User remained engaged but never explicitly confirmed the repaired behavior works. · Medium Severity

💡 Confirm the repaired behavior explicitly when reviewing the completed fix.


File Attribution

███████████████████░ 95% AI / 5% Human

Status Attribution File Lines
created ai app/controlplane/internal/service/attestationstate_integration_test.go +259 / -0
modified ai app/controlplane/internal/service/attestationstate.go +16 / -20

Policies (4)

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

Security Checks — ✅ 6 passing

✅ AI Security Analysis

Reviewed this change against the project's security context (2 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.

No issues found across 4 files

View guided diff | Re-trigger cubic

@migmartri
migmartri requested a review from a team December 2, 2026 19:29
…tate RPCs

A workflow-scoped API token could read, overwrite or reset the remote
attestation state of a run that belongs to another workflow in the same
project.

AttestationStateService (Initialized, Save, Read, Reset) resolved the
workflow from the run ID and checked only project RBAC, so the token's
workflow scope was never applied. Call the shared caller workflow scope
check from these handlers. The attestation state service now always
resolves the workflow from the run, so it no longer needs the workflow use
case.

Fixes SEC-3114

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

Chainloop-Trace-Sessions: 0a5f115f-a0cb-4013-b6a2-1635aaeb3aa4
@migmartri
migmartri force-pushed the miguel/sec-3114-attestation-state-workflow-scope branch from 2756a04 to 0088063 Compare December 2, 2026 21:46
@migmartri migmartri changed the title fix(controlplane): apply workflow-scoped credentials to run-ID attestation RPCs fix(controlplane): apply workflow-scoped credentials to attestation state RPCs Dec 2, 2026
@migmartri
migmartri merged commit c5968f1 into main Dec 3, 2026
16 checks passed
@migmartri
migmartri deleted the miguel/sec-3114-attestation-state-workflow-scope branch December 3, 2026 23:15
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.

2 participants