Showing 6 of 8 total issues
Function main
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func main() {
var err error
// Load .env file
err = godotenv.Load(".env")
Function createRequestsHandler
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func createRequestsHandler(c *cli.Context) (*RequestsHandler, error) {
// Prepare token extractor
extractors := make([]extraction.Extractor, 0, 2)
cookieName := c.String("cookie")
Function createRequestsHandler
has 9 return statements (exceeds 4 allowed). Open
Open
func createRequestsHandler(c *cli.Context) (*RequestsHandler, error) {
// Prepare token extractor
extractors := make([]extraction.Extractor, 0, 2)
cookieName := c.String("cookie")
Method TokenValidator.Validate
has 6 return statements (exceeds 4 allowed). Open
Open
func (tv *TokenValidator) Validate(tokenString string) (*jwt.Token, error) {
// Extract token
token, err := jwt.Parse(tokenString, tv.getTokenAssociatedPublicKey)
if err != nil {
switch err.(type) {
Method TokenValidator.getTokenAssociatedPublicKey
has 6 return statements (exceeds 4 allowed). Open
Open
func (tv *TokenValidator) getTokenAssociatedPublicKey(token *jwt.Token) (interface{}, error) {
// Verify ALG: it should at least be not "none". We decided to restrict it further to a set of trusted algorithms.
// See vulnerability: https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/
algHeader := token.Header["alg"]
if algHeader == nil {
Method headerExtractor.Extract
has 5 return statements (exceeds 4 allowed). Open
Open
func (he *headerExtractor) Extract(r *http.Request) (string, error) {
// Extract header
header := r.Header.Get(he.headerName)
if header == "" {
return "", errors.New(fmt.Sprintf("no header %s", he.headerName))