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 regex as an optional value for the bound_claims_type #262

Open
refucktor opened this issue Nov 17, 2023 · 0 comments
Open

Add regex as an optional value for the bound_claims_type #262

refucktor opened this issue Nov 17, 2023 · 0 comments

Comments

@refucktor
Copy link

refucktor commented Nov 17, 2023

I already spent some time reading through the issues history to make sure I understand the different points of view on this topic, I found this comment

Hi. Thanks for the contribution. We have generally avoided regexes in Vault, especially in the areas dealing with authentication or authorization. The main reason is that regexes are notoriously easy to get wrong, which is this case could result in unauthorized access.

While I am 100% on this assessment, I also think that people using this plugin must assume responsibility for configuring it.
It's a personal opinion but on my experience, regex are easy to get wrong but they are also less likely to match and give unauthorized access than the globs, here is a very common use case,

  • imagine we are trying to create a role that should be only authorized if it comes from a protected tag (a mechanism very often used to create software releases)
  • we will have 2 types of releases, a release candidate and a stable release, following the semantic release approach we will end up with v1.2.0-rc.2 and later v1.2.0
  • using globs there is no chance to differentiate the roles, cause if we use something like v* then we are allowing both releases

Solution:

  • add the option to use regex in the bound_claims_type
  • then use a regex to have better control over the bound_claims:
...
# dev|rc|beta release
bound_claims_type = "regex"
bound_claims = {
  ref            = "^(?:v){0,1}(\d+\.){2}\d+\-(alpha|beta|dev|rc)\.\d+$"
  ref_type       = "tag"
  ref_protected  = "true"
}
...
# stable release
bound_claims_type = "regex"
bound_claims = {
  ref            = "^(?:v){0,1}(\d+\.){2}\d+$"
  ref_type       = "tag"
  ref_protected  = "true"
}

what do you think?

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

No branches or pull requests

1 participant