Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ model does not sanction.
| ID | Level | Statement |
| --- | --- | --- |
| `FA-91` | `build` | A private workspace opens only for the Prism id that owns it, on a device with a live session and its current boundary key; a record is read only when authentic and in place and stored only sealed; the workspace kept before an id moves in once; and Foundry's Prism kernel names every refusal |
| `FA-93` | `build` | Studio keeps a visitor's work sealed to their Prism ID: each record is sealed as it is stored and opened as it is read, only as Foundry's Prism kernel answers; the work kept before moves in once; a removed device's work is cleared; and the visitor is told each outcome in one sentence |

## product-model

Expand Down
5 changes: 3 additions & 2 deletions app/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,11 @@
},
{
"name": "Prism id",
"text": "The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.",
"text": "The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal, and Studio keeps the visitor's work sealed to it.",
"ids": [
"FA-88",
"FA-91"
"FA-91",
"FA-93"
],
"calls": [
"FoundrySpecification::prismIdBoundary",
Expand Down
9 changes: 8 additions & 1 deletion app/src/Features.lex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,13 @@
body: "crates/conformance/tests/in_tab_kernel_verdict.rs::private_workspace_fa_91"
}

definition{
name: testFA93,
parameters: [],
result: String,
body: "crates/conformance/tests/in_tab_kernel_verdict.rs::private_workspace_fa_93"
}

definition{
name: testFA61,
parameters: [],
Expand Down Expand Up @@ -1680,7 +1687,7 @@
name: featurePrismId,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88, FA-91): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal.", calls := (cons "FoundrySpecification::prismIdBoundary" (cons "Workspace::dispatchWorkspace" (nil String))), acceptance := (cons "Features::acceptWorkspaceProofsWorkspaceWordsOwnerOpens" (cons "Features::acceptWorkspaceProofsWorkspaceWordsAnotherIdRefused" (cons "Features::acceptWorkspaceProofsWorkspaceWordsTamperedRecordRefused" (cons "Features::testFA88" (cons "Features::testFA91" (nil String))))))})
body: (record Foundation.Arch::Feature {statement := "Prism id (FA-88, FA-91, FA-93): The frame keeps one Prism id per visitor, stitch's, made on first touch with no sign-in; a session verifies only for its app, an active device and its time, and linking, removal and recovery are quiet panel actions over stitch's relay; the kernel opens a private workspace only for that id and names every refusal, and Studio keeps the visitor's work sealed to it.", calls := (cons "FoundrySpecification::prismIdBoundary" (cons "Workspace::dispatchWorkspace" (nil String))), acceptance := (cons "Features::acceptWorkspaceProofsWorkspaceWordsOwnerOpens" (cons "Features::acceptWorkspaceProofsWorkspaceWordsAnotherIdRefused" (cons "Features::acceptWorkspaceProofsWorkspaceWordsTamperedRecordRefused" (cons "Features::testFA88" (cons "Features::testFA91" (cons "Features::testFA93" (nil String)))))))})
}

definition{
Expand Down
27 changes: 25 additions & 2 deletions crates/conformance/tests/in_tab_kernel_verdict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ fn in_tab_kernel_verdict_fa_86() {
);
// A run that skipped, filtered or lost a test is not the oracle.
for required in [
"# tests 7",
"# pass 7",
"# tests 8",
"# pass 8",
"# fail 0",
"# cancelled 0",
"# skipped 0",
Expand Down Expand Up @@ -69,3 +69,26 @@ fn private_workspace_fa_91() {
);
assert!(theorems >= 19 && kernel.contains("(workspaceAcceptance))))"));
}

/// `FA-93`: Studio keeps a visitor's work sealed to their Prism ID: each record is sealed as it is stored and opened as it is read, only as Foundry's Prism kernel answers; the work kept before moves in once; a removed device's work is cleared; and the visitor is told each outcome in one sentence
///
/// Here, every request Studio's sealed store makes, asked of the guest Studio pins; the sealing itself runs in
/// Chromium in Studio CI (`studio/tools/storage_request_browser.mjs`), where the shell is built.
#[test]
fn private_workspace_fa_93() {
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..");
let output = Command::new("node")
.args(["--test", "--test-reporter=tap"])
.arg(root.join("studio/tools/in_tab_kernel_verdict.test.mjs"))
.output()
.expect("the locked SDK supplies Node");
let report = String::from_utf8_lossy(&output.stdout);
let name = "the pinned guest answers every workspace request Studio makes, as Studio acts on it (FA-93)";
assert!(
output.status.success()
&& report
.lines()
.any(|l| l.starts_with("ok ") && l.ends_with(name)),
"{report}"
);
}
11 changes: 11 additions & 0 deletions features/suites/private-workspace.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ Feature: private-workspace
Then it answers ok only for the owning id on a device with a live session and the current boundary key, for an authentic record in its place, for a sealed record within quota, for a first move, and for a removal after the sealed copy is committed
And every other request is refused by name, a removed device first, and a wrong version, a trailing word or an unknown kind is malformedWorkspaceRequest
And each answer is a theorem Lean proves by evaluation and an acceptance vector the compiled guest replays

@FA-93 @build
Scenario: Studio keeps a visitor's work sealed to their Prism ID: each record is sealed as it is stored and opened as it is read, only as Foundry's Prism kernel answers; the work kept before moves in once; a removed device's work is cleared; and the visitor is told each outcome in one sentence
Given Studio's device store, the workspace key the Prism frame keeps for this origin, and the kernel guest Studio pins
When Studio opens over work kept before the workspace, reads and stores records, meets a record altered, copied or planted in the clear, and opens on a device removed from the visitor's Prism ID
Then the work kept before is sealed in place in one transaction, opens as it was written, and the visitor is told so once
And every record stored afterwards is sealed with seal_bytes, except the grants and published .holo bytes the service worker reads
And an altered or planted record is refused as recordTampered and a copied one as recordMisplaced, and neither is returned
And on a removed device everything kept where work belongs is cleared before a new key is made, so nothing left behind enters the new workspace
And the sentence the visitor reads for each answer is a statement of the experience module

20 changes: 10 additions & 10 deletions frame.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"spec": "prism/frame-lock/1",
"source": {
"repository": "UOR-Foundation/template",
"commit": "0851bb41138041f0f75118135fd8a342109c2d73",
"raw": "https://raw.githubusercontent.com/UOR-Foundation/template/0851bb41138041f0f75118135fd8a342109c2d73/"
"commit": "975f95cc4be0380a5c9ae01f71555e4df1e0e230",
"raw": "https://raw.githubusercontent.com/UOR-Foundation/template/975f95cc4be0380a5c9ae01f71555e4df1e0e230/"
},
"files": [
{
Expand Down Expand Up @@ -116,19 +116,19 @@
},
{
"path": "frame/frame.css",
"sha256": "c7470fdcbdb0ca9c6e2a634b6ec4ba9f1ed87c39b737f91e082b8c6466ab91f4"
"sha256": "ac8c9cfe2f1e7fe0c7c3725c840e0296fae76314521860d7840ce66876f65869"
},
{
"path": "frame/frame.mjs",
"sha256": "208994058dcc6c70a91d590c345cb4956eda3532096f298f0a21f809f11672c1"
"sha256": "e9c02c8355cf3fb6dea3801e7ea5fa84adab0a117198ed39418ce3ea83930156"
},
{
"path": "frame/panels.css",
"sha256": "9b6bcd85303139ddaac9b2cbde7b7d3ef61d34da336874774073124b2560d8ce"
"sha256": "c6faa6a4ddf50444ca887a60e18530390ed52adf38a9d69fb257d3ed7254eb7d"
},
{
"path": "frame/panels.mjs",
"sha256": "f2db1617f0a6d14e4447c54bafc7aeb45c7cb152b0f5a0b27b5615f8ce8d7b92"
"sha256": "4eb0dea50cd91a1dce08a459b80b96a5c34d89eec85fedfdf168c5644f7b92a9"
},
{
"path": "frame/publish.mjs",
Expand All @@ -152,11 +152,11 @@
},
{
"path": "identity/PROTOCOL.md",
"sha256": "1e3a042a4a100683e0df5bc8210c367785e844feb63cd561d591979733e7ff82"
"sha256": "a66215423f8bf70ffbb52e2d9a96f04cb8baa922d2c5adf999be14a491dc382b"
},
{
"path": "identity/README.md",
"sha256": "351d9387fbc8fac0123f13a2e03e03aba8a4c0aed8e38f6040973bec4246fef1"
"sha256": "8a22ec0478abadd3e3522a288c80da1dabea462b8485c6169941ebc3003c2a28"
},
{
"path": "identity/dev.mjs",
Expand All @@ -176,15 +176,15 @@
},
{
"path": "identity/test.mjs",
"sha256": "21cb6924014c80f378abf5d07720a203c7e62aa99ffd38e05f6d8376153317f9"
"sha256": "fd771e403d0391846fe8e666c2026d01026d47c78de709ac21171b82737f1cf1"
},
{
"path": "lighthouserc.json",
"sha256": "85aa0f6219cb8396b34f5b461c1d4d7b149e4cc1674cbd2f0100c5b5e16636d9"
},
{
"path": "site/app.mjs",
"sha256": "b5b30e78ab9b693fd6d29b89b9d2b74542340542864e99e4533a9ced2d987ee0"
"sha256": "65a3d1e3fcc6ed9ddfcbf85477c99a41a94a98502e62de90e7dcce3f860b0ace"
},
{
"path": "site/guest-worker.mjs",
Expand Down
6 changes: 3 additions & 3 deletions frame/frame.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
* edge is the bar's bottom edge. */
--chrome: var(--sidebar, var(--muted));
/* The address: on the light chrome a white field, on the dark one barely
* off the chrome, its hairline drawing it. */
* off the chrome, its hairline drawing it at 3:1 or more (WCAG 1.4.11). */
--field: light-dark(var(--card), color-mix(in oklab, var(--chrome), var(--foreground) 3%));
--field-border: var(--border);
--field-border: var(--muted-foreground);
--gutter: 0.5rem;
--window-radius: 0.75rem;
--frame-height: calc(var(--safe-top) + var(--bar-control) + 0.875rem);
Expand Down Expand Up @@ -230,7 +230,7 @@ svg.gh, svg.fill { fill: currentColor; stroke: none; }
* full text colour: white on the dark chrome, near-black on the light, as
* Hologram OS draws it. A touch larger than the line icons, so its dots
* stay distinct. */
#home { color: var(--foreground); }
#home { color: var(--foreground); } #home:focus-visible { outline: var(--ring-width) solid var(--ring); outline-offset: var(--ring-offset); border-radius: var(--radius-control); }
#home svg.mark { width: 1.25rem; height: 1.25rem; shape-rendering: geometricPrecision; }
.ghost.icon:hover { color: var(--foreground); }
.ghost.icon:hover::before { background: color-mix(in oklab, var(--chrome), var(--foreground) 7%); }
Expand Down
20 changes: 15 additions & 5 deletions frame/frame.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ const firstMove = () =>
// which publish.mjs writes here.
// It is fetched after the first move, checked against that hash as the page
// checks the frame, and imported; a failure is tried again the next time.
// Unpublished (a checkout, or an app that bundles its locked copy of the
// frame), it is imported from beside this file, as panels.mjs imports Prism id.
const PANELS = "/*PANELS*/";
let panelsModule = null;
let panelsSheet = null;
const loadPanels = () =>
(panelsModule ??= (async () => {
if (!/^[0-9a-f]{64}$/.test(PANELS)) throw new Error("this frame was published without its panels");
if (!/^[0-9a-f]{64}$/.test(PANELS)) return import("./panels.mjs");
const bytes = await (await fetch(new URL(`${PANELS}/prism-panels.mjs`, FRAME_HOST))).arrayBuffer();
const hex = Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", bytes)), (b) => b.toString(16).padStart(2, "0")).join("");
if (hex !== PANELS) throw new Error("the panels module is not the one this frame names");
Expand Down Expand Up @@ -187,7 +189,7 @@ const markup = (e) => `
<span id="bar-status" class="sr" aria-live="polite"></span>
<button id="theme" class="ghost icon" type="button" popovertarget="theme-panel" aria-label="Theme" title="Theme"><svg class="moon" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z" /></svg><svg class="sun" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" /></svg><svg class="photo" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><rect x="3" y="4.5" width="18" height="15" rx="2.5" /><circle cx="9" cy="10" r="1.75" /><path d="m3.5 17 5-4.5 3.5 3 3-2.5 5.5 4.5" /></svg></button>
<button id="fullscreen" class="ghost icon" type="button" aria-label="Enter full screen" title="Full screen"><svg class="expand" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M4 9V5.5A1.5 1.5 0 0 1 5.5 4H9M15 4h3.5A1.5 1.5 0 0 1 20 5.5V9M20 15v3.5a1.5 1.5 0 0 1-1.5 1.5H15M9 20H5.5A1.5 1.5 0 0 1 4 18.5V15" /></svg><svg class="shrink" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M9 4v3.5A1.5 1.5 0 0 1 7.5 9H4M20 9h-3.5A1.5 1.5 0 0 1 15 7.5V4M15 20v-3.5a1.5 1.5 0 0 1 1.5-1.5H20M4 15h3.5A1.5 1.5 0 0 1 9 16.5V20" /></svg></button>
<button id="account" class="ghost icon" type="button" popovertarget="account-panel" aria-label="Prism id" title="Prism id"><svg class="person" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><circle cx="12" cy="8" r="3.5" /><path d="M5 20c0-3.6 3.1-6 7-6s7 2.4 7 6" /></svg></button>
<button id="account" class="ghost icon" type="button" popovertarget="account-panel" aria-label="Prism ID" title="Prism ID"><svg class="person" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><circle cx="12" cy="8" r="3.5" /><path d="M5 20c0-3.6 3.1-6 7-6s7 2.4 7 6" /></svg></button>
</div>
</div></div>
<div id="trust-panel" class="trust-panel" popover aria-labelledby="trust-title">
Expand Down Expand Up @@ -846,6 +848,13 @@ class PrismFrame extends Element {
return { signature: b64u(signature), delegation: saved.delegation };
}

// This app's workspace key: 32 bytes only a device of the visitor's Prism
// id opens (panels.mjs, openWorkspace). { replace: true } starts a new one.
workspaceKey(options) {
if (!this.accountsReady) return Promise.reject(Object.assign(new Error("A Prism ID cannot work here"), { name: "IdentityError", code: "unsupported" }));
return this.accountsReady().then((accounts) => accounts.workspace(options));
}

// The Prism id icon, after full screen: a line drawing until the id is
// ready, filled once it is. The id is made, and this app's session signed,
// with nothing to click and nothing in the way, by the panels module
Expand All @@ -857,15 +866,15 @@ class PrismFrame extends Element {
const button = this.$("account");
const panel = this.$("account-panel");
this.accountWatch?.abort();
this.accountReady = null;
this.accountReady = this.accountsReady = null;
let wired = false;
if (typeof panel.showPopover !== "function" || !window.isSecureContext || !globalThis.crypto?.subtle || !globalThis.indexedDB) {
button.hidden = true;
return;
}
const paint = () => {
const saved = accountChannel.session;
const label = "Prism id";
const label = "Prism ID";
button.classList.toggle("signed-in", Boolean(saved));
button.setAttribute("aria-label", label);
button.title = label;
Expand All @@ -891,6 +900,7 @@ class PrismFrame extends Element {
}
return this.accountReady;
};
this.accountsReady = ready;
const reach = () => ready().then((accounts) => accounts.reach(), () => {});
for (const type of ["pointerenter", "focus", "touchstart"]) button.addEventListener(type, reach, { passive: true });
// First use: the visitor's first touch, click or key anywhere makes the id.
Expand Down Expand Up @@ -1357,7 +1367,7 @@ class PrismFrame extends Element {
event.preventDefault();
if (list.hidden) render();
select(active + (event.key === "ArrowDown" ? 1 : -1));
} else if (event.key === "Escape") {
} else if (event.key === "Tab" && !event.shiftKey) { close(); } else if (event.key === "Escape") {
event.preventDefault();
if (input.value !== shown) {
input.value = shown;
Expand Down
Loading
Loading