Repository navigation
fix(auth): stop granting rules.read to project end users - #15013
Conversation
The users role is held by every project's end-user sessions, so rules.read on it let any signed-in user list and read the project's proxy rules, which are documented as admin/key only. The scope was only added so a console member could call GET /v1/console/resources, a console-only route; scope that route to projects.read, which the role already holds, and drop rules.read from the role.
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
The change tightens access to proxy rules: member roles lose
Reviewed commit: 644c309 |
🟢 Tier S · Ready to mergeThis change removes
📂 Walkthrough · 3
Reviewed |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What does this PR do?
The
usersrole (every project end-user session) carriedrules.read, so any signed-in user could list and read the project's proxy rules. Those routes are documented admin/key only.rules.readwas added to the role only so console users could callGET /v1/console/resources, which is already console-only (projectsgroup) and the role already holdsprojects.read.Changes
Console/Http/Resources/Get.php: scoperules.read→projects.readapp/config/roles.php: droprules.readfrom$memberAdmin roles (owner/developer/admin) and API keys keep
rules.read; the console reads rules through admin mode, so it is unaffected. No scope catalog change.Test Plan
SitesCustomServerTest::testProjectUserCannotReadRules: creates a rule with the server key, signs up an end user, assertsGET /v1/proxy/rulesandGET /v1/proxy/rules/{id}return 401 with that session and the key still reads the rule.testConsoleAvailabilityEndpointkeeps coveringGET /v1/console/resourceswith a console session (409/204).Related: appwrite-labs/cloud#6666