mirror of https://github.com/status-im/consul.git
PreVerify acl:read access for listing endpoints (#6696)
We still will need to filter results based on the authorizer too but this helps to give an early 403.
This commit is contained in:
parent
78ad8203a4
commit
8ac79d0b8b
|
@ -807,10 +807,13 @@ func (a *ACL) TokenList(args *structs.ACLTokenListRequest, reply *structs.ACLTok
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var entCtx acl.EnterpriseAuthorizerContext
|
||||||
|
args.FillAuthzContext(&entCtx)
|
||||||
|
|
||||||
rule, err := a.srv.ResolveToken(args.Token)
|
rule, err := a.srv.ResolveToken(args.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if rule == nil {
|
} else if rule == nil || rule.ACLRead(&entCtx) != acl.Allow {
|
||||||
return acl.ErrPermissionDenied
|
return acl.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1157,10 +1160,13 @@ func (a *ACL) PolicyList(args *structs.ACLPolicyListRequest, reply *structs.ACLP
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var entCtx acl.EnterpriseAuthorizerContext
|
||||||
|
args.FillAuthzContext(&entCtx)
|
||||||
|
|
||||||
rule, err := a.srv.ResolveToken(args.Token)
|
rule, err := a.srv.ResolveToken(args.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if rule == nil {
|
} else if rule == nil || rule.ACLRead(&entCtx) != acl.Allow {
|
||||||
return acl.ErrPermissionDenied
|
return acl.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1573,10 +1579,13 @@ func (a *ACL) RoleList(args *structs.ACLRoleListRequest, reply *structs.ACLRoleL
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var entCtx acl.EnterpriseAuthorizerContext
|
||||||
|
args.FillAuthzContext(&entCtx)
|
||||||
|
|
||||||
rule, err := a.srv.ResolveToken(args.Token)
|
rule, err := a.srv.ResolveToken(args.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if rule == nil {
|
} else if rule == nil || rule.ACLRead(&entCtx) != acl.Allow {
|
||||||
return acl.ErrPermissionDenied
|
return acl.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1867,10 +1876,13 @@ func (a *ACL) BindingRuleList(args *structs.ACLBindingRuleListRequest, reply *st
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var entCtx acl.EnterpriseAuthorizerContext
|
||||||
|
args.FillAuthzContext(&entCtx)
|
||||||
|
|
||||||
rule, err := a.srv.ResolveToken(args.Token)
|
rule, err := a.srv.ResolveToken(args.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if rule == nil {
|
} else if rule == nil || rule.ACLRead(&entCtx) != acl.Allow {
|
||||||
return acl.ErrPermissionDenied
|
return acl.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2073,10 +2085,13 @@ func (a *ACL) AuthMethodList(args *structs.ACLAuthMethodListRequest, reply *stru
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var entCtx acl.EnterpriseAuthorizerContext
|
||||||
|
args.FillAuthzContext(&entCtx)
|
||||||
|
|
||||||
rule, err := a.srv.ResolveToken(args.Token)
|
rule, err := a.srv.ResolveToken(args.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if rule == nil {
|
} else if rule == nil || rule.ACLRead(&entCtx) != acl.Allow {
|
||||||
return acl.ErrPermissionDenied
|
return acl.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue