fix: abstain when OAuth whitelist is empty - #1010
Conversation
Empty app OAuth whitelist previously denied all OAuth users with "filter is empty", breaking OAuth groups-only access control in v5.1.0. Treat empty whitelist as unconfigured (EffectAbstain) so OAuth group rules can still allow access. Closes tinyauthapp#1009
📝 WalkthroughWalkthroughOAuth whitelist evaluation now treats an empty whitelist as unconfigured, logs the condition, and returns ChangesOAuth access control
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/service/access_controls_rules.go (1)
46-50: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd an OAuth empty-whitelist regression test.
The branch matches the intended
EffectAbstainsemantics, but add coverage with an OAuth user and a blank whitelist assertingEffectAbstain; ideally include the policy/group composition that confirms an allowed OAuth group can still grant access.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/service/access_controls_rules.go` around lines 46 - 50, Add a regression test for the OAuth access-control evaluation covering a user with OAuth authentication and a blank whitelist, asserting that the result is EffectAbstain. Include policy/group composition where an allowed OAuth group can still grant access, and target the test around the rule evaluation symbol that handles utils.ErrFilterEmpty.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/service/access_controls_rules.go`:
- Around line 46-50: Add a regression test for the OAuth access-control
evaluation covering a user with OAuth authentication and a blank whitelist,
asserting that the result is EffectAbstain. Include policy/group composition
where an allowed OAuth group can still grant access, and target the test around
the rule evaluation symbol that handles utils.ErrFilterEmpty.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 68b679ba-c7d9-4388-a326-0974e58ce8eb
📒 Files selected for processing (1)
internal/service/access_controls_rules.go
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
What
Treat an empty OAuth whitelist as unconfigured (abstain) instead of denying access.
Why
In v5.1.0, apps configured with only
OAUTH_GROUPS(noOAUTH_WHITELIST) fail withfilter is emptyand deny all OAuth users. Groups-based access control never gets a chance to allow them.Closes #1009
Changes
UserAllowedRule: onutils.ErrFilterEmptyfor OAuth whitelist, returnEffectAbstain(same pattern as empty users allow list)Verification
Summary by CodeRabbit