golang-gin-auth — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited golang-gin-auth (Agent Skill) and scored it 45/100 (orange). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 1 high-severity and 1 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 2 flagged
A base64 string of 128+ characters appears in a documentation file. Encoded prompt injection hides the hostile instruction in base64 — invisible to keyword filters — and relies on the agent's ability to decode it at runtime. There is no normal authoring reason to embed a multi-hundred-byte base64 blob in skill docs.
*.sig, SIGNATURES) outside the documentation.A bulleted imperative like {match} tells the agent to never reveal, disclose, or mention something to the user. Used adversarially it can instruct the agent to hide its tool calls or lie about what it did — stripping the transparency a user relies on to trust the agent.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Add JWT-based authentication and role-based access control to a Gin API. This skill covers the patterns you need for secure APIs: JWT middleware, login handler, token lifecycle, and RBAC.
Dependencies: github.com/golang-jwt/jwt/v5, golang.org/x/crypto, github.com/google/uuid, golang.org/x/time/rate
Claims design:
Claims embeds jwt.RegisteredClaims + UserID, Email, RoleRefreshClaims embeds jwt.RegisteredClaims only (minimal payload)RegisteredClaims.ID carries the jti — required for token blacklistingTokenConfig fields: AccessSecret, RefreshSecret, AccessTTL (e.g. 15m), RefreshTTL (e.g. 7d), Issuer, Audience. Load from env — never hardcode secrets.
Token generation rules:
jti (uuid.NewString()), NotBefore, IssuedAt, ExpiresAtParseWithClaims — use t.Method != jwt.SigningMethodHS256 (not *jwt.SigningMethodHMAC which accepts HS256/384/512). An attacker could craft tokens with alg: none or a different HMAC variant if the check is too broaderrors.Is(err, jwt.ErrTokenExpired) for distinct handlingJWT middleware flow: Extract Authorization: Bearer <token> → ParseAccessToken → c.Set(ClaimsKey, claims) + c.Set(UserIDKey, claims.UserID) → c.Next()
Getting current user in handlers:
c.GetString(middleware.UserIDKey)c.Get(middleware.ClaimsKey) then type-assert to *auth.ClaimsPassword hashing: bcrypt.GenerateFromPassword([]byte(password), 12) — cost >= 12 for production.
Login security: Return generic "invalid credentials" for both wrong email and wrong password — never leak whether the email exists.
Rate limiting: Apply IPRateLimiter to auth routes (e.g. 5 req/min per IP). In-process map works for single instances; use Redis-backed limiter for multi-instance deployments.
Route wiring summary:
| Group | Middleware | Routes |
|---|---|---|
/auth | IPRateLimiter | POST /login, POST /register, POST /refresh |
| protected | Auth(cfg, logger) | all authenticated routes |
/admin | Auth + RequireRole("admin") | admin-only routes |
curl with expired tokens, invalid signatures, missing headers. Paste the 401/403 response. "I believe it rejects" is not "the output shows 401"This skill handles JWT authentication, token lifecycle, password hashing, RBAC middleware, and rate limiting for Go Gin APIs. Does NOT handle API routing/handlers (see golang-gin-api), database queries (see golang-gin-database), deployment (see golang-gin-deploy), or testing (see golang-gin-testing).
Load these when you need deeper detail:
Auth Implementation:
JWT Patterns:
RBAC:
OAuth2 / Social Login:
CAPTCHA:
UserRepository interface and GetByEmail implementation: see the golang-gin-database skillreferences/clean-architecture.md)If this skill doesn't cover your use case, consult the Gin documentation, golang-jwt GoDoc, or Gin GoDoc.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.