fix(rbac): spell the group user type db_env_user, as the server does - #624
Open
dudanogueira wants to merge 1 commit into
Open
fix(rbac): spell the group user type db_env_user, as the server does#624dudanogueira wants to merge 1 commit into
dudanogueira wants to merge 1 commit into
Conversation
groups/UserType declared its middle value as "db_end_user" -- end, not env. The server's enumeration is ["db_user","db_env_user"] (entities/models/d_b_user_info.go:142), so the constant could never be produced by a read and writing it would emit a value the server rejects. The constant is named DB_ENV_USER, so only the string was wrong. The typo survived because nothing uses this enum: grep across src/main, src/test and src/it finds every reference resolving to rbac/users/UserType, and none to this one. GroupType, in the same package, is used -- the package is not dead, this enum is. That raises whether the right change is deletion rather than correction, since this is an unreferenced duplicate of a type that already handles the value correctly. Left as a correction here because removing a public type is the more invasive call; see #623 for the argument either way. Closes #623 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HNeKV7TAYZGDyT9agqJwUf
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
Collaborator
|
Please remove all comments from this PR and trim the PR description to what is strictly relevant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
rbac/groups/UserTypespells its middle wire valuedb_end_user— end, not env. The server's enumeration is:So
DB_ENV_USERcould never be produced by a read, and writing it would emit a value the server rejects. The constant is namedDB_ENV_USER, so the intent is clear and only the string is wrong.The typo survived because nothing uses this enum.
grep -rn "UserType" src/resolves every reference torbac/users/UserTypeand none to this one. (GroupType, in the same package, is used — the package is not dead, this enum is.)Approach
Correct the string to
db_env_user.Rejected, but worth your call: deleting the enum. It is an unreferenced duplicate of
rbac/users/UserType, which already handles this value correctly via@SerializedName(value = "db", alternate = "db_env_user"). Deleting it would remove a trap — whoever wires up the groups client next would reach for the enum in their own package and get the broken one — and the typo is itself evidence that nothing has ever exercised it. I did not do that here because removing a public type is the more invasive call and it is yours to make.No
alternatespelling:db_end_userwas never a value the server sent, so there is nothing stored under it.Key areas for review
rbac/groups/UserTypeoutright? It is a one-line change either way and I am happy to switch. See v6: groups/UserType spells db_env_user as db_end_user, and is an unreferenced duplicate #623 for the argument on both sides.Testing
Unit — one round-trip row in
JSONTest.testCases(), driving bothtest_serializeandtest_deserialize.Verified the test fails without the fix, in both directions:
The read failure is the one that matters — an unknown enum string deserializes to
nullunder Gson's default adapter rather than throwing, which is how a value like this stays wrong quietly.No integration test: the enum is unreachable from any client call, so there is nothing to exercise end to end until it is wired up.
Locally green: 384 unit tests.
Breaking changes
None. The constant name and the enum's public shape are unchanged; only the wire string it maps to changes, and the old one matched nothing the server sends.
Conflict note
Adds a row at the end of
JSONTest.testCases(), as #620 and #622 also do. Whichever merges last wants a trivial rebase.Closes #623
🤖 Generated with Claude Code
https://claude.ai/code/session_01HNeKV7TAYZGDyT9agqJwUf