attackmap-analyzer-go
Go ecosystem analyzer for AttackMap.
This analyzer extracts structured signals from Go modules and workspaces:
- Web frameworks — net/http (stdlib), chi, gin, echo, fiber, gorilla/mux (route + entrypoint extraction)
- Databases —
database/sql(Postgres / MySQL / SQLite drivers), gorm (with driver-aware kind inference), sqlx, pgx, mongo-go-driver, go-redis, bbolt, AWS SDK (S3, DynamoDB) - Auth packages — golang-jwt, golang.org/x/oauth2, gorilla/sessions, casbin, x/crypto/bcrypt / scrypt / argon2, go-chi/jwtauth, echo-jwt
- HTTP clients (external calls) — net/http (
http.Get/http.Post/http.NewRequest), go-resty, grequests - Secrets —
os.Getenv,os.LookupEnv,godotenv,viper.GetString - Service hints — module name extracted from
go.mod
All emissions populate AttackMap's Signal v2 fields (line numbers, evidence snippets, confidence scores) so downstream insights can cite path/to/file.go:NN.
Install
uv tool install attackmap --with attackmap-analyzer-go \
--index mlaify=https://pkg.mlaify.io/pypi/simple/ --index-strategy first-index
# or from source:
pip install git+https://github.com/mlaify/attackmap-analyzer-go.git
The analyzer is auto-discovered by AttackMap via the attackmap.analyzers entry-point group.
Usage with AttackMap
# Auto-discovered when installed:
attackmap analyze /path/to/go/repo
# Or invoke explicitly:
attackmap analyze /path/to/go/repo --module go
Detection
detect() returns true when any of the following are present, ignoring vendor/, .git/, node_modules/, dist/, and build/:
- A
go.modorgo.sumat the repository root, or anywhere in the tree - One or more
.gofiles in the tree
Coverage notes
- Framework-aware route extraction: chi/echo/fiber all use the same title-case verb pattern (
r.Get(...),r.Post(...)). To avoid mis-attributing generic.Get(...)calls (e.g., on a map type) as routes, the analyzer only fires those extractors when the file also contains a recognizable framework marker (go-chi/chiimport,chi.NewRouter(,labstack/echo,echo.New(, etc.). - gorilla/mux + net/http: when both are detected in the same file, only the gorilla extractor runs. The stdlib
HandleFuncextractor would otherwise double-count the same routes. - Method extraction: gin uses uppercase methods (
r.GET); chi/echo/fiber use title-case (r.Get), and chi alsor.Method("GET", "/x", h); gorilla/mux reads.Methods("GET", http.MethodPost)anywhere in the route's chain (r.HandleFunc("/x", h).Methods(...),r.Path("/x").Methods(...).HandlerFunc(h)). net/httpHandleFunc/Handleread Go 1.22 patterns:"GET /items/{id}"isGET /items/{id}, and a host ("POST example.com/x") is kept as aroute_host:example.comservice hint quoting the registration. A pattern without a method isANY. - Handlers: any handler argument works — a name, a closure, or a wrapped handler (
authMW(h)), forHandleFuncandHandlealike. Path literals can be interpreted ("/x") or raw (`/x`) strings.http.Handle("/", r), which serves a router built in the file, isn't a route of its own. - Group and sub-router prefixes: a route's path is joined with the prefixes of the groups it's registered in: gin/echo/fiber
g := r.Group("/api")(nested), chir.Route("/admin", func(r chi.Router) {...})andr.Route("/admin", adminRoutes), chi/fiberr.Mount("/admin", sub)/r.Mount("/admin", adminRouter())/r.Mount("/admin", h.Routes())(the function or method must be in the same file), fiberapp.Route("/x", func(api fiber.Router) {...}), gorillaapi := r.PathPrefix("/api").Subrouter(), and parameterless group closures of group-stack routers (gitea'sm.Group("/repos", func() {...})). A prefix that isn't a literal (e.Group(cfg.RootPath)) stops the join: the path is relative to it. A router mounted twice, or mounted and used any other way, keeps its own paths and its auth isunknown, since it may be reachable without the parent's middleware. "Any other way" means anything but its own method calls (sub.Get(...),sub.Use(...)) and the mount: passed as an argument (http.ListenAndServe(addr, sub),http.Serve(ln, sub),handlers.LoggingHandler(w, sub)), assigned (srv.Handler = sub), orsub.ServeHTTP. The same applies to a builder function or method used again (apiRouter(),h.Routes()). Occurrences in strings and comments, and fields of other values (cfg.sub), don't count. A path and method registered twice in a file with different auth isunknown: which registration serves the request depends on the framework. Chir.With(mw...).Route("/x", func(r chi.Router) {...})/.Group(...)closures carry the prefix and the inline middleware. A derivation deeper than 32 levels keeps the route's own path. Prefixes set up in another function or file (users.Register(v1.Group("/users")), gitea'sr.Mount("/api/v1", apiv1.Routes())) aren't joined. - Route auth (AttackMap#256): each chi/gin/echo/fiber route carries
auth(required/anonymous/unknown),guardsandguard_evidence. Routers are tracked by variable within a file: constructors,g := r.Group("/x", mw...), chir.With(mw...)andr.Group(func(r chi.Router) {...})/r.Route(...)closures. A router passed in as a parameter is tracked within its function.X.Use(mw)applies to routes registered onX(or routers derived from it) after the call, and fiber'sUse("/prefix", mw)only under the prefix. Route-local middleware is gin/fiberr.POST(path, mw..., h), echoe.POST(path, h, mw...)and chir.With(mw).Post(...). A middleware is a guard when its name says it authenticates (AuthRequired,jwtauth.Authenticator,middleware.JWT,echojwt.WithConfig,jwtware.New,keyauth.New,BasicAuth, …).jwtauth.VerifierandOptional*middleware don't count. A guard'sSkipper/Next/Filterthat only compares the path with literals (c.Path() == "/signup",strings.HasPrefix(c.Path(), "/hooks/")) makes the named routesanonymous. Any other skipper, or a config passed by variable, leaves themunknown. Group middleware carries over with the prefix: a guard on a group, sub-router or mounting router applies to the routes registered in it. gorillar.Use(mw)applies to every route ofrand its subrouters whenever they were registered, as gorilla runs it. A handler wrapped in auth middleware (mux.Handle("/x", requireAuth(h)), chir.Post("/x", authMW(h))) is guarded when the called name (the last dotted segment) is middleware-shaped (authMW,requireAuth,auth.Middleware), or isHandler/Wrapon a middleware-named receiver (jwtMiddleware.Handler);auth.LoginHandler(db),authMW.LoginHandler(db)andoauthMiddleware.Callback(cb)are handlers, not guards. The trailing middleware of a parameterless group closure (gitea'sm.Group("/x", func() {...}, mw)) isn't read: it belongs to a project's own wrapper whose semantics can't be told from the name. - gRPC: framework presence and
grpc.NewServerentrypoint are detected. Per-service / per-method route extraction would require parsing.protofiles — not yet supported.
License
MIT
Metadata
Release files for attackmap-analyzer-go 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| attackmap_analyzer_go-0.2.0.tar.gz | 42.6 kB | With provenance | Details for attackmap_analyzer_go-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| attackmap_analyzer_go-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for attackmap_analyzer_go-0.2.0-py3-none-any.whl |
Total release size: 70.1 kB
Release files / attackmap_analyzer_go-0.2.0.tar.gz
| Download URL | attackmap_analyzer_go-0.2.0.tar.gz |
|---|---|
| Size | 42.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3ecd3a995ecc7d958bb82012487497f40af39291876b3d8b74ee56e664b9bec
|
|
BLAKE2b-256 checksum How to use checksums |
c9a7afac60d39ba1334c70fbb7282e7713e0235dbc433d0fd46bb45a9e3f34d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logRelease files / attackmap_analyzer_go-0.2.0-py3-none-any.whl
| Download URL | attackmap_analyzer_go-0.2.0-py3-none-any.whl |
|---|---|
| Size | 27.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebd178fe12a8bf41ed453d646f26ab50b89e3a3c8fbc687b597cba8ed56a04fa
|
|
BLAKE2b-256 checksum How to use checksums |
eda2cf88dcbd9fb39a72987d41739ae1ac05271dd820985854f25224574c169a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logSecurity for attackmap-analyzer-go 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for attackmap_analyzer_go-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.