package main func init() { register(Check{ Seq: 190, ID: "19", Title: "Bearer token precedence over cookies in auth middleware", Run: func(ctx *ScanContext, rep *Reporter) { var authPrecViolations []authPrecedenceViolation for _, target := range ctx.backendTargets { for _, v := range checkAuthPrecedence(target.root) { v.file = prefixDisplayPath(target.display, v.file) authPrecViolations = append(authPrecViolations, v) } } for _, target := range ctx.pluginTargets { for _, v := range checkAuthPrecedence(target.root) { v.file = prefixDisplayPath(target.display, v.file) authPrecViolations = append(authPrecViolations, v) } } if len(authPrecViolations) > 0 { rep.Fail("%d auth precedence violation(s) — check Bearer/Authorization header before cookies", len(authPrecViolations)) for _, v := range authPrecViolations { rep.Findingf("%s:%d %s", v.file, v.line, v.snippet) } } else { rep.OK("Bearer token takes precedence over cookies in all auth extraction") } }, }) }