Skip to content
quarry Artifact [2b2db7e735]
Login

Artifact [2b2db7e735]

Artifact 2b2db7e73502712eb4e43b6abc8fff44450b9dd4bffb5887e76468eca6eacc8b:

Ticket change [2b2db7e735] - New ticket [3b0939bad2] Adopt a strict CSP: datastar CSP mode, nonces, and the untrusted-expression audit. by ai-local on 2026-08-31 17:12:06.
D 2026-08-31T17:12:06.569
J cmimetype text/x-markdown
J comment quarry\ssets\sNO\spage\sCSP\stoday.\sThe\sonly\sContent-Security-Policy\sin\sthe\stree\sis\son\sattachment\sdownloads\s(default-src\snone;\ssandbox),\swhich\sis\sright\sfor\suploaded\sfiles\sand\ssays\snothing\sabout\sthe\sapp.\n\nWHAT\sBLOCKS\sA\sSTRICT\sONE.\sNot\sthe\sdata-on:*\sattributes\s—\sthose\sare\sdata\sattributes,\snot\sinline\shandlers,\sand\sscript-src\sdoes\snot\sgovern\sthem.\sThe\sblocker\sis\sunsafe-eval:\sdatastar\sevaluates\sexpressions\swith\sthe\sFunction()\sconstructor.\s1.0.3\s(now\svendored,\se13cb746)\sadds\sCSP\smode,\swhich\sapplies\sa\sper-response\snonce\sat\sexpression-compile\stime\sinstead,\sallowing\sscript-src\sself\snonce-...\swith\sno\sunsafe-eval.\n\nquarry\sis\swell\splaced:\sone\sscript\stag,\szero\sinline\sscript\sbodies,\salready\spinned\sby\sa\stest.\sTwo\sgenuine\sinline\shandlers\sremain\son\sthe\sclone-URL\swidget\s—\sonfocus=this.select()\sand\sonclick=this.previousElementSibling.select()\s—\swhich\sARE\sunsafe-inline\sand\smust\smove\sto\sdata-on:*.\n\nWork:\s(1)\smove\sthose\stwo\shandlers;\s(2)\sgenerate\sa\scryptographically\ssecure\snonce\sper\sfull-page\sresponse\sand\sput\sit\son\s<html>\sas\sdata-nonce;\s(3)\sset\sContent-Security-Policy\swith\sscript-src\sself\snonce;\s(4)\sdecide\sthe\srest\sof\sthe\spolicy\s—\simg-src,\sstyle-src\snow\sthat\sthe\ssheet\sis\san\sexternal\sasset,\sconnect-src\sfor\sSSE.\n\nTHE\sAUDIT,\swhich\sis\sthe\sreal\swork.\sThe\sdatastar\sdocs\sare\sblunt:\sCSP\smode\sdoes\sNOT\smake\sexpressions\ssafe\swith\suntrusted\scontent\s—\sit\sapplies\sa\snonce,\sit\sdoes\snot\ssanitize.\squarry\srenders\scommit\smessages,\sticket\stitles\sand\sforum\sposts\sfrom\sMIRRORED\supstreams\s(sqlite,\stcl,\sfossil),\sso\sany\splace\san\suntrusted\sstring\sis\sinterpolated\sinto\sa\sdata-*\sexpression\sis\san\sinjection\swhether\sor\snot\sCSP\smode\sis\son.\sThe\srule\sis\sto\spass\suser\svalues\sthrough\ssignals\sand\skeep\sexpressions\sstatic.\sAudit\severy\sdata-*\sexpression\sfor\sinterpolated\scontent\sand\spin\sthe\srule\swith\sa\stest.\n\nAdjacent\sand\scheap:\sthe\sJS\sassets\sare\sCache-Control\smax-age=86400\swith\sno\scontent\shash,\sso\sthey\srevalidate\sdaily.\sThe\sstylesheet\sis\salready\shashed+immutable\s(eb4793ee);\sgiving\sthe\sscripts\sthe\ssame\sURL\sshape\sremoves\sthat\sround\strip\sand\sis\sworth\smore\sthan\sthe\s1.3KB\sbrotli\swould\ssave\son\sthe\sbundle.\n\nAcceptance:\sa\sstrict\sCSP\sis\sserved\son\severy\spage;\sno\sunsafe-eval,\sno\sunsafe-inline;\sthe\sinteractive\ssurfaces\s(file\swindowing,\sticket\sselects,\scomposer\spreview,\slive\stimeline)\sall\sstill\swork\sin\sa\sbrowser;\sa\stest\sasserts\sthe\sheader\sis\spresent\sand\sthat\sno\sdata-*\sexpression\sinterpolates\srequest\sor\srepository\scontent.
J priority High
J severity Important
J status Open
J subsystem web
J title Adopt\sa\sstrict\sCSP:\sdatastar\sCSP\smode,\snonces,\sand\sthe\suntrusted-expression\saudit
J type Feature
K 3b0939bad2dd72e9fd91a979d4d2f931ae6fe7a4
U ai-local
Z 53f36b7c4899165fa56c071b00ca41fe