Skip to content

Return 403 for unauthorized CLA manager removal (main) - #5245

Merged
lukaszgryglicki merged 1 commit into
mainfrom
fix/cla-manager-forbidden-response-main
Oct 8, 2026
Merged

lukaszgryglicki merged 1 commit into
mainfrom
fix/cla-manager-forbidden-response-main

Conversation

@mlehotskylf

Copy link
Copy Markdown
Collaborator

Same change as #5243, against main, because the M3 features are already in prod. The commit is cherry-picked unchanged; the v2/cla_manager code is identical on main and dev.

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).
  • The POST .../cla-manager denial message said DeleteCLAManager. It now says CreateCLAManager.
  • Both messages now print the company SFID that the scope check uses, instead of the internal company ID.

Who is allowed does not change. Found by the M3 API role-matrix run against dev (linuxfoundation/lfx-self-serve#1968).

Clients

  • Org Lens: classifyOrgClaManagerRefusal (packages/shared/src/utils/org-cla-manager.utils.ts in linuxfoundation/lfx-self-serve) checks the body text before the status, so it classifies the refusal the same way.
  • Corporate Console: remove-cla-manager.ts passes the status through as the result code and does not branch on it.
  • Cypress v4 suite: no test expects 400 for a denied delete. The positive delete is still 204.

Test plan

  • go test ./v2/cla_manager/ on this branch: TestClaManagerCreateDeleteHandlersRejectUnauthorizedUsers covers 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 ./...
  • After the prod deploy, a denied cla-manager delete returns 403.

🤖 Generated with Claude Code

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>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 04:50
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 24ffdc56-fe59-4a7c-8538-41f42f47b081

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

🟢 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.

@lukaszgryglicki lukaszgryglicki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@lukaszgryglicki
lukaszgryglicki merged commit 772f596 into main Oct 8, 2026
8 checks passed
@lukaszgryglicki
lukaszgryglicki deleted the fix/cla-manager-forbidden-response-main branch October 8, 2026 05:23

This branch was successfully deployed

1 active deployment
dev — 25c4b3d9 Deployed Oct 8, 2026 by mlehotskylf via License Header Check #1419
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.

3 participants