Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
[Medium impact] Safe to merge based on the verified scope; no blocking or non-blocking findings remain.
|
Closes #99
What
DeclaredRolesreturns the account commands' roles hook from a role registry: it loads the call's plugins, refuses a failed load, then answers the registry's roles with the holders of one capability privileged. It takes any registry answeringRoles,CapabilitiesOfandHoldersOf, so gonsole/auth imports no registry module.DeclaredRolesfails when no role carries the capability, so a misspelled capability can never switch the last privileged account guard off.SetUserRoleFromandSetUserDisabledFrom, so a role that moved between the check and the write is refused with a clear message.Why
Applications built the roles hook by hand with the same lines, and the commands answered a lost role and a moved role differently from the HTTP admin.
Testing Instructions
GOWORK=off go test -race ./...ingonsole/auth: every package passes.declaredroles_test.go: the hook after the plugins, a failed plugin load, a capability no role carries refused and the last privileged account kept.lostrole_test.goandcheckedwrite_test.go: the lost role rule and the moved role refusal through the commands.Summary by CodeRabbit
New Features
Bug Fixes