Security (FLT-379 first slice)¶
Scanned repos are hostile input. The trust boundary is RootedFileSystem:
every read and write canonicalizes first, rejecting UNC, drive-absolute,
dot segments that escape the root, device names, and reparse points on any
segment, resolving exact on-disk casing. Caps: 1 MiB per project/compose
file, 32 MiB per cdk.tf.json, JSON depth 64, 2000 elements, 10000
relationships, 100 YAML aliases. Breaches exit 2 with paths and lines only,
never file values.
D2 v0.9.0 runs as a subprocess with a pinned, hash-checked binary, no PATH
lookup, a cleared environment, fixed flags, and a private temp dir. The
pin (tools/d2.pin.json) ships embedded in the tool and is never read
from the repo being scanned, so a hostile repo cannot pick the hash its
own binary is checked against. D2
errors map to a fixed message (real D2 echoes absolute paths). Labels
escape \, ", $ and reject control/format characters. Post-render, the
SVG is rechecked with an XML reader: no DOCTYPE, script, foreignObject,
on* attributes, or non-fragment URLs (namespace declarations and <style>
font data are expected and allowed). Rendered SVG is viewed via <img>,
never inline.
Canary fixtures (CANARY_FLT379_*) prove values never enter the model,
files, or diagnostics. Residual: network denial during render is not
enforced; emitted D2 has no URL positions (recorded, not enforced). Viewer
CSP and network denial are named follow-ups.