I like that the caveats section admits the token in the page source only stops drive-by bots. One gap it misses is formula injection. appendRow treats a string that starts with = as a formula, so a visitor who types =HYPERLINK(...) or =IMPORTXML(...) into the name field gets a live formula in your sheet, and the later auto-reply script may read the computed result instead of what was typed. Prefixing any value that starts with =, +, - or @ with an apostrophe before appending keeps it as plain text. A smaller one: in a web app, getActiveSheet() resolves to the first tab, so if someone reorders the tabs the leads quietly land somewhere else. getSheetByName('Leads') pins the target.
Both great catches, thank you. Formula injection is exactly the kind of thing that slips through when you test with polite data - appendRow happily evaluates a leading =, and the apostrophe prefix is the right fix. Same for getSheetByName('Leads') over getActiveSheet(); tab order should never decide where leads land. I'm folding both into the post. Appreciate the close read.
Glad both were useful, and "testing with polite data" is a good way to put why this one slips past. Thanks for taking them on so openly, the post was already a clear walkthrough to build from.
Thinking of the next person who builds from it is a nice way to see it, and that's exactly who the polite-data catch was for. Happy to have helped a little.
I like that the caveats section admits the token in the page source only stops drive-by bots. One gap it misses is formula injection.
appendRowtreats a string that starts with=as a formula, so a visitor who types=HYPERLINK(...)or=IMPORTXML(...)into the name field gets a live formula in your sheet, and the later auto-reply script may read the computed result instead of what was typed. Prefixing any value that starts with=,+,-or@with an apostrophe before appending keeps it as plain text. A smaller one: in a web app,getActiveSheet()resolves to the first tab, so if someone reorders the tabs the leads quietly land somewhere else.getSheetByName('Leads')pins the target.Both great catches, thank you. Formula injection is exactly the kind of thing that slips through when you test with polite data - appendRow happily evaluates a leading =, and the apostrophe prefix is the right fix. Same for getSheetByName('Leads') over getActiveSheet(); tab order should never decide where leads land. I'm folding both into the post. Appreciate the close read.
Glad both were useful, and "testing with polite data" is a good way to put why this one slips past. Thanks for taking them on so openly, the post was already a clear walkthrough to build from.
Thanks for reading that closely - catches like yours are what make the post better for the next person who builds from it.
Thinking of the next person who builds from it is a nice way to see it, and that's exactly who the polite-data catch was for. Happy to have helped a little.
Appreciate that, Hayrullah - the post is genuinely better for your catches.