-
Notifications
You must be signed in to change notification settings - Fork 24
Revert "Handle control plane check for federated apis" #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe PR removes federation-based exemptions from control plane authorization checks in the API content controller. Access control enforcement now consistently applies when the control plane is enabled, eliminating special bypass logic previously granted to federated APIs. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/controllers/apiContentController.js (1)
572-576: Use strict equality for consistency.Line 572 uses loose equality (
==) while line 576 uses strict equality (===) for the same type of check onallowedAPIList.count. This inconsistency could lead to unexpected type coercion behavior.🔎 Proposed fix for consistency
- if (allowedAPIList.count == 0) { + if (allowedAPIList.count === 0) { apiName = apiMetadata.apiInfo.apiName; allowedAPIList = await util.invokeApiRequest(req, 'GET', `${controlPlaneUrl}/apis?query=name:"${apiName}"+version:${version}`, {}, {}); } if (allowedAPIList.count === 0) {
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/controllers/apiContentController.js
🧰 Additional context used
🧬 Code graph analysis (1)
src/controllers/apiContentController.js (15)
src/app.js (1)
config(38-38)src/utils/util.js (1)
config(31-31)src/services/apiMetadataService.js (1)
config(25-25)src/services/adminService.js (1)
config(32-32)src/controllers/authController.js (1)
config(23-23)src/controllers/applicationsContentController.js (1)
config(20-20)src/controllers/orgContentController.js (1)
config(26-26)src/controllers/devportalController.js (1)
config(20-20)src/controllers/customContentController.js (1)
config(20-20)src/controllers/settingsController.js (1)
config(26-26)src/middlewares/ensureAuthenticated.js (1)
config(21-21)src/middlewares/registerPartials.js (1)
config(22-22)src/services/redisConnectionHelper.js (1)
config(23-23)src/db/sequelize.js (1)
config(23-23)src/middlewares/passport.js (1)
config(25-25)
🔇 Additional comments (2)
src/controllers/apiContentController.js (2)
567-567: Verify authorization changes for document access.Similar to the change in
loadAPIContent, the control plane authorization check now runs unconditionally for document access. Ensure this doesn't inadvertently block legitimate access to federated API documentation.
232-237: Remove federation exemption from control plane authorization; verify federated API access workflows still function.The revert removes the federation-based exemption from the control plane authorization check. Line 237 now unconditionally enforces authorization when the control plane is enabled, regardless of whether the API is federated. While this improves security consistency, verify that:
- Federated APIs can still be properly authorized through the control plane
- This change aligns with the intended access control model
Minor issues:
- Operator inconsistency: Line 572 uses loose equality (
==) while line 576 uses strict equality (===) for the samecountcomparison. Standardize to===.- Dead code:
gatewayVendor(line 232) is computed but only serves to deriveisFederatedAPIfor template rendering. The variable itself is not used directly; consider simplifying if template needs only the boolean result.
Reverts #598
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.