Repository navigation
fix(#10073): creating a user under a taken name answers 409, not 403 'Security error' - #10076
Conversation
…'Security error' A duplicate user name was raised as a ServerSecurityException, which the HTTP boundary maps to 403 like an authorization refusal. It is now a dedicated UserAlreadyExistsException (not a security failure): HTTP 409 on both the REST route and the 'create user' server command, gRPC ALREADY_EXISTS, and the createUser contract documents the 409. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 8
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
ReviewClean, focused change. A dedicated `UserAlreadyExistsException` that extends `ServerException` (not `ServerSecurityException`) is the right way to separate "conflict" from "not authorized". Both throw sites, the HTTP classifier, the gRPC mapping and the OpenAPI spec are covered. Checked
Minor suggestions
No blocking issues. LGTM. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ReviewOverall this is a clean, well-scoped fix. A dedicated Strengths
Suggestions (non-blocking)
Nice work. |
Upstream fixed #10073 the same day: creating a user under a taken name now answers 409 instead of 403 "Security error". The e2e tests pin 409, and the docstrings, README and CLAUDE.md say a 409 from create_user means "already there", noting that older servers answered 403. Also from review: document that a database name is sent as given beyond the trim check (one command per request, so no second command, but validate untrusted names), and cover update_user/save_group with no optional arguments and an embedded-space database name in unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…P client (#130) Completes #122 after Go (#126) and Python (#128). ArcadeDBServer gains, each throwing ArcadeDBError on failure: - createUser, updateUser, dropUser, listUsers, saveGroup, deleteGroup and listGroups on /api/v1/server/users and /groups - createDatabase and dropDatabase through POST /api/v1/server, rejecting a name the server would silently trim with RangeError - serverCommand, returning the parsed body as Record<string, unknown> because the contract types it QueryResponse while admin commands answer {"result":"ok"} - "sqlscript" in QueryLanguage, which previously did not compile A duplicate user is 409 (403 before ArcadeData/arcadedb#10076) and a duplicate database 400; both pinned in e2e. Closes #122
…o) (#129) Upstream fixed #10073 the day #126 merged: creating a user under a taken name now answers 409 instead of 403 "Security error", so the e2e pin in go/e2e/admin_test.go fails against the current SNAPSHOT. Pin 409 and update CreateUser's doc comment, the README and go/CLAUDE.md, noting that older servers answered 403. Also documents, as the Python review of #128 asked, that CreateDatabase sends a name as given beyond the trim check.
…'Security error' (#10076) * fix(#10073): creating a user under a taken name answers 409, not 403 'Security error' A duplicate user name was raised as a ServerSecurityException, which the HTTP boundary maps to 403 like an authorization refusal. It is now a dedicated UserAlreadyExistsException (not a security failure): HTTP 409 on both the REST route and the 'create user' server command, gRPC ALREADY_EXISTS, and the createUser contract documents the 409. (cherry picked from commit 0f5e45e)
Closes #10073
Creating a user under a name that is already taken now answers 409, not 403
Security error. Previously the duplicate was raised as aServerSecurityException, whichAbstractServerHttpHandler.isSecurityFailuremaps to 403. That is the same status a non-root caller gets, so a client could not tell "this user already exists" apart from "you may not do this". The duplicate is now a dedicatedUserAlreadyExistsException. It extendsServerException, notServerSecurityException. Both throw sites raise it:ServerSecurity.createUser(local) and the HA branch ofcreateUserClusterWide. The HTTP error mapper answers it 409User already exists, and the gRPC admin service answersALREADY_EXISTS, as it already did for a taken API-token name. ThecreateUseroperation in the OpenAPI document now declares a 409 for the conflict. A 403 still means the caller is not root.Coverage
Invariant: creating a user whose name is taken is reported as a conflict (HTTP 409 / gRPC
ALREADY_EXISTS) on every entry point, never as a security refusal.Enumeration:
POST /api/v1/server/users->createUserClusterWideIssue10073DuplicateUserAnswers409IT.aTakenNameOnTheRestRouteAnswers409AndLeavesTheFirstUserAlonePOST /api/v1/servercreate user->ServerControlPlane.createUser...aTakenNameOnTheServerCommandAnswers409CreateUser->ServerControlPlane.createUserIssue7309GrpcSecurityControlPlaneIT.createUserRefusesATakenNameWithAlreadyExistsServerSecurity.createUser/createUserClusterWide(the two throw sites)Issue10073UserAlreadyExistsTest(both)RemoteServer.createUserSecurityException...theRemoteClientNoLongerReportsATakenNameAsASecurityFailure...aNonRootCallerStillGets403EvenForATakenNameArcadeDBServerdatabase auto-create userexistsUserfirst, so it never reaches the duplicate (L2570)createOrUpdateGroup(issue's suggestion)createApiToken(issue's suggestion)PostApiTokenHandlermapsServerControlPlane.AlreadyExistsExceptionto 409LeaderCommandForwarderrelays the leader's status unchangedKnown gaps:
create databaseon an existing name still answers 400 over HTTP; gRPC already answersALREADY_EXISTS. The issue called this "not necessarily a bug".RemoteException(it used to beSecurityException), so callers recognise it by message text.Behaviour changes
RemoteServer.createUseron a taken name throwsRemoteExceptioninstead ofSecurityException. That is the point of the fix, but code catchingSecurityExceptionfor the duplicate will see the change.Test plan
Issue10073UserAlreadyExistsTest(2) - newIssue10073DuplicateUserAnswers409IT(4) - new. Before the fix, the REST and command cases failed with 403Issue7309GrpcSecurityControlPlaneIT(19, incl. the new case). The new case failed withINTERNALwhen the mapping was removedUserManagementIT(7),PostServerCommandHandlerIT(25),Issue7578SecurityAdminContractMatchesBehaviourIT(3),ServerSecurityIT(6),ServerSecurity*Test(19),OpenApiSpecGeneratorTest(3),GrpcErrorMapperTest(24),GrpcAdminServiceIT(14): all greenAdversarial pass
A separate reviewer read the issue and the diff with no other context. It found no in-scope gap.
create database400: filed as POST /api/v1/server 'create database' on an existing name answers 400; gRPC answers ALREADY_EXISTS #10074.Review cycles
6fffc68f0f79f9e078a9: the IT closes the request body stream (point 4)79f9e078a9Final state: clean-approval.
Skipped review items (with rationale)
LeaderCommandForwarder.relayedResponsepasses the leader's status and body through unchanged (L481, L613, L664), and the existing forwarding ITs pin that relay. An HA IT for one more status was not worth a Raft cluster fixture.SecurityException->RemoteExceptionin the Java client: agreed; it goes into the 26.11.1 release notes at merge, outside this PR. A typed client exception is Java remote clients have no typed exception for an 'already exists' conflict (409 / ALREADY_EXISTS) #10075.UserAlreadyExistsException(ServerSecurity L594-608), so it also gets 409, not 403.classifyErrorordering: the new arm sits with the other 409 arms, and there is no genericServerExceptionarm before it.studio-security.jsrenders every status other than the ones it handles specially throughglobalNotifyError(), and none of them depends on 403 for a duplicate (L177, L767).🤖 Generated with Claude Code
Summary by CodeRabbit
409 Conflict, and gRPC clients receiveALREADY_EXISTS.403 Forbiddenwhen attempting user creation.