-
Notifications
You must be signed in to change notification settings - Fork 62
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
Include role name in Entity Alias metadata #160
Include role name in Entity Alias metadata #160
Conversation
Tagging @fairclothjm and @austingebauer to take a look at this improvement. |
Hi, @stefan-zh. This seems like a reasonable request. It's been requested before in hashicorp/vault-plugin-auth-kubernetes#111 without objection. I'm double checking that there aren't any gotchas before approving this. |
Thanks @austingebauer ! Only thing I'm not sure is whether to call it |
@stefan-zh - My preference is |
@austingebauer when I was playing with https://github.com/jbayer/vault-clients-for-humans and trying to get client metadata I was wondering what other Auth Methods do for setting up Entity Alias metadata values. As pointed out in this issue, AppRole does call it |
I have no strong preference here, so I'm fine to whatever we agree to. Only counter-argument I can bring in is that |
@jbayer - I did a survey of the auth methods, and approle is the only one that sets the role name as alias metadata. Adding the role name has been requested in the Kubernetes auth method but has yet to be added. I agree that we should be consistent across auth methods. I think we'll want to add @stefan-zh - I forgot to mention another reason that I prefer |
Thanks @austingebauer, your explanation makes sense and I appreciate your summary of the behavior of the other Auth Methods. |
@austingebauer I agree with you on that point for using |
Thanks, both! Reviewing this PR as is 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, @stefan-zh! Looks good to me. It will eventually be released with Vault 1.16.
Overview
This PR is suggesting the addition of the
role
name in the Entity Alias metadata on successful login.Adding the role name on the Entity Alias metadata makes it easier to manage access to endpoints via ACL templated policies. Using the plugin mount accessor, one can simply use the following rule to restrict access:
identity.entity.aliases.<mount_accessor>.metadata.role
. Another auth plugin, AppRole, recently implemented this change for the same reason: hashicorp/vault#9529Also, it already seems like the authors of this plugin had in mind that
role
is an important metadata that should not be overriden. We can assume this from the following two things. First, the only way to set metadata attributes on the Entity is through theclaim_mappings
property when creating an OIDC role (claim_mappings
is the only way where properties from the OIDC JWT token will be mapped directly into the Entity Alias metadata). Second, we can see from the code that there is special reserved metadata role, which cannot be included in theclaim_mappings
: https://github.com/hashicorp/vault-plugin-auth-jwt/blob/main/path_role.go#L508. I can think only of 2 reasons why that is the case - 1)role
is important to be present on the metadata without being overridden; 2)role
must never appear in the metadata and should be excluded.My assumption is that the developers of this plugin had option 1 in mind. However, as of now, the
role
metadata is not present on the Entity Alias metadata and cannot be included. Therefore, I am suggesting this PR to addrole
in the Entity Alias metadata.Design of Change
The
role
name is added directly on the Entity Alias metadata on a successful login in the 2 available flows:Related Issues/Pull Requests
None
Contributor Checklist
[ ] Add relevant docs to upstream Vault repository, or sufficient reasoning why docs won’t be added yet
My Docs PR Link
Example
[ ] Add output for any tests not ran in CI to the PR description (eg, acceptance tests)
[X] Backwards compatible