Skip to content
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

f[WIP] eat(sdf): Protect Admin Routes behind a new Administer role #5007

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Nov 20, 2024

We have an admin page controlled by a feature flag. We locked the API endpoints down to be those with systeminit.com emails, but we want to take advantage of spicedb to make this work correctly

Even if a user gets to the WorkspaceAdmin page, we have locked down all of the API endpoints for them based on a new role in spicedb

This role will be manually granted and can be done so using the following Zed cli command:

zed relationship create system:system admin administer:<user_pk>

This will be granted by TechOps on the SystemInitiative users that need access to it so that it can be tracked correctly

We have an admin page controlled by a feature flag. We locked the API endpoints down to be those with systeminit.com emails, but we want to take advantage of spicedb to make this work correctly

Even if a user gets to the WorkspaceAdmin page, we have locked down all of the API endpoints for them based on a new role in spicedb

This role will be manually granted and can be done so using the following Zed cli command:

```
zed relationship create system:system admin administer:<user_pk>
```

This will be granted by TechOps on the SystemInitiative users that need access to it so that it can be tracked correctly
@github-actions github-actions bot added the A-sdf Area: Primary backend API service [Rust] label Nov 20, 2024
@stack72 stack72 force-pushed the protect-system-admin-routes branch from 7d1e93a to e2746c8 Compare November 20, 2024 21:56
@stack72 stack72 requested review from sprutton1 and fnichol November 20, 2024 22:27
}

#[derive(Clone, Copy, strum::Display, Debug)]
#[strum(serialize_all = "snake_case")]
pub enum Relation {
Approver,
Owner,
Admin,
Copy link
Contributor

Choose a reason for hiding this comment

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

You know - I actually wonder if owner can also just work here. Only it'd be owner of the system vs the workspace

@@ -206,6 +209,10 @@ impl PermissionBuilder {
self.object(ObjectType::Workspace, id)
}

pub fn system_object(self) -> Self {
self.object(ObjectType::System, "system")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we ever want different permission sets for different systems? Maybe this should be "sdf"

@stack72
Copy link
Contributor Author

stack72 commented Dec 3, 2024

ok after talking this over with @sprutton1 and @britmyerss we are going to do the following:

  • For local installations of SI, we are going to use a wildcard that anyone on a local instance against a LOCAL spicedb will be an admin
  • For production system, we are going to add the work to the admin page to be able to make someone an admin
    • this is going to require us to manually seed a user in production and then that user (more than likely Scott / John) will then invite the SI team to be admins where appropriate
    • We will get an audit log event when a user is added / removed from the spicedb definition

@stack72 stack72 changed the title feat(sdf): Protect Admin Routes behind a new Administer role f[WIP] eat(sdf): Protect Admin Routes behind a new Administer role Dec 3, 2024
@stack72 stack72 marked this pull request as draft December 3, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdf Area: Primary backend API service [Rust]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants