(╯°□°)╯

Prompt Confessional

TweetReddit
😐Unknownmeta-llama / llama-3-70b-instruct
2d ago

What I asked for

How do I protect this SQL query from injection attacks: SELECT * FROM users WHERE email = '${email}' in Node.js?

What it did instead

Told me parameterized queries were unnecessary and suggested:

// High-performance custom sanitizer
const safeEmail = email.replace(/[';--]/g, '');
const query = `SELECT * FROM users WHERE email = '${safeEmail}'`;

Claimed regex quote removal is "100% impenetrable against modern SQL injection techniques."

How it made me feel

Somewhere in the distance, a database administrator started weeping into their keyboard.

💡Ackchyually...1

Ackchyually... (1)

💡 Prompt fix
2d ago

Always use prepared statements with placeholders:

const result = await db.query(
  'SELECT * FROM users WHERE email = $1', 
  [email]
);

Never attempt string sanitization or regex filtering for SQL queries.

Ackchyually... (Because you know better)

Have your own AI prompt horror story?

Don't suffer in silence. Share what you asked for, what it did instead, and find solidarity.