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

Add Customisable Maximum Token Lifetime #80

Conversation

artskidesign
Copy link
Contributor

@artskidesign artskidesign commented Jan 29, 2024

This PR updates the token.php file to allow external plugins to set a custom maximum token lifetime.

Changes include:

  • New Filter Added: Introduced the vip_decoupled_max_token_lifetime filter.
  • Updated Function: Modified get_token_lifetime_in_seconds to use this filter, allowing the maximum token lifetime ($max_lifetime) to be adjusted externally.

Impact:
Allows more flexibility in setting token lifetimes through external plugins.
Maintains default maximum lifetime unless specifically overridden.

@smithjw1
Copy link
Contributor

@chriszarate I'm interested in your take on this from a security standpoint. Longer-lived tokens are riskier. Should we set a "supermax" lifetime or leave this completely configurable by bundle users?

@pwestern
Copy link

pwestern commented Feb 2, 2024

@smithjw1 just to quickly weigh in here - we have a business case to extend preview token lifetimes. In our case, we don't have any security concerns, but appreciate this won't apply to everyone. Having a way to extend the lifetime beyond 3hrs would be super helpful, so any hooks to configure would be really appreciated

@chriszarate
Copy link
Member

Longer-lived tokens are riskier. Should we set a "supermax" lifetime or leave this completely configurable by bundle users?

I'm open to increasing the default max. Three hours was a somewhat arbitrary decision. The risk of a long-lived token is scoped to "viewing the latest revision of a specific post." I think different organizations will have different ideas about how to interpret that risk.

@pwestern @artskidesign What would a more reasonable max token lifetime look like for your use case?

@pwestern
Copy link

pwestern commented Feb 2, 2024

@chriszarate the request we've had from the business is to extend the lifetime indefinitely - which we appreciate is far longer than many other users are likely to need. Our hope was that there would be a way to override the default max token lifetime so we could set it to 1 year.

Copy link
Contributor

@smithjw1 smithjw1 left a comment

Choose a reason for hiding this comment

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

Thanks for making this suggestion, happy to approve these changes.

@alecgeatches
Copy link
Contributor

Merging these changes in. Thank you @artskidesign!

@alecgeatches alecgeatches merged commit aae9ea6 into Automattic:trunk Feb 7, 2024
2 checks passed
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.

5 participants