Policy hash: the one value the person supplies
A mockup of experiment E02, in your browser. Paste a v0 Process Behaviour Policy; it is canonicalised (keys sorted, no whitespace, UTF-8, integers only) and hashed with SHA-256 by your browser's WebCrypto. The result must equal what sharness-ai policy hash prints for the same file. Nothing leaves the page.
Check it against the CLI
$ pip install git+https://github.com/SHarness-AI/SHarness-AI__CLI@dev
$ sharness-ai policy hash experiments/policies/deny-all-example.json
sha256:ab1d3e4e779313274f7a1d3ef3e46f6eacef038d8cfaa6198151a45cd82dcc76
Load the deny-all example above: the hash must be the same. Change one character in the policy and it is not. The CLI's test suite pins this vector, so a change to either side fails a build.
The canonical form
- Object keys sorted by code point, recursively. No whitespace. Separators
,and:. - Strings as JSON with the short escapes (
\n,\", …) and non-ASCII kept as UTF-8, which is what bothJSON.stringifyand Python'sjson.dumps(ensure_ascii=False)do. - Integers, booleans and null only. Floats are refused, because that is the one place the two languages' number formatting differs. RFC 8785 (JCS) is the target; v0 sidesteps its hardest clause by not needing it.
- The hash is
sha256:followed by 64 lower-case hex characters.
The v0 shape
Six keys: pbp (1), id, an optional layer and notes, files with read, write and exec lists of absolute paths, network as "none" or {"connect_tcp_ports": […]}, and process with no_new_privs: true. It is what sharness-ai run enforces with Landlock. The full schema it grows towards is on Policies §4.