4 lines
1.8 KiB
JavaScript
4 lines
1.8 KiB
JavaScript
import { readFile } from 'node:fs/promises'
|
|
import { resolve } from 'node:path'
|
|
const root = resolve(new URL('..', import.meta.url).pathname); const report = JSON.parse(await readFile(resolve(root, 'config/chrome-script-verification.json'), 'utf8')); if (report.schemaVersion !== 1 || report.status !== 'pass' || report.browserId !== 'chrome' || !/Chrome/i.test(report.browser?.product || '') || report.crossOriginIsolated !== true) throw new Error('Chrome script sandbox verification is not passing.'); if (report.macro?.commands !== 2 || report.macro.replay !== 'replayed' || report.macro.executed !== 2 || report.macro.bytes <= 0) throw new Error('Script macro replay evidence is incomplete.'); if (!report.security?.disallowedRejected || !report.security.quotaRejected || !report.security.noDynamicExecution || JSON.stringify(report.security.deniedCapabilities) !== JSON.stringify(['file', 'network', 'time', 'resource'])) throw new Error('Script file/network/time/resource permission evidence is incomplete.'); if (report.persistence?.mode !== 'sqlite-opfs' || report.persistence.byteLength <= 0 || report.persistence.roundTrip !== true || report.persistence.released !== true) throw new Error('Script OPFS resource evidence is incomplete.'); if (report.opfs?.markerSuite !== 'SCRIPT-ALL' || report.opfs.commands !== 2 || report.opfs.markerRemoved !== true) throw new Error('Script OPFS marker evidence is incomplete.'); if (report.afterRelease?.shapeCount !== 0 || report.afterRelease.kernelReferenceCount !== 0) throw new Error('Script harness leaked ShapeHandles.'); console.log(JSON.stringify({ status: 'chrome-script-pass', browser: report.browser.product, macro: report.macro, security: report.security, persistence: report.persistence, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
|