Course contents
Secure your site
Run a security review of your own site, fix what it finds, test it the way a stranger would, and write the rules down so the agent follows them from now on.
Time to apply the five habits to your own project. You'll ask the agent for a security review with a specific checklist, fix what it finds one item at a time, then test the live site the way a curious stranger would. Finally, you'll write the rules into the project so every future session starts with them.
Five questions about your site
- What data does it hold? Public menu data only, or names, emails and orders?
- Who can see or change it? Everyone, signed-in users, or only the owner?
- What secrets does it use? Any API keys, database keys or passwords, and where do they live?
- What code didn't you write? Packages, scripts from other sites, embedded widgets?
- What can the agent reach? Your files, your GitHub account, your hosting dashboard, live data?
For the Crumb & Co. site so far, the answers are short: public data only, no sign-in, no secrets, maybe one outside script. That's the safest place to be, and it's on purpose. The most secure sign-in is the one you don't need: the owner updates specials by editing a file, so there's no admin page to attack. If your project has a database or sign-in, which is common on the builder track, your answers are longer, and so is your review.
The security review prompt
Do a security review of this whole project. Don't change anything yet. Check for:
1. Secrets or keys anywhere in the code or the git history.
2. Anything a visitor types (search, forms, the URL) being written into the page as HTML instead of plain text.
3. Sign-in or admin checks that run in the browser.
4. Database tables without row-level security or access rules, if there's a database.
5. Scripts or packages from outside the project: exact versions, and whether each is needed.
6. Whether .env is listed in .gitignore.
List each finding with the file, how serious it is, and a one-sentence fix. Then wait for my OK before fixing anything.Fix the findings one at a time, most serious first, and check each in the browser. If the review finds nothing, don't relax: ask, “What would an attacker try first on this site?” and test that too.
Pin outside scripts
If your page loads a script from another site, such as a CDN, pin an exact version and add an integrity hash: a fingerprint the browser checks before it runs the file. If the file on the CDN ever changes, the browser refuses to run it. Ask your agent to add the hash. You'll use this pattern for the PDF library in Module 5.
<script src="https://cdn.jsdelivr.net/npm/pdfmake@0.3.14/build/pdfmake.min.js"
integrity="sha384-(the hash your agent computes)"
crossorigin="anonymous"></script>Complete the .gitignore lines that keep local secrets and installed packages out of git.
The review finds an API key you committed three weeks ago. You delete it from the code in today's commit. Are you safe?
Test it like a stranger
- Open the live site in a private window, signed out of everything.
- Right-click and choose View Page Source, then use Find (Cmd+F or Ctrl+F) to search for
key,secret,passwordandtoken. - Type
<b>hello</b>into the search box. If “hello” appears in bold, visitor input is being treated as HTML. Report it. - If you have sign-in or a database, try to reach owner-only pages and data while signed out, and again as a second test account.
- Check the project's visibility setting on your builder or GitHub is the one you chose.
Answer the five questions
Write one line per question, or ask the agent to answer them from the code and correct anything it gets wrong.
VerifyYou have five short answers you agree with.Run the security review
Send the review prompt from above. Read every finding before approving any fix.
promptDo a security review of this whole project. Don't change anything yet. Check for: 1. Secrets or keys anywhere in the code or the git history. 2. Anything a visitor types (search, forms, the URL) being written into the page as HTML instead of plain text. 3. Sign-in or admin checks that run in the browser. 4. Database tables without row-level security or access rules, if there's a database. 5. Scripts or packages from outside the project: exact versions, and whether each is needed. 6. Whether .env is listed in .gitignore. List each finding with the file, how serious it is, and a one-sentence fix. Then wait for my OK before fixing anything.VerifyYou get a list of findings, each with a file, a severity and a fix, and nothing has changed yet.Fix findings one at a time
Approve the most serious fix first, check the site, and commit. Repeat. In Claude Code,
/security-reviewchecks your branch's changes for vulnerabilities before you push; it needs anoriginremote, such as your GitHub repository, to compare against.VerifyEach finding is fixed or deliberately accepted, with one commit per fix.Write the security rules
Most agents read a file called
AGENTS.md; you'll learn the details in Module 5. Edit the rules into your own words if you like.promptCreate an AGENTS.md file in the project root (or add to it if it exists) with a short "Security rules" section: - No secrets in front-end code. Secrets go only in .env, which stays in .gitignore. - Show anything a visitor types as plain text, never as HTML. - No new packages or outside scripts without asking me first. Pin exact versions. - Never turn off a security rule to make an error go away. Propose a narrower rule instead. Commit it.VerifyAGENTS.mdexists in the project root, committed, with a Security rules section.Test the live site like a stranger
Push, wait for the deploy, then run the stranger tests above in a private window.
VerifyNo secrets in the page source, HTML in the search box shows as text, and nothing private is reachable.
<b>hello</b> into your search box shows “hello” in bold. What does that tell you?Plain-English definitions from the AI Coding Dictionary.