Files
bare-operating-system/packages/bare-os-booter/test.hrpc-allowlist.js
T
Raven Scott ae6f1cf8ac Implement the 20-task Bare OS POSIX + P2P roadmap: holepunch lockfile drift
reporting and audit:holepunch-clones docs; placeholder baseline automation;
maintainer kernel-image sync script; protomux schema coupling in protocol
tests; disk.os RPC hints (replication_operator_sketch, hyperblobs/blind v3);
union/mirror VFS + warm-cache selective eviction tests; extension resolver
coverage; curl/wget fall through PATH when BARE_OS_DELEGATE_ALLOW excludes
delegates (kernel-runner) with handbook/ctx docs; socket contract / Wasm /
boot budget strict path / hrpc allowlist tests; subprocess bridge meta;
shell until gate + tar stat metadata; POSIX profile triplet pretest verifier;
regenerate kernel bundle, seeder parity, and audit artifacts as needed.

Covers KERNEL_CONTRACT, POSIX_DECLARED_PROFILE, handbook, developer-guide,
scripts/README, and related reference docs.
2026-04-05 02:21:07 -04:00

37 lines
1.2 KiB
JavaScript

import test from 'brittle'
import {
parseBareOsHrpcAllowlistJson,
bareOsHrpcAllowlistDeniesRoute
} from './lib/bare-os-hrpc-allowlist.js'
test('parseBareOsHrpcAllowlistJson array and object forms', (t) => {
const a = parseBareOsHrpcAllowlistJson('["kernel.ping","vfs.readText"]')
t.ok(a.allow)
t.ok(a.allow.has('kernel.ping'))
t.ok(a.allow.has('vfs.readText'))
t.absent(a.parseError)
const o = parseBareOsHrpcAllowlistJson(
JSON.stringify({ 'kernel.*': true, 'x.y': false })
)
t.ok(o.allow)
t.ok(o.allow.has('kernel.*'))
t.absent(o.allow.has('x.y'))
})
test('parseBareOsHrpcAllowlistJson malformed JSON', (t) => {
const r = parseBareOsHrpcAllowlistJson('{')
t.ok(r.parseError)
t.absent(r.allow)
})
test('bareOsHrpcAllowlistDeniesRoute wildcard edges', (t) => {
const s = new Set(['*'])
t.absent(bareOsHrpcAllowlistDeniesRoute(s, 'any', 'method'))
const k = new Set(['kernel.*'])
t.absent(bareOsHrpcAllowlistDeniesRoute(k, 'kernel', 'ping'))
t.ok(bareOsHrpcAllowlistDeniesRoute(k, 'vfs', 'readText'))
const exact = new Set(['vfs.readText'])
t.absent(bareOsHrpcAllowlistDeniesRoute(exact, 'vfs', 'readText'))
t.ok(bareOsHrpcAllowlistDeniesRoute(exact, 'vfs', 'other'))
})