Build the mental model
Be cautious about what gets pasted into an AI prompt: sensitive credentials or confidential data sent to an AI tool may be logged or retained in ways hard to fully control.
AI output can be confidently wrong. Hallucination means a model can state a fabricated fact or insecure pattern with the same confident tone as something correct.
AI agents should not automatically receive unrestricted file or system access — the same least-privilege thinking for human accounts applies to AI agents too.
Prompt injection — awareness only
Untrusted content fed into an AI (a webpage, a document, a user message) could embed instructions attempting to manipulate the AI's behavior. Treat AI-fed content like any other untrusted input.
Vibe coding needs a real security workflow, not just accepting what comes out.
AI generates code
The starting point — treat it as a draft, not a finished product.
Developer reviews the diff
A human actually reads what changed.
Security checklist
Auth, authz, secrets, database rules, API exposure, input validation, dependencies — checked explicitly.
Tests, then deploy
Automated tests run, and only then does it deploy.
Stated bluntly: the code being AI-generated says nothing about whether it is secure. That judgment still belongs to the human reviewing it.
VIBE CODING SECURITY WORKFLOW
-----------------------------
AI GENERATES CODE
|
v
DEVELOPER REVIEWS THE ACTUAL DIFF
|
v
SECURITY CHECKLIST
auth | authz | secrets | db-rules | API exposure
input validation | dependencies
|
v
AUTOMATED TESTS RUN
|
v
SECURITY REVIEW (human sign-off)
|
v
DEPLOY
(AI generated it != secure by default)Connect it to a real scenario
The function below encodes the vibe-coding security workflow as an explicit gate before deploy — a boolean per checklist category plus whether tests pass.
There is no partial credit: readyToDeploy is only true when every single item has been explicitly checked.
Not ready
Authorization, database rules, and input validation are unchecked — readyToDeploy is false, and missing names all three.
Ready
Every category is checked, including passing tests — readyToDeploy is true.
Wire a check like this into a real review process so "it looks fine and the AI seemed confident" is never mistaken for a completed security review.
AI generated it does not mean secure by default
AI generated it does not mean secure by default. Every category on the checklist must be explicitly verified before deploy.
Try the working example
function assessVibeCodedChange(review) {
const checklist = {
authenticationChecked: review.authenticationChecked,
authorizationChecked: review.authorizationChecked,
secretsChecked: review.secretsChecked,
dbRulesChecked: review.dbRulesChecked,
apiExposureChecked: review.apiExposureChecked,
inputValidationChecked: review.inputValidationChecked,
dependenciesChecked: review.dependenciesChecked,
testsPassing: review.testsPassing,
};
const missing = Object.entries(checklist)
.filter(([, done]) => !done)
.map(([item]) => item);
return {
readyToDeploy: missing.length === 0,
missing,
note: "AI generated it does not mean secure by default — every item must be explicitly checked.",
};
}
const notReady = assessVibeCodedChange({
authenticationChecked: true, authorizationChecked: false, secretsChecked: true,
dbRulesChecked: false, apiExposureChecked: true, inputValidationChecked: false,
dependenciesChecked: true, testsPassing: true,
});
const ready = assessVibeCodedChange({
authenticationChecked: true, authorizationChecked: true, secretsChecked: true,
dbRulesChecked: true, apiExposureChecked: true, inputValidationChecked: true,
dependenciesChecked: true, testsPassing: true,
});
console.log("Not ready:");
console.log(JSON.stringify(notReady, null, 2));
console.log("\nReady:");
console.log(JSON.stringify(ready, null, 2));Not ready:
{
"readyToDeploy": false,
"missing": [
"authorizationChecked",
"dbRulesChecked",
"inputValidationChecked"
],
"note": "AI generated it does not mean secure by default — every item must be explicitly checked."
}
Ready:
{
"readyToDeploy": true,
"missing": [],
"note": "AI generated it does not mean secure by default — every item must be explicitly checked."
}5-minute try-it
Add a ninth checklist category, "outputEncodingChecked", to assessVibeCodedChange to represent verifying the AI-generated code safely handles rendering user-controlled data. Re-run both examples with this field included and confirm the not-ready example now lists it as missing too.
One important caution
Pasting confidential credentials or customer data into an AI prompt without considering where that data goes afterward.
Deploying AI-generated code straight from the assistant without an explicit authorization, secrets, and input-validation review.
OWASP Top 10 for Large Language Model Applications — Digital Privacy & Modern Security