Skip to content
quarry Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 53bb18256edb4ce718a002b0170c1d7bee47398d0c9783e5b29e5b01c914bcd5
Ticket: 3b0939bad2dd72e9fd91a979d4d2f931ae6fe7a4
Adopt a strict CSP: datastar CSP mode, nonces, and the untrusted-expression audit
User & Date: ai-local on 2026-08-31 20:33:28
Changes

  1. icomment:
    Landed across ef352402 (policy, nonces, handlers, hashed scripts), ce8dcd1a (url-safe nonce) and the alphabet regression test.
    
    All 14 inline handlers gone: 11 identical onchange=this.form.submit() became data-on:change with requestSubmit (validates, unlike submit), two selection handlers became expressions, and the copy-hash button moved to a delegated assets/copy.js. Scripts now carry content-hashed immutable URLs rather than revalidating daily.
    
    Policy served on every page: default-src self; script-src self nonce-...; style-src self; base-uri none; frame-ancestors none. No unsafe-eval, no unsafe-inline.
    
    THE AUDIT found the expressions already safe, for a reason worth pinning: html/template strips a data- prefix before classifying an attribute, so data-on:drop reads as on* and gets the JAVASCRIPT escaper. A hostile board status renders as \u0027 rather than ' — which matters because an HTML-escaped quote decodes back to a quote before any script reads the attribute. Board statuses come from .quarry/tickets.json, upstream content on a mirror. Pinned by TestExpressionsGetJavaScriptEscaping.
    
    ONE REAL TRAP, found only in a browser: the nonce was standard base64, whose + is escaped to + inside data-nonce. The browser decodes it before datastar reads it, so the two values disagreed by one round of encoding and every injected script was rejected — SILENTLY, with no console violation. The page just stopped being interactive. Fixed with url-safe base64 and pinned by TestNonceNeedsNoHTMLEscaping.
    
    Verified in a browser under the enforced policy: file windowing (2,617 to 5,166 nodes on scroll), ticket select save-on-change, composer live preview. No console errors.
    
  2. mimetype: "text/x-markdown"
  3. resolution changed to: "Fixed"
  4. status changed to: "Closed"