mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
fix: replace TrimLeft with TrimPrefix and TrimRight with TrimSuffix
This commit is contained in:
parent
bd77d5f441
commit
51b7ef2c87
@ -185,11 +185,11 @@ func ruleMatchesResource(r *audit.PolicyRule, attrs authorizer.Attributes) bool
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match "*/subresource"
|
// match "*/subresource"
|
||||||
if len(subresource) > 0 && strings.HasPrefix(res, "*/") && subresource == strings.TrimLeft(res, "*/") {
|
if len(subresource) > 0 && strings.HasPrefix(res, "*/") && subresource == strings.TrimPrefix(res, "*/") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match "resource/*"
|
// match "resource/*"
|
||||||
if strings.HasSuffix(res, "/*") && resource == strings.TrimRight(res, "/*") {
|
if strings.HasSuffix(res, "/*") && resource == strings.TrimSuffix(res, "/*") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user