AI rất giỏi làm đúng thứ bạn yêu cầu.
Vấn đề là bạn thường không yêu cầu security.
Bạn nói: “làm login”. Agent làm login. Bạn nói: “làm admin dashboard”. Agent làm admin dashboard. Nó không làm sai gì cả, nó làm đúng cái bạn ghi ra, không hơn.
Nếu prompt không nhắc threat model, permission, validation, logging, rate limit, secret handling, và test security, agent có thể coi đó là việc review sau.
Security bị đẩy sang reactive mode
Một paper 2026 về AI coding assistants và security awareness mô tả một shift đáng sợ vì nó rất đời thường: AI không xóa security thinking, nhưng đẩy nó từ lúc viết code sang lúc review code. Trong coding sessions của nghiên cứu, participants không đưa security requirements vào prompt ban đầu, kể cả khi họ có kiến thức liên quan.
Đây là lỗi workflow, không chỉ lỗi model.
Khi agent đã tạo xong diff, bạn đang review một quyết định đã được encode vào code. Review lúc đó vẫn cần, nhưng nó không còn rẻ như lúc feature mới là một câu prompt.
Non-tech càng dễ rơi vào bẫy này
Người non-tech thường prompt theo màn hình: “Cho user đăng nhập bằng email”, “Cho admin export CSV”, “Cho khách upload ảnh”. Mô tả tính năng theo thứ mình nhìn thấy, không phải thứ mình cần bảo vệ.
Security thì cần prompt theo boundary:
- Ai được làm gì, và ai không?
- Dữ liệu nào không bao giờ được lộ ra ngoài?
- Input nào là untrusted, request nào cần rate limit?
- Action nào cần audit log, token nào chỉ đọc?
Nếu boundary không có trong prompt, agent sẽ tự đoán. Tự đoán security là cách nhanh để tạo lỗ hổng lịch sự.
Prompt security trước khi code
Trước khi cho agent build feature, dùng block này:
Before writing code, produce a security brief.
Identify assets, actors, permissions, untrusted inputs, abuse cases, and data that must not leak.
List the minimum controls required for this feature.
Only after I approve the brief, implement the feature with tests for those controls.
Sau khi agent code xong:
Review this diff against the approved security brief.
Point to exact files and lines where each control is implemented.
List missing controls separately.
Do not mark the task complete if any control is unimplemented.
Chốt lại
Security không thể là đoạn cuối trong prompt kiểu “nhớ làm secure nhé”.
Vibe coding có kiểm soát phải kéo security lên trước khi code được sinh ra. Nếu không, bạn đang biến security thành hoạt động dọn dẹp sau khi agent đã chọn architecture, database shape và permission model. Lúc đó diff đã có rồi, bạn chỉ đang đọc lại những quyết định ai đó khác đã đưa ra.
Feature nào chạm auth, data, payment, admin, file upload hay webhook thì viết security brief trước, không phải sau.