Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TRUST-022

Each page gets a fresh nonce that every extension script and style carries

When the extension builds a page, it SHALL draw a nonce of 18 random bytes encoded as base64url for every page it builds, give it to every script and style element it writes except the inert JSON element of the boot context, keep the nonce of the loaded page when it applies a render as a content patch, and replace the nonce of a patched record by a fresh one before it loads the record as a new document.

Part of StRS-MDOKFSTUDIO-TRUST-006, outside the paths drawn on its map.

Scenarios 5

The situations the tests check; open one to read it.

nominalFresh nonce of 18 bytes
InputOutcome
Two builds of the same document, the nonces comparedThey differ
Any nonce, measuredIt is 24 base64url characters, the encoding of 18 bytes
nominalElements that carry the nonce
InputOutcome
A rendered page, builtThe runtime script and the accessibility style element carry the page nonce
A page with a raw HTML table style and a maths blockTheir style elements carry the page nonce, and the JSON context element carries none
nominalBoot context as inert JSON
InputOutcome
A document id that contains a closing script tag followed by a script element, the context serializedThe output contains no closing script tag
The same context with a less-than sign in a path, parsed by the page as JSONThe original path comes back, because the sign is written as a unicode escape
nominalContent patch keeps the nonce
InputOutcome
A loaded page and a new render of the same document, applied as a content patchThe record of the page carries the nonce of the loaded page
Two renders of one document type, their page shells comparedThe shells are equal although the nonces differ
refusalPatched record loaded as a new document
InputOutcome
A page that received content patches and is created again by VS Code, or whose patch is not acknowledged; the host loads its record as a new documentThe nonce of the record differs from every earlier nonce of the preview
A record that never kept the nonce of a loaded page, loaded by the hostIts nonce is kept

Implemented in 5

Tested by 6