Your Average Dev Daily #4

How It Actually Works

Archive

Daily coding puzzle. Find the bug, spot the security flaw, or understand what AI-generated code gets wrong.

0
played
0%
correct

Leaked Environment Secrets

typescript
// config.ts
export const config = {
  apiUrl: process.env.NEXT_PUBLIC_API_URL,
  stripeKey: process.env.STRIPE_SECRET_KEY,
  databaseUrl: process.env.DATABASE_URL,
  adminEmail: process.env.ADMIN_EMAIL,
};

// Used in a client component
import { config } from './config';

function Dashboard() {
  return <div>API: {config.apiUrl}</div>;
}

What's wrong with this Next.js configuration pattern?