Auto-generated tile from GitHub (10 skills)
92
94%
Does it follow best practices?
Impact
92%
1.16xAverage score across 44 eval scenarios
Advisory
Suggest reviewing before use
Acme Corp is building a customer-facing web application using Fastify (TypeScript). Product management has decided that users will authenticate via the company's existing identity provider (a standard OAuth 2.0/OIDC server running at https://auth.acme.internal). The security team has flagged that the auth implementation must be modern and hardened — they've had incidents in other services where CSRF attacks on the OAuth flow succeeded, and they want that class of vulnerability eliminated.
The application needs a /login endpoint that redirects users to the identity provider, and a /login/callback endpoint that exchanges the authorization code for tokens and stores them in the user session. The client ID and secret are read from environment variables CLIENT_ID, CLIENT_SECRET, AUTH_SERVER, and CALLBACK_URI. The app already has @fastify/session configured on the Fastify instance; you just need to wire up OAuth.
Produce a working TypeScript Fastify plugin and route file that implement the login flow. Specifically:
plugins/oauth.ts — registers the OAuth2 plugin on the Fastify instanceroutes/auth.ts — defines the /login/callback GET route and a /logout GET routeAlso produce:
package.json listing the runtime dependencies neededIMPLEMENTATION_NOTES.md explaining the security choices made in the implementation (anti-CSRF mechanism used, proof-of-possession method chosen, token storage approach)evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
skills
documentation
fastify
init
linting-neostandard-eslint9
node
nodejs-core
rules
oauth
octocat
snipgrapher