Skip to content

Commit

Permalink
feature WS-579: added panic handling to the auth initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
IshikaGopie committed Mar 18, 2024
1 parent b5fa6cb commit 8bf2669
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/rest/operation_initializers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"golang.org/x/net/context"
"net/http"
"regexp"
"runtime/debug"
"strings"
)

Expand Down Expand Up @@ -42,6 +43,12 @@ func AuthorizationInitializer(ctxt context.Context, tapi Container, path string,
return ctxt, err
}

defer func() {
if err1 := recover(); err1 != nil {
log.Error("panic occurred ", string(debug.Stack()))
}
}()

//update path so that the open api way of specifying url parameters is change to wildcards. This is to support the casbin policy
//note ideal we would use the open api way of specifying url parameters but this is not supported by casbin
re := regexp.MustCompile(`\{([a-zA-Z0-9\-_]+?)\}`)
Expand Down

0 comments on commit 8bf2669

Please sign in to comment.