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

Allow tokens to be used to create other tokens #26

Closed
simonw opened this issue Jan 12, 2024 · 1 comment
Closed

Allow tokens to be used to create other tokens #26

simonw opened this issue Jan 12, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Jan 12, 2024

I'm going to drop the thing about tokens not being able to create other tokens too - I'm not actually convinced that's a good requirement, so I'm going to leave that up to users of this plugin to decide on or not.

Originally posted by @simonw in #24 (comment)

@simonw simonw added the enhancement New feature or request label Jan 12, 2024
@simonw
Copy link
Owner Author

simonw commented Jan 12, 2024

Annoyingly I can't find my notes on exactly why I decided this rule in the first place:

if actor.get("token"):
raise Forbidden(
"Token authentication cannot be used to create additional tokens"
)

I think it was out of fear that someone could steal a token and then use that token to create more tokens, making it harder to lock the attacker out of the system.

But... those extra tokens created by the attacker would still be visible in the admin UI, so the admin can still revoke those as well.

There's also a strong argument for allowing tokens to create other tokens - the pattern where you create a single root token, but then have that token create restricted-access tokens on demand for other purposes.

I'm going to remove this rule from the core datasette-auth-tokens code, but since the auth-tokens-create permission is managed by Datasette permissions end users still have the option to re-introduce that rule if they want to via another plugin.

@simonw simonw closed this as completed in 6dfc185 Jan 12, 2024
@simonw simonw added this to the 0.4 milestone Jan 12, 2024
simonw added a commit that referenced this issue Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant