File tree Expand file tree Collapse file tree
accounts/src/main/java/org/restheart/accounts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,9 +69,17 @@ public void init() {
6969 // edits — see PROFILE_ONLY_WHITELIST above for why this is safe to enforce
7070 // unconditionally.
7171 aclRegistry .registerVeto (r -> {
72- if (!r .getPath ().startsWith ("/users" )) return false ;
7372 if (!(r instanceof MongoRequest mr )) return false ;
7473
74+ // Match on the *resolved* db/collection (post mongo-mounts), not the request
75+ // path: the users collection can be reachable through more than one URL —
76+ // e.g. the conventional /users mount alias AND the raw /{db}/users path if a
77+ // wildcard mount also exposes it. A path-prefix check on "/users" would miss
78+ // the second one entirely, letting a client bypass this restriction just by
79+ // using a different (but equally valid) URL for the same collection.
80+ if (!"users" .equals (mr .getCollectionName ())) return false ;
81+ if (!RequestOverrides .db (mr , conf ).equals (mr .getDBName ())) return false ;
82+
7583 // Roles configured via `users-unrestricted-roles` (e.g. an admin console
7684 // role) bypass this restriction entirely — see AccountsConfigData. Reads
7785 // the per-team override first (set by e.g. TeamConfigInterceptor), falling
You can’t perform that action at this time.
0 commit comments