fix(controlplane): restrict organization updates to admins of the target org (CP-N1) - #3321
Conversation
AI Session Checks — 🟡 60% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | app/controlplane/pkg/biz/organization_integration_test.go |
+89 / -1 |
| created | ai | app/controlplane/internal/service/organization_test.go |
+72 / -0 |
| modified | ai | app/controlplane/internal/service/organization.go |
+14 / -1 |
| modified | ai | app/controlplane/pkg/biz/organization.go |
+8 / -0 |
| modified | ai | app/controlplane/pkg/biz/apitoken_stale_revoker_integration_test.go |
+3 / -2 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-61088e |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-61088e |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-61088e |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-61088e |
- |
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…get org (CP-N1) OrganizationService.Update took the organization to modify from the request body while the authorization middleware evaluated the caller's role against the organization selected in the request headers. A user who was an admin of one organization could therefore change the security settings of any other organization they held a membership in, including disabling policy violation blocking, pointing the policy engine at arbitrary hostnames and re-enabling runner environment variable capture. The update is now pinned to the currently selected organization at the service layer, and the biz layer authorizes against the membership held in the organization being updated, requiring an admin or owner role. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 61088ea5-dc57-47f9-9284-1a7c3527eb94 Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
2cf30a7 to
c2b71b8
Compare
OrganizationService.Updatetook the organization to modify from the request body, while the authorization middleware evaluated the caller's role against the organization selected in the request headers. Because the two were never compared, a user who was an admin or owner of one organization could change the security settings of any other organization they held a membership in — even as a plain viewer.The settings reachable this way are organization-wide security controls: policy violation blocking, the allowed hostnames the policy engine fetches Rego from, blocking attestations on released versions, runner environment variable capture, and the stale API token threshold.
Two changes close it:
AI assistance: this change was produced with Claude Code.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri