Skip to main content

Scenario

A developer used GitHub Copilot to generate a Node.js authentication module. The AI-generated code hardcoded credentials that were committed and pushed before anyone noticed.
Six vulnerabilities in nine lines. All introduced by an AI assistant following common patterns from its training data.

Detection

Triage

AI explanation

Auto-fix: secret redaction PR

The PR applies this diff:

Fix: JWT secret (with AI)

Step 2: Store in environment
Step 3: Load at runtime
Step 4: Invalidate existing tokens Since the old secret is compromised, you must invalidate all tokens signed with it. The simplest approach is to change the secret and require all users to log in again.