fix(authz): skip env-scoped /evaluate-with-context when authz is disabled#554
Conversation
…bled
The frontend env-scoped permission hook fired POST /evaluate-with-context
on every render even when openchoreo.features.authz.enabled = false. The
policy backend skips mounting that route under AllowAllPolicy, so the
fetch 404'd and failed closed → every env tile body on the Deploy page
showed "You do not have permission to view the deployment in {env}".
Short-circuit useEnvScopedPermission to return baseCheck (which already
reports allowed: true under AllowAllPolicy) when useAuthzEnabled() is
false. One chokepoint covers all nine env-scoped consumer hooks.
Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR integrates authz enablement detection into ChangesAuthz-Enabled Environment Permission Evaluation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The frontend env-scoped permission hook fired POST /evaluate-with-context
on every render even when openchoreo.features.authz.enabled = false. The
policy backend skips mounting that route under AllowAllPolicy, so the
fetch 404'd and failed closed → every env tile body on the Deploy page
showed "You do not have permission to view the deployment in {env}".
Short-circuit useEnvScopedPermission to return baseCheck (which already
reports allowed: true under AllowAllPolicy) when useAuthzEnabled() is
false. One chokepoint covers all nine env-scoped consumer hooks.
Summary by CodeRabbit
Release Notes
Tests
Bug Fixes