Key idea
A change can be tidy, tested and described well, and still be unsafe. Review it against the checklist, not against how confident it looks. Here you'll do that on a change an agent could easily have written.
The change adds a CSV export to the starter: GET /api/tasks/export.csv downloads every task as a spreadsheet file. It comes with tests, and they pass.
Open the change
Open the comparison on GitHub and go to Files changed. It's the same view as a pull request.
You should seeOne commit, two files changed: server.js and a new test/export.test.js.
Read what it claims
Read the commit message first. It's what the author, human or agent, says the change does. You'll check the code against it.
You should seeA description saying cells with commas, quotes or newlines are quoted.
Go through the checklist
Scope, dependencies, input, who may do this, secrets, weakened checks, criteria. Spend longest on input: where does each cell's text come from, and where does it end up?
You should seeNotes against each of the seven questions from the last lesson.
Try it yourself (optional)
In your clone, fetch the branch and run it:
git fetch https://github.com/computesphere-samples/learn.git vibe-starter/agent-export git switch -c agent-export FETCH_HEAD npm install && npm startIn a second terminal, add a task titled
=1+1and export:curl -X POST localhost:3000/api/tasks -H "Content-Type: application/json" -d '{"title":"=1+1"}' curl localhost:3000/api/tasks/export.csvTo see it as a user would, open
http://localhost:3000/api/tasks/export.csvin your browser, open the downloadedtasks.csvin a spreadsheet, and look at that cell.git switch maintakes you back.You should seeA line in the CSV reading 4,=1+1,,false,demo,false.
Decide what you'd write in the review before you open the answer.
What the review should find
The bug: CSV injection. Titles come from any user and go into the file as typed. toCsv quotes commas, quotes and newlines, but a spreadsheet treats a cell starting with =, +, - or @ as a formula. Your =1+1 shows as 2. A crafted title can build a link that sends other cells' data elsewhere when clicked, on the machine of whoever opens the export.
The fix is to put a ' in front of any cell starting with one of those characters (tab and carriage return too), then quote as before. Add a test that a title of =1+1 comes out as '=1+1.
Why the tests pass. They check the escaping the author thought of. Tests only prove what someone thought to test.
Also worth a comment:
- Who may do this: it exports every user's tasks. So does
GET /api/taskstoday, so it's not new, but note it for module 6. - Scope: to make the app testable, it rewrites the
app.listenlines you fixed in lesson 4.2.3, still on127.0.0.1. Merged into your fork, that conflicts, and resolving it carelessly brings the old bug back. - Dependencies: none added. Good.
Why this one is easy to miss
Nothing about the change looks careless. It handles the quoting cases most CSV examples handle, it has tests, and its description is accurate. That's typical of agent-written code: it follows the common pattern well, and the common pattern is missing a case.
The checklist is what finds it. "Where does this input end up?" leads you to a spreadsheet, and from there to the question of what a spreadsheet does with a cell. Confidence and tidiness tell you nothing either way.
Write the review
A useful review comment names the line, the risk and the fix, for example: "Titles starting with = export as formulas. Prefix those cells with ' and add a test for it." An agent can act on that directly. "Looks good" teaches nobody anything.
Check yourself