06 / Safe output and trust
Safe by default. Plain about the rest.
What the code holds is backed by tests. What it does not do is written down beside it, in the same place.
Output.
The same document, rows and options compile to the same bytes.
One writer
Every byte of HTML goes through one writer with one escape function. A text, an attribute, a title or a row cannot open a tag.
Addresses
Limited to http, https, mailto, in-page anchors and in-site paths. Anything else writes no href or src.
CSS values
Every value from the document that reaches CSS is checked first as a keyword, a number or a colour.
No network
build and dev make no network request. The dev server binds 127.0.0.1 only.
One site policy.
Every built site carries one Content Security Policy, written by the compiler. It starts from nothing allowed.
Scripts
Only the hashes of the scripts the site runs. No unsafe-inline, no strict-dynamic. Each _culm/ file carries a matching integrity.
Requests
On a host that sends the header, resources, script requests and form posts go only to origins the site declares.
What it does not do
It does not restrict navigation: no policy a browser supports does. On a host that cannot send headers it is only a meta tag, without frame-ancestors.
Islands, by trust.
An island is a piece of a page that JavaScript draws once the page has loaded. A page with no island is the static file it always was.
Declarative
Only Culm's own scripts run. The default, and what an agent produces.
In-page island
Your own module, fully trusted, like the rest of the site's code.
Framed island
A sandboxed frame with scripts and nothing else. The default for a package.
Not stopped
An in-page island can read the sign-in key. A framed island can leak the rows it was granted, and WebRTC from a frame is open (measured in Chromium; Safari and Firefox not run).
Packages from others.
A package is components and islands another author wrote, at an exact version or commit.
Disclosure
culm approve shows a person what the package holds, and asks for its name, typed. Nothing of the package runs when it is added.
Lock file
The decision lives in the lock file, which the build enforces. It needs code review like any file that changes what runs.
Agents
An agent can ask for a package; it cannot approve one.
What approval is not
Approval is a disclosure, not a safety review. A shell with a pseudo-terminal could still approve a package, as it could edit the lock file by hand.
The rest of Culm