Skip to content

fix(rbac): spell the group user type db_env_user, as the server does - #624

Open
dudanogueira wants to merge 1 commit into
mainfrom
fix/groups-usertype-typo
Open

fix(rbac): spell the group user type db_env_user, as the server does#624
dudanogueira wants to merge 1 commit into
mainfrom
fix/groups-usertype-typo

Conversation

@dudanogueira

Copy link
Copy Markdown

Motivation

rbac/groups/UserType spells its middle wire value db_end_userend, not env. The server's enumeration is:

// entities/models/d_b_user_info.go:142
if err := json.Unmarshal([]byte(`["db_user","db_env_user"]`), &res); err != nil {

So DB_ENV_USER 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 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 to rbac/users/UserType and 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 alternate spelling: db_end_user was never a value the server sent, so there is nothing stored under it.

Key areas for review

Testing

Unit — one round-trip row in JSONTest.testCases(), driving both test_serialize and test_deserialize.

Verified the test fails without the fix, in both directions:

expected:<DB_ENV_USER> but was:<null>
expected:<"db_en[v]_user"> but was:<"db_en[d]_user">

The read failure is the one that matters — an unknown enum string deserializes to null under 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

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

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@bevzzz

bevzzz commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Please remove all comments from this PR and trim the PR description to what is strictly relevant.

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.

v6: groups/UserType spells db_env_user as db_end_user, and is an unreferenced duplicate

2 participants