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

Feat: Add a public token type that has only READ access to calling deployments #647

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jsun-m
Copy link
Contributor

@jsun-m jsun-m commented Oct 23, 2024

Added a new token_type called public that gives READONLY for making HTTP requests to deployments, but prevents access to other resources.

This will allow our users to safely distribute Beta9 api tokens to their own users

@@ -28,6 +28,7 @@ const (
TokenTypeWorkspace string = "workspace"
TokenTypeWorker string = "worker"
TokenTypeMachine string = "machine"
TokenTypePublic string = "public" // TODO: naming could be improved
Copy link
Contributor

Choose a reason for hiding this comment

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

what should we name it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think TokenTypeReadOnly because its being used as just that. If we decide to have permissions on tokens, then having a "Public" token is redundant with a "Workspace" token. So this feels more like a temporary feature to me until we have something more elaborate.

If we want to get more specific, TokenTypeDeploymentReadOnly. This creates room for other resource types like tasks or volumes, but it could make the auth closure logic more complicated to follow, challenging to add more token types, and difficult to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what about TokenTypeRequestOnly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or TokenTypeCallAPIOnly

Copy link
Contributor

Choose a reason for hiding this comment

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

I think those are less clear. Neither "Request" nor "CallAPIOnly" indicate to me that this is a read-only token. In both names, one could still assume they have write permissions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TokenTypeDeploymentReadOnly sounds like they can list deployments as well. I can't think of the perfect name for this.

what about TokenTypeAPIRestricted

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.

3 participants