feat: add connection diagram action and permissions to Cedar authorization#1754
feat: add connection diagram action and permissions to Cedar authorization#1754
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Pull request overview
This PR introduces a dedicated Cedar authorization action for fetching a connection ER diagram, and wires the /connection/diagram/:connectionId endpoint to use that action instead of reusing connection:edit.
Changes:
- Added new Cedar action
connection:diagramto the Cedar action map and schema (TS + JSON). - Added
ConnectionDiagramGuardand updated the connection diagram endpoint to authorize viaconnection:diagram. - Updated Cedar policy generation and tests so
connection:editpolicies also includeconnection:diagram, and added SaaS E2E coverage for the new permission behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/test/ava-tests/saas-tests/saas-cedar-connection-diagram-permission-e2e.test.ts | New SaaS E2E tests validating allow/deny behavior for connection:diagram including raw Cedar policy scenarios. |
| backend/test/ava-tests/non-saas-tests/non-saas-cedar-policy-generator.test.ts | Updates generator expectations to include connection:diagram when connection access is edit. |
| backend/src/guards/connection-diagram.guard.ts | New NestJS guard that authorizes diagram access via CedarAction.ConnectionDiagram. |
| backend/src/entities/connection/connection.controller.ts | Switches the diagram endpoint guard from ConnectionEditGuard to ConnectionDiagramGuard. |
| backend/src/entities/cedar-authorization/cedar-schema.ts | Adds connection:diagram to the Cedar schema (TS). |
| backend/src/entities/cedar-authorization/cedar-schema.json | Adds connection:diagram to the Cedar schema (JSON). |
| backend/src/entities/cedar-authorization/cedar-policy-parser.ts | Updates classical-permission parsing to recognize connection:diagram. |
| backend/src/entities/cedar-authorization/cedar-policy-generator.ts | Ensures generated policies for connection:edit also permit connection:diagram. |
| backend/src/entities/cedar-authorization/cedar-action-map.ts | Adds ConnectionDiagram to the CedarAction enum. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| status: 200, | ||
| type: ConnectionDiagramResponseDTO, | ||
| }) | ||
| @UseGuards(ConnectionEditGuard) | ||
| @UseGuards(ConnectionDiagramGuard) | ||
| @Get('/connection/diagram/:connectionId') |
| if (result.connection.accessLevel === AccessLevelEnum.none) { | ||
| result.connection.accessLevel = AccessLevelEnum.readonly; | ||
| } |
No description provided.