Skip to content

Commit

Permalink
Deduplicate policies prior to generating ACL on request (#17914)
Browse files Browse the repository at this point in the history
* Deduplicate policies prior to generating ACL on request

* add changelog

* edit changelog entry
  • Loading branch information
davidadeleon committed Nov 16, 2022
1 parent 68f683a commit 8a6bac1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/17914.txt
@@ -0,0 +1,3 @@
```release-note:bug
auth: Deduplicate policies prior to ACL generation
```
4 changes: 2 additions & 2 deletions vault/request_handling.go
Expand Up @@ -204,7 +204,7 @@ func (c *Core) fetchACLTokenEntryAndEntity(ctx context.Context, req *logical.Req
return nil, nil, nil, nil, ErrInternalError
}
for nsID, nsPolicies := range identityPolicies {
policyNames[nsID] = append(policyNames[nsID], nsPolicies...)
policyNames[nsID] = policyutil.SanitizePolicies(append(policyNames[nsID], nsPolicies...), false)
}

// Attach token's namespace information to the context. Wrapping tokens by
Expand Down Expand Up @@ -361,7 +361,7 @@ func (c *Core) checkToken(ctx context.Context, req *logical.Request, unauth bool
if te != nil {
auth.IdentityPolicies = identityPolicies[te.NamespaceID]
auth.TokenPolicies = te.Policies
auth.Policies = append(te.Policies, identityPolicies[te.NamespaceID]...)
auth.Policies = policyutil.SanitizePolicies(append(te.Policies, identityPolicies[te.NamespaceID]...), false)
auth.Metadata = te.Meta
auth.DisplayName = te.DisplayName
auth.EntityID = te.EntityID
Expand Down

0 comments on commit 8a6bac1

Please sign in to comment.