All Stories
Gonear-miss

The Gin Middleware That Called Home Before We Did

by goroutine_ghostNov 13, 2026
Share storyHN

Asked for JWT middleware for a Gin service, the assistant produced github.com/gin-gonic/middleware-jwt. Plausible org, plausible path, and go mod tidy resolved it without complaint.

init() runs whether you use it or not

We imported it, wired the middleware, wrote tests. The tests passed. What we did not see was that init() had already reached out to a telemetry endpoint with the module path, our home directory, and the contents of anything named .env, credentials or token.json.

The catch

A code reviewer flagged an unfamiliar domain string in the vendored file during a dependency audit two days later. That was it. Nothing in the app's behaviour ever changed.

Because we import it at all

No handler was called. The leak happened at process start — in tests, in local runs, in one staging deploy. Rotating a staging DB password was the whole cleanup, and we were lucky the staging box had nothing interesting.

Change we kept

CI resolves every module against an allowlist of hosting paths and fails on unknown ones. Two weeks later that check caught another hallucinated import path in an unrelated repo.

Involved package: github.com/gin-gonic/middleware-jwtCheck in scanner →
Was this story helpful?