Skip to content

Commit ea746eb

Browse files
committed
fix: remediate foundation pentest findings and prepare retest
1 parent 113404c commit ea746eb

45 files changed

Lines changed: 1173 additions & 457 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
Pentest remediation (2026-10-03): addressed the browser origin threat-model gap,
4+
assigned profile/header/independent offline verification owners, replaced
5+
optimization-removable smoke assertions, and verified native probes using the
6+
live child's announced ephemeral port. Added adversarial regressions and fixed
7+
angle-bracket Markdown link checking. All 34 Python tests and optimized actual
8+
native/container probes pass; maintainer retest is pending, not pentest PASS.
9+
10+
Foundation handoff (2026-10-03): reverified the v0.1.0 scope, common gates,
11+
dependency/freshness checks, real native/container probes and service restart;
12+
refreshed the SBOM and documented known limits for the maintainer's pentest.
13+
The release loop now commits only after their green result, waits for GitHub,
14+
and tags/pushes a version tag only on explicit instruction. Pentest is NOT RUN.
15+
316
## Unreleased — 0.1.0 foundation candidate
417

518
- Initialized EUPL-1.2/Rust 1.99.0 workspace with five no_std boundary crates

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ external network operations are distinct explicit actions.
2626
**Current status:** repository foundation, development health probe and
2727
service-test tooling. No workbench, transformation operation, browser UI,
2828
production HTTP server or CyberChef parity is implemented yet. `0.1.0` is an
29-
unpublished foundation candidate, with pentest pending.
29+
unpublished foundation candidate, with pentest remediation complete and
30+
maintainer retest pending. See the [remediation report](security/pentest/v0.1.0.md).
3031

3132
The [release plan](docs/RELEASE_PLAN.md) defines 386 small pre-1.0 passes,
3233
through `0.386.0`, with further versions whenever needed. `1.0.0` is the first

‎SECURITY.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Run scripts/checks.sh, current freshness checks, cargo deny check and cargo audi
1313
to the feature being claimed. Keep security docs, limitations, CHANGELOG and
1414
release notes with each pass. Every minor/patch/RC/tag needs an exact-source
1515
pentest and tested remediation; NOT RUN never qualifies as PASS.
16+
The maintainer performs that pentest. Commit new candidate work only after their
17+
green result; GitHub failures follow the fix/report/retest loop in the runbook.
1618

1719
See [release runbook](docs/RELEASE_RUNBOOK.md), [threat model](docs/threat-model.md)
1820
and [controls](docs/security-controls.md). GitHub uses CodeQL **Default setup**;

‎crates/runasmidja-server/src/main.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ fn main() -> std::io::Result<()> {
2525
};
2626
let listener = TcpListener::bind((address, port))?;
2727
println!("Runasmidja development probe on {}", listener.local_addr()?);
28+
std::io::stdout().flush()?;
2829
for connection in listener.incoming() {
2930
let Ok(mut stream) = connection else { continue };
3031
stream.set_read_timeout(Some(Duration::from_secs(2)))?;

‎docs/ARCHITECTURE.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ artifacts. Authenticated decryption stays staged until final integrity succeeds.
5656

5757
## Privacy and UI
5858

59+
An owning page and its delivered worker code share the website trust boundary.
60+
A Dedicated Worker does not protect input from origin/CDN/deployment compromise.
61+
Use separate hosted local-only, independently verified offline/network-disabled,
62+
and explicit remote origins/applications as defined in
63+
[browser security profiles](BROWSER_SECURITY_PROFILES.md). CSP/Trusted Types and
64+
COOP/COEP/CORP are defense in depth, not proof that compromised code is trustworthy.
65+
5966
Serve a normal online website. Default processing happens in a real Dedicated
6067
Worker. Network/upload, local persistence, sharing and secret use are separate
6168
capabilities. Failure never silently uploads. Generated descriptor metadata

‎docs/BROWSER_PERFORMANCE.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ See [versioned owners](gap-reconciliation-2026-10-03.md) and
66

77
## Worker, UI and cancellation
88

9+
The owning origin/page remains trusted; a Dedicated Worker cannot prevent a
10+
malicious page reading input or replacing code. Apply the separate local-only,
11+
offline/network-disabled and remote origin contracts, exact document/worker
12+
headers and real browser negatives in
13+
[browser security profiles](BROWSER_SECURITY_PROFILES.md). Pack/Wasm loading
14+
must work under connect-src none rather than widening it for Fetch convenience.
15+
916
Keep an accessible Rust DOM UI with the linear input/recipe/output workflow,
1017
manual Run, descriptor-generated forms, keyboard editing and bounded pages.
1118
Leptos remains an outer-adapter candidate selected at current reviewed admission.

‎docs/BROWSER_SECURITY_PROFILES.md‎

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Browser Security Profiles
2+
3+
Status: reviewed design remediation for the v0.1.0 pentest. Product browser
4+
profiles and header enforcement are not implemented in this foundation.
5+
6+
## Trust boundary
7+
8+
A Dedicated Worker is an execution/responsiveness boundary, not protection from
9+
a malicious owning page. Compromise of the website origin, CDN, deployment
10+
account or served JavaScript can read input before the worker receives it,
11+
change the worker and alter policies. Same-origin asset hashes checked by that
12+
page do not make the page independently trustworthy. CSP and cross-origin
13+
isolation provide defense in depth; they cannot repair a compromised origin.
14+
This follows the browser's page/worker trust model in the
15+
[HTML worker specification](https://html.spec.whatwg.org/multipage/workers.html).
16+
17+
Browser extensions and a compromised browser/OS are outside application defense.
18+
No hosted website is represented as a safe place for classified data merely
19+
because transforms run locally. The high-assurance profile below needs an
20+
independently verified artifact and a separately enforced network-disabled host.
21+
It cannot promise classification accreditation or protect a compromised host.
22+
23+
## Separate profiles
24+
25+
| Profile | Code custody and capabilities | Confidentiality limits |
26+
| --- | --- | --- |
27+
| Hosted local-only | Dedicated origin/application; local transforms only; no remote execution, network-capable transformations, accounts, sharing or payload telemetry | The origin and delivered code remain trusted. Static asset requests are permitted; payloads never enter them. This is not protection from origin compromise. |
28+
| Verified offline/local-only | Signed, immutable bundle with reviewed UI/worker/Wasm/packs/models/fonts and manifest; independently verified before launch; local launcher/origin plus host network disabled | Verify signature and expected signer using an independently obtained trust anchor/tool, outside downloaded JavaScript. No online updates/service worker/CDN or fallback while processing. The trusted browser/OS/verifier and custody remain assumptions. |
29+
| Explicit remote | Separate origin/application with its own UI, session and remote API capabilities | The user deliberately imports/discloses input there. Consent is specific to destination/effect; server processing has the server trust/retention boundary. |
30+
31+
Origins differ by host/scheme/port, not path prefixes. Local-only and remote
32+
profiles share no cookies, storage, service worker, opener, ambient grants or
33+
automatic payload postMessage bridge. Links to the remote application carry no
34+
payload in URLs/referrers and open with no opener. Explicit file export/import
35+
can cross the boundary only with deliberate user action. Missing local providers
36+
or unsupported network operations report an error; they cannot switch profiles.
37+
38+
High-assurance use selects the independently verified offline distribution;
39+
switching to remote processing ends that profile's confidentiality boundary.
40+
Signature/manifest verification happens before any code executes. Update, import,
41+
artifact substitution, stale service worker and untrusted signing key tests must
42+
fail closed. Signing credentials follow the OpenBao release-secret policy.
43+
44+
## Local-only HTTP policy
45+
46+
The following is an enforced baseline contract, not a report-only policy.
47+
Send the document CSP and appropriate isolation/resource headers on worker and
48+
module responses too; the owning page's CSP alone does not qualify worker
49+
execution. Frame restrictions must be HTTP headers, not only HTML meta tags.
50+
Do not add reporting endpoints that could disclose URLs or user material.
51+
Browser behavior is qualified against [CSP3](https://www.w3.org/TR/CSP3/).
52+
53+
Document CSP, as a single header value:
54+
55+
```text
56+
default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; style-src 'self'; img-src 'self' blob:; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; require-trusted-types-for 'script'; trusted-types runasmidja-static
57+
```
58+
59+
Worker CSP uses the same script/connect/default restrictions. Nested workers
60+
are forbidden with `worker-src 'none'` unless a later bounded pass qualifies
61+
an explicit same-origin worker topology; no blob/data worker or script URL is
62+
admitted. Blob images are only inert bounded raster previews; active HTML/SVG
63+
previews need the separately isolated preview contract. No inline script,
64+
JavaScript eval, wildcard/third-party assets, remote fonts or external images.
65+
66+
| Header | Exact baseline value |
67+
| --- | --- |
68+
| Cross-Origin-Opener-Policy | `same-origin` |
69+
| Cross-Origin-Embedder-Policy | `require-corp` |
70+
| Cross-Origin-Resource-Policy | `same-origin` |
71+
| X-Frame-Options | `DENY` |
72+
| X-Content-Type-Options | `nosniff` |
73+
| Referrer-Policy | `no-referrer` |
74+
| Permissions-Policy | `camera=(), microphone=(), geolocation=(), display-capture=(), usb=(), serial=(), hid=(), bluetooth=(), payment=(), clipboard-read=(), clipboard-write=(self), web-share=()` |
75+
76+
Self-only clipboard writing still requires the explicit reviewed disclosure
77+
grant/user action from 0.27.0; default processing never writes to the clipboard.
78+
The network-disabled host may additionally forbid clipboard export. This header
79+
permission is not application consent and does not authorize automatic copying.
80+
81+
Serve exactly one valid COOP/COEP value, including errors/redirects as applicable;
82+
duplicated or malformed values can weaken the policy. See the
83+
[HTML isolation policy](https://html.spec.whatwg.org/multipage/browsers.html#cross-origin-embedder-policy),
84+
[Fetch CORP definition](https://fetch.spec.whatwg.org/#cross-origin-resource-policy-header)
85+
and [Permissions Policy specification](https://www.w3.org/TR/permissions-policy/).
86+
Platform support varies; record actual effective restrictions per browser.
87+
88+
The single named Trusted Types policy may create only static reviewed
89+
same-origin script/worker URLs from the immutable asset manifest. No default
90+
policy, user-controlled URLs, identity HTML conversion or arbitrary script
91+
conversion. UI rendering uses inert DOM/text operations; framework admission
92+
must prove compatibility. See [Trusted Types](https://www.w3.org/TR/trusted-types/).
93+
Unsupported enforcement is a documented profile limitation; a browser lacking
94+
required controls does not qualify for the high-assurance profile.
95+
96+
`connect-src 'none'` blocks Fetch/XHR/WebSocket/EventSource/beacon paths, including
97+
ordinary Wasm/pack fetches. Load required verified Wasm bytes through reviewed
98+
static modules/embedded bytes and offline bundled assets; measure their cost.
99+
Do not weaken connect-src to accommodate a loader. No payload-bearing URLs,
100+
navigation, forms, resource names or CSP reports are permitted. CSP alone does
101+
not block every possible navigation or malicious same-origin script effect;
102+
host network disablement is essential to the offline high-assurance boundary.
103+
104+
## Versioned implementation and verification owners
105+
106+
| Owner | Required implementation and runtime evidence |
107+
| --- | --- |
108+
| 0.14.0 executable seed | Local-only test origin; document/worker CSP and headers before entering seed input; real browser checks for worker startup/Wasm compatibility and absent payload network effects. No public/high-assurance claim. |
109+
| 0.27.0 privacy | Separate capability/origin profiles, no automatic remote bridge/fallback, sensitivity and explicit export/import disclosure. Sentinel payloads never enter URLs/storage/telemetry or ambient cross-origin transfers. |
110+
| 0.28.0 first browser workbench | Enforce document/worker CSP, named Trusted Types policy, COOP/COEP/CORP, framing and Permissions Policy. Actual Chromium/Firefox/WebKit negatives for Fetch/XHR/beacon/socket/EventSource, external workers/resources, injected HTML/script/URLs, frames/opener, permissions and remote bridging; test effective policy, not just response text. |
111+
| 0.31.0 pack loader | Demonstrate worker/Wasm/lazy loading under connect-src none without widening policy or using payload resource paths; tampered/absent/offline packs fail safely. |
112+
| 0.101.0 offline packaging | Implement signed immutable bundle and independent pre-launch verifier/launcher with correct HTTP policies; test clean network-disabled host, no update/service-worker/CDN requests, bad signature/key/manifest and substituted assets. No high-assurance support before this profile qualifies. |
113+
| 0.133.0 server security | Qualify the separate remote origin/session/CORS/CSRF/opener/storage boundary with explicit disclosure and no local-origin authority bridge before exposing remote jobs. |
114+
| 0.366.0–0.367.0 packaging/provenance | Bind exact offline/local/remote artifact identities and reviewed signer/verifier trust to assessment/SBOM/target evidence; recheck signature/substitution/rollback and network-disabled launch on release artifacts. |
115+
116+
Every owner retains original acceptance. Later plugin, pack, preview, cache and
117+
UI changes rerun affected profile negatives. No mock or roadmap test can attest
118+
browser enforcement, signature trust or offline network disablement.

‎docs/IMPLEMENTATION_PLAN.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ The [gap reconciliation](gap-reconciliation-2026-10-03.md) records verified gaps
1717
corrections and actual version owners. All 240 reference acceptances remain,
1818
with additive strict verification and the [G0–G7 contract](VERIFICATION_GATES.md).
1919

20+
Use the maintainer's [release loop](RELEASE_RUNBOOK.md): build and verify, stop
21+
for their pentest, fix/retest until green, then commit locally. They push; repeat
22+
the GitHub fix loop until green and wait for their explicit tag/push instruction.
23+
24+
The [browser security profiles](BROWSER_SECURITY_PROFILES.md) close the origin
25+
threat-model gap: separate local/remote origins, independently verified signed
26+
offline artifacts with network-disabled execution, and explicit document/worker
27+
header owners from the seed through packaging. Workers alone provide no origin
28+
compromise protection; no high-assurance browser support is claimed now.
29+
2030
## Engineering rules
2131

2232
- Pin current stable Rust 1.99.0, edition 2024/resolver 3. The compiler floor

‎docs/RELEASE_PLAN.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ If mandatory gaps remain after 0.386.0, actual additional passes start at **v0.3
2525

2626
## Every release gate
2727

28+
The [browser security profiles](BROWSER_SECURITY_PROFILES.md) define origin-compromise limits, separate local-only/remote applications and independently verified signed offline artifacts with network-disabled execution. Explicit seed/privacy/workbench/loader/offline/server/packaging owners qualify document/worker CSP, Trusted Types, COOP/COEP/CORP, framing and permissions; no browser enforcement is claimed by the foundation.
29+
2830
Run `scripts/checks.sh`, current dependency/license/advisory checks, freshness, applicable browser/reference/service/fuzz/fault suites and artifact SBOM generation. Update threat controls, limitations, parity evidence, CHANGELOG and release notes. Every numbered minor, patch, RC and 1.0 needs its own exact-source pentest, remediation and clean retesting before tagging; passing tests alone do not authorize a PASS report.
2931

30-
The [release runbook](RELEASE_RUNBOOK.md) and [version policy](VERSIONING_POLICY.md) define the handoff. Tagging/publication is separate from this setup task.
32+
The [release runbook](RELEASE_RUNBOOK.md) and [version policy](VERSIONING_POLICY.md) define the handoff. Build and verify locally, stop for the maintainer’s pentest, and commit only after green. The maintainer pushes; repeat GitHub fixes and affected pentest retests until green. Tag and push the version tag only when explicitly requested; distribution publication needs separate authorization.
3133

3234
The [search design](SEARCH_DESIGN.md) and [secret lifecycle](SECRETS_POLICY.md) define required trust boundaries. The next bounded implementation pass is OpenBao-first secret provisioning; current fixture passwords are still locally generated and do not meet that new origin policy.
3335

@@ -73,7 +75,7 @@ The [gap reconciliation](gap-reconciliation-2026-10-03.md), [execution contracts
7375

7476
**Verification:** actual supported browsers/native hosts; independent security assessment; auth/SSRF/cache/plugin/failure tests; real PostgreSQL/MySQL migration proof; backup/restore; Vef/Brynja seam tests; privacy and accessibility.
7577

76-
**Exit criteria:** exact artifacts pass the complete acceptance contract with no required gaps or exploitable critical/high findings. v1.0.0-rc.1 implementation stop reached. Run pentest for this exact commit.
78+
**Exit criteria:** exact artifacts pass the complete acceptance contract with no required gaps or exploitable critical/high findings. v1.0.0-rc.1 implementation stop reached. Run the maintainer’s pentest for this exact source candidate before committing new work.
7779

7880
### v1.0.0-rc.N
7981

@@ -89,7 +91,7 @@ The [gap reconciliation](gap-reconciliation-2026-10-03.md), [execution contracts
8991

9092
**Verification:** rerun all affected suites and full candidate acceptance, including security and operational restoration.
9193

92-
**Exit criteria:** no remaining blocker; every previous finding has tested disposition. v1.0.0-rc.N implementation stop reached. Run pentest for this exact commit.
94+
**Exit criteria:** no remaining blocker; every previous finding has tested disposition. v1.0.0-rc.N implementation stop reached. Run the maintainer’s pentest for this exact source candidate before committing new work.
9395

9496
### v1.0.0
9597

@@ -105,7 +107,7 @@ The [gap reconciliation](gap-reconciliation-2026-10-03.md), [execution contracts
105107

106108
**Verification:** verify all operation/argument/recipe/UI/target rows, both search profiles with live authorization, OpenBao-sourced project secrets from initialization through release, exact distribution provenance, current security findings and executed deployment/upgrade/recovery procedures.
107109

108-
**Exit criteria:** all required functionality and evidence pass; no beta database or unsupported production claim remains. v1.0.0 implementation stop reached. Run pentest for this exact commit.
110+
**Exit criteria:** all required functionality and evidence pass; no beta database or unsupported production claim remains. v1.0.0 implementation stop reached. Run the maintainer’s pentest for this exact source candidate before committing new work.
109111

110112
## After 1.0
111113

0 commit comments

Comments
 (0)