GoSecurityTagger
Inherits GoRouteGroupScope < PrefixScope < FrameworkTagger < FileHelper < Tagger < Reference < Object
Go security-middleware tagger.
go_auth already classifies authentication middleware (JWT/session/…).
This tagger covers the other security middleware Go web frameworks expose —
the protections a reviewer wants mapped onto each endpoint because, unlike
Rails, Go frameworks ship none of them on by default. Their presence is
the signal: which routes carry CSRF tokens, security headers, a rate limit,
or a request-body cap, and (by their absence on a state-changing route)
which don't.
Detection mirrors go_auth: a pre-scan records group-level .Use(...)
middleware against the group's URL prefix, then each endpoint is matched
against inline middleware on its own route call and against the
prefix-scoped group middleware. Everything is line-based and best-effort.
Precision over recall: the indirect form (mw := limiter.New(...) then a
bare api.Use(mw)) is deliberately not resolved — a false "protected"
tag is worse for a security review than a miss, so only middleware named
directly at the registration site is tagged. Cross-file middleware
factories are likewise out of scope by design.
Constants
A route-definition call. Used only to exclude route lines from the global-wrapper branch (inline route middleware is handled per-endpoint), so an over-broad verb set here is safe.
Security middleware constructors/identifiers, each mapped to the tag it
produces. Patterns are tied to the concrete constructor (middleware.CSRF,
csrf.New, helmet.New, …) so a plain local called secure or limiter
can't trip them. wrapper: true marks the net/http-style helpers
(gorilla/csrf, unrolled/secure, nosurf) that wrap the root handler rather
than register via .Use — those apply globally.
Constructors
Class methods
Instance methods
The per-endpoint shape: look at each endpoint, tag in place, hand the
array back. Fifteen framework taggers carried a byte-identical copy of
this; they now declare only check_endpoint.
Not every framework tagger fits it — eleven still override perform
because they need a pre-scan over the project (config files, middleware
registration) before the per-endpoint pass, or they group endpoints
first. Those keep their own.