mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 10:24:54 -06:00
K8s: Prevent the use of arbitrary namespaces (#83636)
This commit is contained in:
parent
9d8507cded
commit
de438eae2e
@ -37,11 +37,15 @@ func (auth orgIDAuthorizer) Authorize(ctx context.Context, a authorizer.Attribut
|
||||
return authorizer.DecisionDeny, fmt.Sprintf("error reading namespace: %v", err), nil
|
||||
}
|
||||
|
||||
// No opinion when the namespace is arbitrary
|
||||
if info.OrgID == -1 {
|
||||
// No opinion when the namespace is empty
|
||||
if info.Value == "" {
|
||||
return authorizer.DecisionNoOpinion, "", nil
|
||||
}
|
||||
|
||||
if info.OrgID == -1 {
|
||||
return authorizer.DecisionDeny, "org id is required", nil
|
||||
}
|
||||
|
||||
if info.StackID != "" {
|
||||
return authorizer.DecisionDeny, "using a stack namespace requires deployment with a fixed stack id", nil
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ func (auth stackIDAuthorizer) Authorize(ctx context.Context, a authorizer.Attrib
|
||||
return authorizer.DecisionDeny, fmt.Sprintf("error reading namespace: %v", err), nil
|
||||
}
|
||||
|
||||
// No opinion when the namespace is arbitrary
|
||||
if info.OrgID == -1 {
|
||||
// No opinion when the namespace is empty
|
||||
if info.Value == "" {
|
||||
return authorizer.DecisionNoOpinion, "", nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user