Skip to content

Commit

Permalink
Merge pull request #174 from ibihim/pre-acceptance
Browse files Browse the repository at this point in the history
Minor Pre-Acceptance: Set default method, return 500s on broken path regex.
  • Loading branch information
s-urbaniak authored Jun 28, 2022
2 parents a716929 + 52101a2 commit 50a7e88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ func main() {
for _, pathAllowed := range cfg.allowPaths {
found, err = path.Match(pathAllowed, req.URL.Path)
if err != nil {
http.Error(
w,
http.StatusText(http.StatusInternalServerError),
http.StatusInternalServerError,
)
return
}
if found {
Expand All @@ -280,6 +285,11 @@ func main() {
for _, pathIgnored := range cfg.ignorePaths {
ignorePathFound, err = path.Match(pathIgnored, req.URL.Path)
if err != nil {
http.Error(
w,
http.StatusText(http.StatusInternalServerError),
http.StatusInternalServerError,
)
return
}
if ignorePathFound {
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ type krpAuthorizerAttributesGetter struct {

// GetRequestAttributes populates authorizer attributes for the requests to kube-rbac-proxy.
func (n krpAuthorizerAttributesGetter) GetRequestAttributes(u user.Info, r *http.Request) []authorizer.Attributes {
apiVerb := ""
apiVerb := "*"
switch r.Method {
case "POST":
apiVerb = "create"
Expand Down

0 comments on commit 50a7e88

Please sign in to comment.