Repository navigation
Return 403 for unauthorized CLA manager removal (main) - #5245
Conversation
DELETE /v4/company/{companyID}/project/{projectSFID}/cla-manager/{userLFID}
answered an authorization denial with HTTP 400. Return the 403 the spec
already documents. The create handler's denial message named
DeleteCLAManager; name the right operation, and in both messages print
the company SFID the scope check used instead of the internal company ID.
Found by the M3 role-matrix run against dev
(linuxfoundation/lfx-self-serve#1968).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Michal Lehotsky <mlehotsky@linuxfoundation.org>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The minimal implementation matches the API specification and includes focused regression coverage.
0 open findings
What changed in this PR
Corrects unauthorized CLA-manager responses to match the documented v4 API contract.
Changes:
- Returns HTTP 403 for unauthorized manager deletion.
- Corrects operation names and company SFIDs in denial messages.
- Adds focused authorization regression tests.
| File | Description |
|---|---|
cla-backend-go/v2/cla_manager/handlers.go |
Corrects authorization responses and messages. |
cla-backend-go/v2/cla_manager/handlers_test.go |
Covers unauthorized create/delete requests. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Same change as #5243, against
main, because the M3 features are already in prod. The commit is cherry-picked unchanged; thev2/cla_managercode is identical onmainanddev.Summary
DELETE /v4/company/{companyID}/project/{projectSFID}/cla-manager/{userLFID}answered an authorization denial with 400. It now returns the 403 the spec already documents (forbidden-or-company-sanctioned).POST .../cla-managerdenial message saidDeleteCLAManager. It now saysCreateCLAManager.Who is allowed does not change. Found by the M3 API role-matrix run against dev (linuxfoundation/lfx-self-serve#1968).
Clients
classifyOrgClaManagerRefusal(packages/shared/src/utils/org-cla-manager.utils.tsin linuxfoundation/lfx-self-serve) checks the body text before the status, so it classifies the refusal the same way.remove-cla-manager.tspasses the status through as the result code and does not branch on it.Test plan
go test ./v2/cla_manager/on this branch:TestClaManagerCreateDeleteHandlersRejectUnauthorizedUserscovers an LF admin and an unrelated-company scope on create and delete. It expects 403, no service call, and a message that names the operation and the SFID.go build ./...🤖 Generated with Claude Code