Skip to content

authz: protect VPC router endpoints#775

Merged
davepacheco merged 6 commits into
mainfrom
authz-vpc
Mar 16, 2022
Merged

authz: protect VPC router endpoints#775
davepacheco merged 6 commits into
mainfrom
authz-vpc

Conversation

@davepacheco

Copy link
Copy Markdown
Collaborator

This change protects the API endpoints for CRUD for VPC Routers.

Like the other VPC endpoints I've done so far (VPCs, VPC Subnets), I'm changing "PUT" to return 200 rather than 204 for consistency with the rest of the API.

oxapi_demo does not have any commands for working with routers so that's missing from this change.

Comment thread nexus/src/nexus.rs
let system_router_id = Uuid::new_v4();
let default_route_id = Uuid::new_v4();
let default_subnet_id = Uuid::new_v4();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: prior to this change, we actually created the system router for the VPC in the database before the VPC itself. This change creates the VPC first. Both seem invalid in that each creates a record in the database that refers to another record that doesn't exist (usually for a brief period). I didn't think this was any worse, and it made the authz implementation simpler (because we assume the VPC exists in order to do an authz check on creating a router inside it).

There are already multiple TODOs in this function to use sagas or a transaction instead.

@davepacheco davepacheco marked this pull request as ready for review March 16, 2022 02:59
@davepacheco davepacheco requested a review from bnaecker March 16, 2022 03:00
@davepacheco davepacheco mentioned this pull request Mar 16, 2022
71 tasks
@davepacheco davepacheco merged commit 383ca78 into main Mar 16, 2022
@davepacheco davepacheco deleted the authz-vpc branch March 16, 2022 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants