mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Properly check for policy equivalency during renewal.
This introduces a function that compares two string policy sets while ignoring the presence of "default" (since it's added by core, not the backend), and ensuring that ordering and/or duplication are not failure conditions. Fixes #1256
This commit is contained in:
@@ -3,10 +3,9 @@ package github
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
"github.com/google/go-github/github"
|
||||
"github.com/hashicorp/vault/helper/policies"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
)
|
||||
@@ -83,8 +82,7 @@ func (b *backend) pathLoginRenew(
|
||||
} else {
|
||||
verifyResp = verifyResponse
|
||||
}
|
||||
sort.Strings(req.Auth.Policies)
|
||||
if !reflect.DeepEqual(verifyResp.Policies, req.Auth.Policies) {
|
||||
if !policies.EquivalentPolicies(verifyResp.Policies, req.Auth.Policies) {
|
||||
return logical.ErrorResponse("policies do not match"), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user