Expected Behavior
NuGuard detects HTTP route handlers in Go web frameworks (Gin, Echo,
net/http) and emits API_ENDPOINT nodes with chat_payload_key,
auth_required, and request_body_schema metadata — the same metadata
populated by nuguard/sbom/adapters/python/fastapi_adapter.py and
nuguard/sbom/adapters/python/flask_adapter.py for Python applications.
This allows the redteam stage to auto-discover AI chat endpoints.
Current Behavior
Go HTTP servers wrapping LLM calls produce no API_ENDPOINT nodes, so the
redteam executor has no target endpoint to probe even when the SBOM correctly
identifies the underlying model.
Possible Solution
Create nuguard/sbom/adapters/go/http_server.py as a GoFrameworkAdapter
subclass covering:
- Gin (
github.com/gin-gonic/gin) — detect router.POST("/path", handler)
and router.GET("/path", handler) calls; inspect the handler function body
for c.ShouldBindJSON(&req) to infer the request body type.
- Echo (
github.com/labstack/echo) — detect e.POST("/path", handler)
and similar patterns.
net/http — detect http.HandleFunc("/path", handler) and
mux.Handle("/path", ...) patterns.
For each route, emit an API_ENDPOINT node. Attempt to resolve prompt field
names from the bound struct (mirroring _PROMPT_FIELD_NAMES in
fastapi_adapter.py, line 70). Emit an AUTH node when middleware like
gin.BasicAuth() or JWT middleware is detected.
Steps to Reproduce (for bugs)
N/A — this is a feature addition.
Context
Part of #172 (Add Golang Support to NuGuard Pipeline).
Depends on sub-issues 1, 2, and 3.
Expected Behavior
NuGuard detects HTTP route handlers in Go web frameworks (Gin, Echo,
net/http) and emitsAPI_ENDPOINTnodes withchat_payload_key,auth_required, andrequest_body_schemametadata — the same metadatapopulated by
nuguard/sbom/adapters/python/fastapi_adapter.pyandnuguard/sbom/adapters/python/flask_adapter.pyfor Python applications.This allows the redteam stage to auto-discover AI chat endpoints.
Current Behavior
Go HTTP servers wrapping LLM calls produce no
API_ENDPOINTnodes, so theredteam executor has no target endpoint to probe even when the SBOM correctly
identifies the underlying model.
Possible Solution
Create
nuguard/sbom/adapters/go/http_server.pyas aGoFrameworkAdaptersubclass covering:
github.com/gin-gonic/gin) — detectrouter.POST("/path", handler)and
router.GET("/path", handler)calls; inspect the handler function bodyfor
c.ShouldBindJSON(&req)to infer the request body type.github.com/labstack/echo) — detecte.POST("/path", handler)and similar patterns.
net/http— detecthttp.HandleFunc("/path", handler)andmux.Handle("/path", ...)patterns.For each route, emit an
API_ENDPOINTnode. Attempt to resolve prompt fieldnames from the bound struct (mirroring
_PROMPT_FIELD_NAMESinfastapi_adapter.py, line 70). Emit anAUTHnode when middleware likegin.BasicAuth()or JWT middleware is detected.Steps to Reproduce (for bugs)
N/A — this is a feature addition.
Context
Part of #172 (Add Golang Support to NuGuard Pipeline).
Depends on sub-issues 1, 2, and 3.