Repository navigation
fix(attestation): check contract access before rewriting it on workflow lookup - #3870
Conversation
…ow lookup FindOrCreateWorkflow updated the contract of an existing workflow when the request carried contract bytes, checking only that the caller could create workflows in the project. A caller confined to projects could therefore rewrite an organization-level contract shared by other projects. Run the same contract access check as WorkflowContractService/Update before the update, and validate the contract policies after it. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: c399f0fc-26df-4962-a05e-fbc324f9ddef
PR validation — ✅ 3 passing
AI Session Checks — 🟢 94% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| created | ai | app/controlplane/internal/service/findorcreateworkflow_integration_test.go |
+225 / -0 |
| modified | ai | app/controlplane/internal/service/attestation.go |
+28 / -12 |
| modified | ai | app/controlplane/internal/service/service.go |
+19 / -0 |
| modified | ai | app/controlplane/internal/service/workflowcontract.go |
+0 / -19 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-c399f0 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-c399f0 |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-c399f0 |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-c399f0 |
- |
Security Checks — ✅ 6 passing
✅ AI Security Analysis
Reviewed this change against the project's security context (13 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 |
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
Merged by eng-autopilot: approved by jiparis; no change request; CI passed (16 check runs, 3 workflow runs); GitHub merge state clean; no Greptile review. 🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri, using the eng-autopilot skill |
Attestation init (
AttestationService/FindOrCreateWorkflow) can update the contract of an existing workflow when it receives contract bytes. Until now it only checked that the caller could create workflows in the project, so a caller confined to projects (a project-, workflow- or product-scoped API token, or an org member with a project role) could rewrite an organization-level contract shared by other projects.The endpoint now applies the same contract access check as
WorkflowContractService/Updatebefore the update: callers confined to projects can no longer modify organization-level contracts through attestation init, and project-level contracts require update access in their project. Organization-wide tokens and organization administrators are unaffected. The check is shared between both services, and contract policies are validated only after access is granted.This PR was written with the assistance of Claude Code.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri