From f8447daf95f8cb92ff768bc2621bc9df86ef1883 Mon Sep 17 00:00:00 2001 From: Yoshiofthewire Date: Tue, 17 Nov 2026 21:47:30 -0500 Subject: [PATCH] test: qualify published Notes content upgrades Exercise native old-client key enrollment, encrypted Unicode content, candidate decryption and exact edit persistence with owned-cache eviction. Preserve actual client crypto and action-bound confirmations; record scoped coverage and remaining lifecycle gaps. AI-Assisted-By: Codex (gpt-6.1-sol) --- AGENTS.md | 16 + docs/RELEASE-ACCEPTANCE-2026-11-17-MAJOR.md | 440 ++++---------- docs/release-candidate-2026-11-17-major.json | 574 ++++--------------- test/e2e/notes_browser.mjs | 388 +++++++++++++ test/e2e/notes_browser_test.go | 156 +++++ test/e2e/notes_input.mjs | 29 + test/e2e/npm_joins_kube_test.go | 17 + test/e2e/npm_kube_test.go | 2 +- 8 files changed, 800 insertions(+), 822 deletions(-) create mode 100644 test/e2e/notes_browser.mjs create mode 100644 test/e2e/notes_browser_test.go create mode 100644 test/e2e/notes_input.mjs diff --git a/AGENTS.md b/AGENTS.md index ee168c9..077d683 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -896,6 +896,22 @@ calls and kind nodes must carry their own explicit bounds. is moved aside. This is native candidate capsule recovery, not restore of the installer's pre-upgrade claim copy or offboarding/meeting delivery qualification. +- With `KYQ_TEST_NOTES_BROWSER=1` and historical release manifests, the NPM joins test + uses explicit Node/Playwright module and Firefox executable paths to drive the old + bundled Notes client through everyday OIDC sign-in, action-bound confirmation, device + key enrollment, saved recovery copy and encrypted notebook/page creation. An isolated + private-CA browser profile retains client keys across the CLI upgrade; fresh sessions + must decrypt exact old content, save an edit and decrypt it after reloading. Content + request bodies and stored ciphertext must exclude the plaintext markers. Where BiDi + omits request bodies, observe bounded copies of native fetch arguments and compare sent + ciphertext hashes with the stored object. The observer preserves native arguments, + headers and responses and supplies no credentials or confirmation shortcuts. Before candidate + reads, explicitly save and prove pending queues empty; clear only the owned note cache, + preserving byte-identical client key records, so cached plaintext cannot satisfy the read. Browser launch + wrappers may enforce host bounds separately while the single campaign holds its lock; + preserve the Go task cap and approved browser-only cap. This does not qualify offboarding + or recovery from loss of the client's keys. + - With `KYQ_TEST_MESSAGE_UPGRADE_MANIFEST` naming an independently attested historical KyMessages manifest and its sibling Compose template, `TestKubernetesKyMessage` starts the complete old catalog entry with explicit fixture transport/CA plumbing, exchanges diff --git a/docs/RELEASE-ACCEPTANCE-2026-11-17-MAJOR.md b/docs/RELEASE-ACCEPTANCE-2026-11-17-MAJOR.md index 6900331..5f3d5c5 100644 --- a/docs/RELEASE-ACCEPTANCE-2026-11-17-MAJOR.md +++ b/docs/RELEASE-ACCEPTANCE-2026-11-17-MAJOR.md @@ -1,132 +1,22 @@ -# Ky Suite candidate acceptance — Major, 2026-11-17 +# Ky suite acceptance — 2026-11-17/18 -Status: **IN PROGRESS — not release qualified**. +Status: **whole suite incomplete; no release qualification claimed**. -The [candidate matrix](release-candidate-2026-11-17-major.json) freezes installer runtime -source `48bfb674ab664f91b07b79fda6df221f75a23362`, all 14 catalog entries and their immutable -image references. All ten Ky primary images passed exact-tag/workflow GitHub attestation -verification. The previous catalog is installer `v0.6.0.8`, source -`724fc276c77a56c392ba0e402a2a90ddcd408257`. No runtime source or image pin was changed. +The [candidate matrix](release-candidate-2026-11-17-major.json) records all 14 frozen +catalog entries and immutable image references, the exact old installer `v0.6.0.8` +(source `724fc276c77a56c392ba0e402a2a90ddcd408257`), and per-product coverage. +All ten Ky primary images passed exact-tag/workflow attestation verification. No runtime +source, dependency or image pin is changed by this acceptance extension. -## Current execution and evidence +## Coverage -The seven-app configuration/pairing and Calendar content campaign -`kyq-acceptance-app-content-v3-20261117` **PASSED** at 20:35:59 UTC: -integration 1224.364 s, full controller 1400.410 s. Fresh gate/affected/full CI -passed 8.095 s / 4.491 s / 163.326 s. Tested source was `suite-calendar-etag`, -base `77d9f7aabee3bed6d7ccde361ef11ced4e4bde09`, frozen test patch -`314128ae7c2f3fa570954387110fc1fadc1d6de394f34bd2918faaceb6996510`. - -All seven actual previous-image upgrade commands, deployment/health and required verified -backups passed. Selected Docker credentials, Identity JWKS and Recovery pairing/key binding -were retained; candidate Pulse deposited using its prior pairing. The available Kubernetes -Secret payload count was **zero**, so this is not evidence that volume-held keys of every -product were compared. Candidate reciprocal native API sign-ins passed. The ordinary -Calendar event retained exact text/times/IDs/ETag/access and accepted a valid candidate -If-Match edit. The run also retained KyDNS's expected fail-closed/unsafe-gateway refusals; -successful edge sign-in remains unproven on this Docker topology. - -The consolidated review tree `suite-lifecycle-acceptance`, building on the tested Drive -extension, passed fresh affected compilation/relay6.689 s and full CI163.476 s (controller -170.240 s). Its341 non-documentation files, except the inherited exact Drive test, match -the successful app integration tree byte for byte; runtime, pins and dependencies match. -This reuses the named integration evidence and is not a fresh combined integration run. -No wider product-data/offboarding/restore qualification is inferred. - -The Messages previous-primary campaign `20261117-major-message-upgrade-v2` **PASSED** -at21:03:48 UTC: fresh affected7.045 s/full CI162.118 s, real integration511.402 s, -full controller680.688 s. It used the complete historical manifest/Compose entry, -upgraded0.6.0.1→0.6.1 with its own verified pre-upgrade snapshot, retained selected -keys and original sessions, and decrypted both old server-fetched history and a new -encrypted event. Candidate offboarding and the existing candidate-backup/history-restore -drill passed afterward. This is not an upstream Matrix-version migration or a restore -of the old pre-upgrade snapshot itself. The failed V1/source remain intact. - -Content-v2 remains exit1 / 1082.514 s (controller1256.364 s): exact Calendar readback -passed but the fixture's bare HTTP If-Match was rejected400. V3 only quoted that header -relative to V2. Every failed run/source remains preserved. - -The original content-v1 run failed 801.169 s before any upgrade: later apply replaced -Calendar's test-only CA mount/environment, so the new old-image seed sign-in returned -502 and its native log reported x509 unknown authority. It had already passed all seven -monitoring targets and old Recovery/Pulse pairing/deposit. No Calendar content or final -upgrade-retention outcome was obtained. - -The isolated correction makes the existing CA helper repeatable through keyed strategic -merge, skips a restart when the pod template is unchanged, and restores Calendar trust -before seeding. Calling it twice against the actual API server exercises duplicate-write -refusal. Upgrade deployment reuses the same fixture patch. Hostname/certificate validation -remains enabled; product TLS behavior and pins are unchanged. - -V1 failed before cluster creation on DNS. V2 failed on fixture target count/Post DNS. -V3 passed all seven monitoring targets and old-image pairing/deposit, then the real -Identity 0.6.0.1 → 0.6.1 deployment/health and verified pre-upgrade claim copy. It stopped -at Recovery's correct `ack_required` gate (integration exit 1 / 851.258 s; controller -1020.521 s). The test omitted the acknowledgement for a non-migrating upgrade. Final -all-app account/key/content retention assertions were not reached, so no completed -seven-app qualification is claimed. - -Private evidence root on Major: `/home/yoshi/.local/state/kyquickstart-acceptance/`. -Logs remain private; per-stage result files retain commands, timestamps, exit codes and -source hashes. Reruns have separate names and preserve every failure: - -| Directory | Role and final/current state | -| --- | --- | -| `20261117-major` | Original seven standard shards and docs passed; original optional HA/controller failure retained | -| `20261117-major-ha-rerun-1` | Corrected HA, Euro-Office and remaining controller passed; references original seven passes | -| `20261117-major-drive-upgrade` | Original queue superseded before execution | -| `20261117-major-drive-upgrade-v2` | Prerequisite refused the failed original baseline (exit 75); no Go checks ran | -| `20261117-major-drive-upgrade-v3` | Affected checks, full CI and real previous-Drive recovery passed | -| `20261117-major-app-upgrades-v1` | Affected/full CI passed; integration failed before cluster creation on DNS | -| `20261117-major-app-upgrades-v2` | Integration failed on fixture target count/Post DNS before upgrades; original results retained | -| `20261117-major-app-upgrades-v3` | Fresh full CI passed; integration stopped at the correct Recovery no-backup acknowledgement gate after Identity upgrade | -| `20261117-major-app-content-v1` | Full CI passed162.266 s; integration failed801.169 s at Calendar seed sign-in after fixture CA was replaced | -| `20261117-major-app-content-v2` | Gate/affected7.092 s /4.472 s and fresh CI162.151 s passed; integration1082.514 s failed at malformed fixture If-Match after seven upgrades/retention and exact Calendar readback | -| `20261117-major-app-content-v3` | PASS: gate8.095 s /affected4.491 s /full CI163.326 s; real integration1224.364 s /controller1400.410 s | - -All heavy work is serial under `/tmp/ky-heavy-test.lock`: Go cgroups have 2 GiB memory, -no swap, two CPUs and persistent caches. Docker/kind fixtures have their own bounds. -Disposable apps explicitly blank both production relay URLs. Existing services, -credentials, containers and the separate mail-capacity workstream stay preserved. - -## Executed checks - -| Check | Result | Fresh execution | -| --- | --- | --- | -| Ten Ky image release/source attestations | PASS | Major, selected immutable image digests | -| Baseline full `make ci` | PASS | 487.725 s, unmodified candidate source | -| Full `make ci` with safe HA fixtures | PASS | 148.221 s | -| `TestRelaysOffCatalog` | PASS | 53.519 s including compile | -| NPM edge integration shard | PASS | 480.770 s | -| NPM joins integration shard | PASS | 963.021 s | -| Messages / Kubernetes apply shard | PASS | 620.712 s; Messages 442.98 s, Kubernetes apply 176.25 s | -| Drive restore / KyYard shard | PASS | 550.107 s; Drive restore 297.30 s | -| nginx edge / node and pod failover shard | PASS | 909.374 s; core edge test 632.05 s | -| nginx joins shard | PASS | 954.632 s | -| Docker catalog startup/restart (within final shard) | PASS | Six products, 82.02 s | -| Docker KyYard runner (within final shard) | PASS | 6.01 s; test-built runner | -| Final standard e2e shard | PASS | 318.592 s; all seven standard shards passed | -| mdBook build / generated local links | PASS | Pinned 0.5.4; 0.026 s / 0.053 s | -| Pinned KyIdentity database-cluster HA | PASS (corrected fixture) | 526.26 s; original fixture failure retained | -| Pinned KyIdentity replicas | PASS (corrected fixture) | 272.23 s; operator-provided and installer-managed database cases | -| Combined corrected pinned-image HA stage | PASS | 804.611 s including compilation | -| Euro-Office integration | PASS | 385.807 s; existing health/callback/egress/lifecycle assertions | -| Corrected acceptance controller | PASS | 1368.495 s; references seven original standard passes | -| Previous-image Drive upgrade/recovery | PASS | 384.324 s; fresh full CI 163.607 s; combined controller 554.558 s | -| Initial seven-app extension (app-upgrades-v3) | FAILED; superseded by passing content-v3 | V3 full CI 162.783 s passed; integration 851.258 s stopped at Recovery acknowledgement; final retention checks not reached | -| Seven-app configuration + Calendar content | PASS (content-v3) | Fresh gate8.095 s /affected4.491 s /full CI163.326 s; integration1224.364 s/controller1400.410 s; prior failed runs retained | -| Previous-image Messages encrypted-history upgrade | PASS (message-v2) | Fresh affected7.045 s/full CI162.118 s; real integration511.402 s/controller680.688 s; old/new encrypted history, selected keys/sessions and subsequent candidate offboarding/restore | - - -The corrected controller completes the named fixture campaign, not the whole-suite -qualification. A generic fixture pass or a container restart cannot close a product's -content migration, offboarding or restored-service gate. - -## Per-product qualification ledger - -PASS applies only to the named assertions. Corrected content-v3 completed all seven native -configuration upgrades, specified retention and Calendar content checks. This is not -whole-suite release qualification or every product's ordinary content/offboarding/restore. +All 14 baseline catalog components have named executed checks. Eight Ky products passed +controlled previous-version upgrade campaigns. The owner separately confirms that an +existing KyDNS in-place upgrade to v0.6.1 is working; its prior version and detailed +retention checks were not supplied. Thus nine of ten Ky products have successful upgrade +evidence, with **KyYard remaining**. This is not a count of fully qualified products. +Four named content/recovery campaigns passed: Drive, Messages, Calendar and Notes, each +within its own scope. Baseline coverage does not prove content migration or full recovery. | Product | Executed real-image evidence | Direct evidence still missing | | --- | --- | --- | @@ -134,10 +24,10 @@ whole-suite release qualification or every product's ordinary content/offboardin | KyDrive | Native setup and SCIM; old 0.6.0.1 to candidate 0.6.1 failed-upgrade recovery from the upgrade's own verified snapshot; exact 300 KiB file, owner access, credential hashes/modes and removal/deletion replay; admin API 200, admin file 403 with separation refusal, everyday admin API 403 and everyday file download | Other workspace/content/migration/failure models; actual browser editing/save and synchronized or mounted desktop saves. | | KyRecovery | Native administrative sign-in, everyday identity gate, throwaway public-key ceremony and capsule listing/deposit | Previous-catalog key/pairing retention passed. Restored service with existing capsules/ceremony, administrative revocation and session invalidation remain untested here. Deposit/listing is not product restore. | | kyPulse | Native administrative sign-in, everyday identity gate, monitoring targets healthy and real paired deposit | Previous-catalog config/pairing binding and candidate deposit with prior credentials passed. Restored monitoring state and offboarding/session revocation remain untested. | -| KyNotes | Admin backup-status API 200 / ordinary containers 403 with admin-account refusal; everyday backup-status 403 / containers 200 | Native config/account upgrade passed. Real notes migration, offboarding/session revocation and restored notes remain untested. | +| KyNotes | Reciprocal admin/content API and native config/account upgrade; V12 published old-client encrypted notebook/page Unicode seed, retained-key candidate decryption, exact Unicode edit/native save and cache-evicted exact edited-body reload passed | Offboarding/session revocation, restored notes/client-key-loss recovery and other content/page types remain unqualified. | | KyCalendar | Admin users API 200 / calendars 403; everyday users API 403 / calendars 200 | Old-image event preservation/candidate edit and native candidate capsule recovery with restored ordinary event/edit passed. Offboarding, installer resume, recurrence and meeting delivery remain untested. | | KyPost | Native Docker setup, pre-bind-volume layout copy, admin users API 200 / everyday 403, session-ending restart and cold backup | Native config/account upgrade passed in IMAP-proxy mode. Real mail migration/restored mail, offboarding and dedicated-admin ordinary-mail denial remain untested. This fixture disables native mail listeners; it does not qualify the workforce mail stack. | -| KyDNS | Native setup, authoritative UDP/TCP DNS, forged-header rejection, unsafe-gateway trust refusal and fail-closed edge behavior | Successful edge/admin sign-in is UNPROVEN on Major because Docker rewrites source addresses. Previous zones/config upgrade, offboarding and restore remain untested. Never broaden trust to force a pass. | +| KyDNS | Native setup, authoritative UDP/TCP DNS, forged-header rejection, unsafe-gateway trust refusal and fail-closed edge behavior; owner confirms an existing in-place upgrade to v0.6.1 is working | Owner report is successful operational upgrade evidence; its prior version and detailed checks were not supplied. Controlled previous-catalog zone/config retention, successful edge/admin sign-in on Major, offboarding and restore remain unqualified. Never broaden trust to force a pass. | | KyMessages | Real encrypted chat, offboarding and history restore; original device decrypts history and removals replay before Synapse starts. Dedicated admin chat sign-in receives KyIdentity access_denied and MAS has no admin account. | Previous0.6.0.1→0.6.1 upgrade with own verified snapshot, original keys/sessions and old/new encrypted events passed; later candidate offboarding/history restore passed. Upstream Matrix-version migration and direct authorization with an otherwise-valid admin token remain unproven. | | KyYard | Native admin sign-in/everyday identity gate, runner ownership and session/credential persistence; Docker startup/runner checks | Previous-catalog upgrade, offboarding and restored management service remain untested. Source-built runner fixtures do not qualify a published runner artifact. | | Nginx Proxy Manager | Both NPM shards: routing, ownership, administrative bootstrap, token refresh and reruns | No general upstream data migration/recovery claim. | @@ -145,221 +35,83 @@ whole-suite release qualification or every product's ordinary content/offboardin | CloudNativePG | Pinned operator/database HA fixture: synchronous replication, TLS, primary/node loss, hibernation/reinstall and object ownership | Node return and production storage/topology behavior beyond kind. | | Euro-Office | Health, signed callback 200/401, restricted egress and lifecycle integration passed | Production source/build provenance, real browser editing/save and desktop-save qualification remain open. | -Recovery/Pulse everyday denial in the shared sign-on helper occurs at KyIdentity's assigned -user gate. Role reporting after sign-in alone is not an independent management/content -API isolation check. Notes and Calendar do perform reciprocal API checks. The ordinary -Drive sign-on helper reports roles; the separate passed Drive recovery extension supplies -its real reciprocal admin/file API assertions. Post's sign-on helper checks `/api/users`, -so no ordinary-mail denial is inferred. - -Source anchors: - -- [NPM installation assertions](../test/e2e/npm_kube_test.go) and - [join orchestration and KyDNS fail-closed branch](../test/e2e/npm_joins_kube_test.go). -- [Drive role-reporting sign-in](../test/e2e/drive_kube_test.go), - [Calendar reciprocal authorization](../test/e2e/calendar_catalog_kube_test.go), - [Notes reciprocal authorization](../test/e2e/notes_catalog_kube_test.go) and - [Post admin endpoint authorization](../test/e2e/post_catalog_kube_test.go). -- [Historical Identity upgrade and Drive restore/removal replay](../test/e2e/restore_kube_test.go). -- [Docker startup/restart fixtures](../test/e2e/docker_catalog_test.go). -- [Messages encryption, admin admission and history-restore assertions](../test/e2e/message_chat_test.go). - -These relative links refer to the frozen baseline checkout. New opt-in upgrade assertions -remain in their named isolated worktrees pending consolidation into a mergeable PR. - -## Real previous-Drive recovery - -`KYQ_TEST_DRIVE_UPGRADE_MANIFEST` selects the exact attested old Drive manifest. The drill -seeds real data/accounts, invokes candidate upgrade, requires the native candidate health -endpoint to answer while an injected Docker health probe makes deployment fail, and then -restores the upgrade's own verified restic snapshot. Failed data moves aside. Exact file -bytes, owner access, secrets and subsequent SCIM removal/deletion replay must pass. -This qualifies the specific induced health failure; it is not every failed schema migration. - -The all-candidate baseline restore remains separate: historical Identity 0.4.3 upgrade, -Drive disaster/replacement restores, append-only refusal and removed/deleted-user replay. -No restored-leaver session was observed in that sample; this does not prove a zero-duration -access window under all conditions. - -The exact tested Drive tree is now [PR #206](https://github.com/Busnes-app/KyQuickStart/pull/206), -head `704cf0ab33cbb38cd5b1fbdcd745050d92172482`, built on #205 and now human-merged as `597ec94`. A separate committed/pushed -`drive-upgrade-acceptance` worktree preserves the completed execution checkout. All tracked -file bytes match the passed Drive worktree, so its local full-CI/real-image evidence applies; -GitHub current-head checks and authenticated security are pending. These gates use their -own event-driven watcher. The PR does not claim whole-suite qualification. - -## Seven-app native configuration upgrade extension - -`KYQ_TEST_RELEASE_UPGRADE_MANIFESTS` selects independently attested historical manifests -for Identity, Recovery, Pulse, Drive, Notes, Calendar and Post. The seven old primary-image -attestations bind exact repository/workflow/tag identities. Current transport templates, -fixture CA trust and blank relay settings remain explicit; this is not an old-installer -binary upgrade or a claim about every historical transport layout. - -The case seeds owner/OIDC/SCIM configuration, Recovery ceremony and Pulse pairing/deposit -on old images, then CLI-upgrades all seven to candidates. Passed assertions: native -owner/everyday access again, Identity JWKS unchanged, Kubernetes Secret payload hashes -that exist (the count can be zero), selected Docker key hashes, retained Recovery -pairing/service/key ID, and candidate Pulse deposit through the old pairing/token. -The separately described Calendar case seeds one real ordinary event. Notes/mail content and DNS/Messages/Yard upgrades are outside this case. -Full CI passed 169.321 s on V1/V2 source. V3 changed fixture monitoring, DNS and CA reuse, -so it ran fresh affected/full checks before integration (6.369 s / 162.783 s, both passed). The helper retains the original -four-target expectation for the ordinary edge suite and receives all seven explicitly for -the upgrade case. It still requires every target healthy; no health assertion is relaxed. -Content-v3 later completed with fresh full CI163.326 s and integration1224.364 s; retain its frozen source/hash as evidence. - -## Messages coverage audit and next upgrade case - -The passed candidate Messages baseline explicitly refused the dedicated admin at the -KyIdentity → MAS chat gate and checked that MAS had no such account. This evidence was -present in the executed test and is now recorded above; it does not create a direct -Matrix authorization result for an admin token the fixture never received. - -The previous-primary-image history case passed after correcting the V1 historical-template -mismatch. It crosses console migrations24–27 at `data_since: 0.6.0.2` and takes its -own verified pre-upgrade backup; no acknowledgement substitutes for it. Details below. - -## Calendar content case in corrected acknowledgement rerun - -The corrected optional extension runs in `suite-calendar-etag`, branch -`test/suite-calendar-etag`; earlier failed worktrees remain unchanged. -It creates a real everyday-owned calendar and event through the previous image's native -API. The passed candidate checks compare text (including Unicode/newlines), location, -times, calendar/event IDs, ETag and edit access through a newly signed-in session, then -use the old ETag for an optimistic-concurrency edit and verify unrelated fields remain. -No attendees or outgoing mail are involved. - -The original prepared source and patch remain in `20261117-major-calendar-content-prepared`. -After diagnosing V3's gate refusal, the isolated source now supplies the normal CLI -acknowledgement only where `Upgrade.Migrates(previousVersion)` is false and asserts that -it is recorded. Where migration is required, no acknowledgement flag is supplied and -`.pre-upgrade-backup` must be `ok`. The existing `TestUpgradeGate` regression runs -fresh before affected compilation, full CI and integration. This uses the intended -operator path in disposable fixtures; runtime gates remain unchanged. - -The new frozen run is `20261117-major-app-content-v3` in `suite-calendar-etag`; -earlier failed evidence/source remain intact. V2 did retain the seeded event exactly, then -failed because its edit sent an unquoted HTTP If-Match. V3 quotes the original ETag, as the -product API tests require, and the complete integration **passed1224.364 s**. -Calendar fixture trust is restored after later apply calls with the repeatable CA helper. -That upgrade case alone qualifies the seeded event, not Calendar restore/offboarding/recurrence/meeting -transport or other products' content. Notes content needs its actual encryption/key flow; -arbitrary opaque bytes are not substituted as a user-note workflow. -The product already has native encryption-client and browser-format migration tests, but -these do not close the installed-image gate: the MCP test seeds users directly in its -router/database fixture, and the browser test injects an older ciphertext format rather -than upgrading the previous published server. The meaningful next Notes case needs actual -ordinary-user key enrollment and encrypted notebook/page creation on the old pinned image, -then candidate decryption/edit with retained client keys. Source review alone is not a pass. - -Source-only feasibility audit `20261117-major-notes-content-audit-2029Z` checked the -actual old `v0.6.0.2` source `2fb29f3871a243728d0794c3b93688fe2de45797` against -the frozen candidate `v0.6.1` attested source `ba93e8281b3f64a9b0c5a4b786971da56180dc65`. -Their identity, reauthentication, recovery, notebook UI, crypto and migration-fixture -files match byte for byte. A real SSO case must create its device-only key through the -old bundled client, complete action-bound KyIdentity confirmation and save a recovery -copy: notebook creation refuses an unrecoverable key. The local-password browser helper -cannot replace this installer-created SSO path. Reuse actual UI content creation and -retain the isolated browser key store across the upgrade; do not inject ciphertext or -skip reauthentication/recovery. No Notes application content case was implemented or run; -the separate isolated TLS prerequisite below does not qualify the application. - - -## Passed previous-image Messages history upgrade - -The tested `suite-message-catalog-upgrade` worktree (branch -`test/suite-message-catalog-upgrade`, base `78b993ea8628bae6d5ab80c45a62e3ef0bdfb0f0`) -implements the opt-in `KYQ_TEST_MESSAGE_UPGRADE_MANIFEST` case with its sibling historical -Compose template. V1 passed affected6.406 s/full CI162.365 s, then failed integration157.190 s -(controller326.060 s) before old chat/upgrade: its old initializer could not create the -candidate guest-page bind. Corrected V2 passed affected7.045 s/full CI162.118 s and the -complete real-image integration511.402 s/controller680.688 s. The failed source is unchanged. -The old primary `0.6.0.1` image passed exact repository/workflow/tag attestation at -20:16:26 UTC. Its manifest is byte-identical to installer `v0.6.0.8`; all auxiliary -Matrix image pins match the candidate. - -The corrected case installs the complete historical manifest/Compose entry with explicit -fixture host/CA plumbing, uses the existing real Megolm room/device flow, then -requires the CLI upgrade's own verified pre-upgrade snapshot across `data_since: 0.6.0.2`. -It compared selected keys, renewed both original device sessions, fetched and decrypted -the old raw encrypted event with original client keys, exchanged a new encrypted event, -then completed existing candidate offboarding and history restore. The pre-upgrade and -later restore destinations have separate server-work and credential directories; no live -server's certificate/password files are overwritten. This does not test an upstream -Matrix-version migration or restore of the old-image pre-upgrade snapshot itself. - -Prepared evidence: `20261117-major-message-upgrade-prepared`. Failed `20261117-major-message-upgrade-v1` and its source remain intact. New execution -evidence `20261117-major-message-upgrade-v2` records fresh stages and patch/manifest/Compose -hash guards. The corrected content-v3 prerequisite and all V2 stages passed. A separate -publication tree `message-history-acceptance` matches344 non-documentation files of this -passed tree byte for byte, including runtime/pins/dependencies; its later report edits do -not constitute a fresh test execution. - -## Passed native Calendar capsule recovery - -The isolated `20261117-major-calendar-native-restore-v1` campaign **PASSED** at -22:29:48 UTC: fresh upgrade gate7.536 s, affected compile/relay4.533 s, full `make ci` -163.822 s, actual integration1242.651 s and full controller1418.664 s. All seven -previous-image upgrade commands, key/pairing retention and ordinary Calendar event -preservation/edit assertions passed before the new recovery rehearsal. - -`KYQ_TEST_CALENDAR_RESTORE=1` follows KyCalendar's native capsule runbook. Only the -test operator retained two nonconsecutive throwaway custodian shares. The candidate -refused ordinary-user capsule export and pinned the same suite public key for its admin. -It exported a real capsule, verified its transfer digest, refused one-share restoration, -then completed native two-share restore/reset offline. The restored credential map -matched the recorded installer paths; data/recovery/OIDC/directory key hashes matched. -Original data was moved aside. The offline helper was removed before CLI startup. -Old admin/everyday sessions returned401; fresh native sign-in and the restored ordinary -event's content/identifiers/access and a fresh If-Match edit passed. - -The frozen tested patch is -`01eac85d9c8e59b6d3cd931550ef5432ade1986925fceb83d004acba1bce54bb`, retained with -its source in `suite-calendar-native-restore`. This is candidate native capsule recovery, -not restoration of an installer pre-upgrade claim copy, Calendar offboarding, installer -resume after native restore, recurrence or meeting delivery. The separate root -Verification contract documents this opt-in scope. - -The isolated Notes browser TLS prerequisite V12 separately **PASSED**2.244 s at -22:32:01 UTC: a private named CA/signed leaf verified normally, and the wrong hostname -was refused with `SSL_ERROR_BAD_CERT_DOMAIN`. Firefox peaked at157 tasks under the -owner-approved browser-only256-task cap, with no PID-limit events; Go remains128. -No TLS error override or global trust/profile changes were used. Previous failedV1–V11 -remain. This proves fixture transport only; no Notes application enrollment, encrypted -content, retained-client-key upgrade or restore case has been implemented or qualified. - -## HA correction and release gates - -The original HA fixture used `kind load docker-image` directly on a digest reference. -Read-only diagnostics captured a broken containerd import record and key-generator -`CreateContainerError`. Both optional fixtures now use existing `kindLoad`, which loads -a local tag while workloads retain immutable digests, plus the relay-disabled catalog. -The exact four-line test correction is [PR #205](https://github.com/Busnes-app/KyQuickStart/pull/205), -head `77d9f7aabee3bed6d7ccde361ef11ced4e4bde09`. Local full CI, relay and pinned HA passed. -An event-driven Tick verified all 18 reported GitHub checks successful and authenticated -security clearance on that exact head. The three required checks passed. Its watcher was -stopped after both gates cleared; the PR was later human-merged as `57b2676`. This does not -complete the wider acceptance campaign or authorize publication. - -Euro-Office's frozen digest is -`beca380debb9b4eadb7e4c662d112a325c5df0f2179453a4affd8e6ba5d00562`. -Exact GitHub attestation verification returned HTTP 404 on November 17. Upstream successful -run 33166218952, tag `v9.3.4-hotfix.1`, `.github/workflows/build.yml`, source -`4ba0c0f202ae484eb202f24c59ddf5f4a7004161` matches observed build correspondence. -Unsigned BuildKit metadata is neither a signed attestation nor an independent rebuild. -This is a separate open production gate, not a failed baseline CI assertion. - -Remaining delivery work: add feasible missing real content/ -lifecycle cases; consolidate tests/report/matrix into mergeable PRs with required full and -current-head security checks; verify owned-resource cleanup. Never remove dirty/unpushed -worktrees or alter pre-existing services. Native-client distribution is separate: the Mac -development archive/signature passed, but Developer ID export remains blocked on a valid -direct-distribution profile. This server report certifies no Mac or Android artifact. -DOX pass: the implementation PRs update root `AGENTS.md` for the opt-in seven-app/Calendar -(`KYQ_TEST_RELEASE_UPGRADE_MANIFESTS`), Messages (`KYQ_TEST_MESSAGE_UPGRADE_MANIFEST`) -and native Calendar capsule recovery (`KYQ_TEST_CALENDAR_RESTORE`) test contracts. -`docs/AGENTS.md` and the child indexes remain unchanged because documentation ownership -and workflow did not change. This report and the candidate matrix record observed evidence -and qualification limits; prior versions are preserved in the timestamped private -report-audit directories. +## Notes published-client encrypted-content upgrade + +`TestKubernetesNPMEdgeJoins` with `KYQ_TEST_NOTES_BROWSER=1` and independently attested +historical manifests passed at 2026-11-18T02:17:26Z: + +| Check | Duration | Result | +| --- | ---: | --- | +| Browser paragraph/React input regression | 3.553 s | PASS | +| Affected compilation, relay isolation and issuing-CA/hostname controls | 6.567 s | PASS | +| Fresh full `make ci` | 162.588 s | PASS | +| Real integration command | 1376.794 s | PASS | +| Full campaign controller | 1549.637 s | PASS | + +The tested base was `8f36d2085c2c4110373733b01b6df62aee508ad9`, with frozen patch +`9a2d0439e5acdce70e21cd1869ad748d2427ff125bfd5bd3f6a42f539509be31`. +The publication tree preserves all five test/helper files byte for byte. Its newer base +adds documentation only, including the current-head CodeQL merge gate; publication CI +is a separate execution, not another claim of a fresh integration run. + +The actual old bundled Notes client completed everyday native OIDC, action-bound Identity +confirmations, device-key enrollment, recovery-copy download/type-back/save and encrypted +notebook/page creation with an exact Unicode title/body. The CLI then upgraded all seven +old images with deployment, health, required backup and selected credential/JWKS/pairing +retention checks. A candidate Pulse deposit used its prior pairing. Fresh candidate Notes +SSO decrypted the exact old server-backed content using retained browser keys. + +The candidate append targets the original paragraph using a normal click and End key; +a read-only selection proof requires a collapsed caret inside that paragraph at its end. +Both before and after native Save, the edited rendered text matched the exact expected +78 characters in one paragraph. After another owned note-cache eviction, the exact edited +Unicode content reloaded and decrypted. Later candidate Calendar/Post checks also passed. +No whitespace normalization satisfies the assertions. Earlier V10/V11 failures diagnosed +a fixture paragraph-boundary mismatch; all failed sources and private evidence remain +preserved rather than relabelled as passes. + +Nine seed and two edit request bodies were inspected, with no uninspectable bodies or +plaintext markers. Each last object PUT digest matched server-fetched raw ciphertext. +Because the installed Playwright BiDi implementation omits protocol request bodies, a +read-only observer copies native fetch arguments for inspection and passes original +arguments, headers and responses unchanged. Unknown/oversized inspection bodies fail +closed. The observer supplies no login, key, cookie or confirmation substitute. + +Native Save and empty pending/upload queues precede eviction of only the owned browser's +`notes` IndexedDB store. Client `keys` records remain byte-identical, excluding cached +plaintext as the source of the later read. ASCII credentials use keyboard events; Unicode +uses the browser editing engine. Product crypto, MFA/CSRF/roles, TLS hostname verification +and published images remain intact. Only the private test browser profile trusts its +named issuing CA. No global trust or host DNS changes are required. + +## Reproduction and boundaries + +Read the optional-case contract in [AGENTS.md](../AGENTS.md). Supply explicit existing +`KYQ_TEST_BROWSER_MODULE` (Playwright module) and `KYQ_TEST_BROWSER_EXECUTABLE` (Firefox) +paths, plus `certutil`. `KYQ_TEST_RELEASE_UPGRADE_MANIFESTS` names the independently +attested historical manifests. An optional `KYQ_TEST_BROWSER_WRAPPER` may enforce the +approved browser-only process limit. Run the named integration command from the repository root; Go runs the browser helper +from the package working directory `test/e2e`. The historical manifests and local browser +prerequisites are explicit operator inputs; no dependency download or trust bypass is +performed by this helper. The matrix records the exact integration command. + +One campaign holds `/tmp/ky-heavy-test.lock`. Go is bounded to 2 GiB/no swap/2 CPUs/128 +tasks, `GOMAXPROCS=2`, `GOMEMLIMIT=1GiB`, `GOFLAGS=-p=1`, with persistent disk-backed +scratch/caches. The synchronous owned browser-only scope has the separately approved +256-task cap and the same memory/CPU limits, while Go waits; it is not another heavy +campaign. Both `PUSH_RELAY_URL` and `APNS_RELAY_URL` are explicitly empty. Existing +services, credentials, unrelated containers and all frozen pins remain preserved. + +## Remaining qualification + +The Notes case does not qualify offboarding, loss of client keys, restored Notes or all +page/content types. Further suite gates include native Post stored/incoming mail, direct +MX receipt and workforce capacity; Euro-Office production provenance, actual editing and +synchronized/mounted desktop saves; DNS positive edge and controlled zone/config +retention; KyYard's published-artifact upgrade; and additional offboarding/restore cases. +Euro-Office health/callback success is not provenance or editing qualification. + +The owner confirms iOS App Store publication. macOS Developer ID delivery remains a +separate unfinished gate. The Mac is intentionally powered off and receives no operations. +No merge, tag, release or deployment is part of these recorded acceptance results. diff --git a/docs/release-candidate-2026-11-17-major.json b/docs/release-candidate-2026-11-17-major.json index 43dd51d..5f96be8 100644 --- a/docs/release-candidate-2026-11-17-major.json +++ b/docs/release-candidate-2026-11-17-major.json @@ -3,7 +3,7 @@ "host": "major", "installer_source": "48bfb674ab664f91b07b79fda6df221f75a23362", "installer_version": "0.6.1", - "status": "candidate; acceptance pending", + "status": "Named campaigns passed; whole-suite release qualification incomplete", "scope": "All installer catalog applications and both supported proxy paths; native client distribution is recorded separately from server lifecycle acceptance.", "apps": [ { @@ -276,11 +276,6 @@ "heavy_work": "serial under /tmp/ky-heavy-test.lock", "existing_services": "not adopted or modified" }, - "acceptance_harness": { - "base_source": "48bfb674ab664f91b07b79fda6df221f75a23362", - "patch_sha256": "e6ea1011544b57af8597c8ff0982e33f6e2266d2af94529a1f6101cda63dca18", - "changes": "Two opt-in KyIdentity HA tests load the existing relay-disabled catalog. Product/installer runtime sources and image pins are unchanged." - }, "upgrade_baseline": { "installer_release": "v0.6.0.8", "installer_source": "724fc276c77a56c392ba0e402a2a90ddcd408257", @@ -391,192 +386,10 @@ "npm": "jc21/nginx-proxy-manager:2.16.0@sha256:4393e642e233e5efd5adeb7f10918d4aaea71c9ed875b94190273fc8e87f9594" } } - ], - "status": "frozen upgrade input; per-product real-data upgrade execution pending" - }, - "ha_fixture_correction": { - "worktree": "suite-ha-image-loading", - "branch": "fix/suite-ha-image-loading", - "patch_sha256": "59af532ad421fc7276a7bea8fe2f116a1506966c68ff0fa8833877c43ee82aaa", - "status": "PASS: local CI/relay/pinned HA/editor and18 exact-head GitHub checks/authenticated security cleared; human-merged as57b2676cc7fa10c60693efd541dd914ebd7541d0", - "original_failed_evidence": "20261117-major/identity-ha.result.json", - "corrected_evidence": "20261117-major-ha-rerun-1", - "change": "Reuse existing kindLoad in two optional HA fixtures; retain relay-disabled catalog; runtime and pins unchanged", - "pull_request": "https://github.com/Busnes-app/KyQuickStart/pull/205", - "pull_request_head": "77d9f7aabee3bed6d7ccde361ef11ced4e4bde09", - "ha_duration_seconds": 804.611, - "github_gate_evidence": "20261117-major-pr205-gates-191307Z/gates.result.json", - "merge_commit": "57b2676cc7fa10c60693efd541dd914ebd7541d0" - }, - "drive_lifecycle_extension": { - "revision": 3, - "evidence": "20261117-major-drive-upgrade-v3", - "patch_sha256": "08c5237530ad58f785ced1cf7d725866ed575f1d8e8d0b72a16a740de0fd9683", - "status": "PASS: full CI 163.607 s; real previous-image upgrade/recovery 384.324 s; combined 554.558 s", - "previous_manifest_sha256": "61d81d4ce3ea7580db410f4b4393f3e0b11e90c50be3e6552da8f55f6b6f8808", - "prerequisite": "successful corrected fixture campaign; original failure retained", - "pull_request": "https://github.com/Busnes-app/KyQuickStart/pull/206", - "pull_request_head": "704cf0ab33cbb38cd5b1fbdcd745050d92172482", - "github_gates": "Human-merged as597ec940141b3d7a14000a0c2d995422cba1efc5; CI/security were not re-polled during this remote continuation", - "tree_equivalence_evidence": "20261117-major-drive-pr-192500Z/tree-equivalence.result.json", - "merge_commit": "597ec940141b3d7a14000a0c2d995422cba1efc5" - }, - "native_configuration_upgrade_extension": { - "source": "77d9f7aabee3bed6d7ccde361ef11ced4e4bde09", - "patch_sha256": "314128ae7c2f3fa570954387110fc1fadc1d6de394f34bd2918faaceb6996510", - "evidence": "20261117-major-app-content-v3", - "status": "PASS: fresh fullCI163.326s, real integration1224.364s, controller1400.410s; only named assertions qualified", - "scope": "seven real previous-image to candidate native-config/credential/pairing upgrades; not full per-product ordinary content migration/offboarding/restore", - "verified_previous_images": [ - { - "app": "kyidentity", - "image": "ghcr.io/busnes-app/kyidentity-server:0.6.0.1@sha256:096da2158984cdb1c195841a9f7d1c9b26b50ecd06753e9f4382054250876cb6", - "repository": "Busnes-app/KyIdentity-server", - "tag": "v0.6.0.1", - "identity": "https://github.com/Busnes-app/KyIdentity-server/.github/workflows/release-image.yml@refs/tags/v0.6.0.1", - "exit_code": 0, - "manifest_sha256": "20bf173c10b901c21e21b8fea15b68e04f9f267722b3595dc33217ae544b39df", - "checked_at": "2026-11-17T18:36:24.911545+00:00" - }, - { - "app": "kyrecovery", - "image": "ghcr.io/busnes-app/kyrecovery-server:0.6.0.2@sha256:ee489f04dc11000e0be3d6e2b71b9faae127988a548a8f84c1445f5ed4252042", - "repository": "Busnes-app/KyRecovery-server", - "tag": "v0.6.0.2", - "identity": "https://github.com/Busnes-app/KyRecovery-server/.github/workflows/release-image.yml@refs/tags/v0.6.0.2", - "exit_code": 0, - "manifest_sha256": "a83a739c01cbf95198cb84506c7f82013ce65d8f74da6070d9ee093a9fd52127", - "checked_at": "2026-11-17T18:36:29.124656+00:00" - }, - { - "app": "kypulse", - "image": "ghcr.io/busnes-app/kypulse-server:0.6.0.2@sha256:808ee7b793f5a3ce648a6d71172212de13c7b6c238fa39c7b2482f8e3f03abfb", - "repository": "Busnes-app/KyPulse-server", - "tag": "v0.6.0.2", - "identity": "https://github.com/Busnes-app/KyPulse-server/.github/workflows/release-image.yml@refs/tags/v0.6.0.2", - "exit_code": 0, - "manifest_sha256": "523798ba318807bda838c035f1ae180783ea5fe126726ef9289e1a820648a0af", - "checked_at": "2026-11-17T18:36:32.878216+00:00" - }, - { - "app": "kydrive", - "image": "ghcr.io/busnes-app/kydrive-server:0.6.0.1@sha256:5a6b6e6cec2c2dd5b4da4f9bc6e470944e7c6e235269b45ca9622957fbc37160", - "repository": "Busnes-app/kydrive-server", - "tag": "v0.6.0.1", - "identity": "https://github.com/Busnes-app/kydrive-server/.github/workflows/release-image.yml@refs/tags/v0.6.0.1", - "exit_code": 0, - "manifest_sha256": "61d81d4ce3ea7580db410f4b4393f3e0b11e90c50be3e6552da8f55f6b6f8808", - "checked_at": "2026-11-17T18:36:37.126566+00:00" - }, - { - "app": "kynotes", - "image": "ghcr.io/busnes-app/kynotes-server:0.6.0.2@sha256:135ccd7df01e3218422b0baed2ec6de79906b43306f57df173f0039986c8f07f", - "repository": "Busnes-app/KyNotes-server", - "tag": "v0.6.0.2", - "identity": "https://github.com/Busnes-app/KyNotes-server/.github/workflows/release-image.yml@refs/tags/v0.6.0.2", - "exit_code": 0, - "manifest_sha256": "0b7997a5ecee44e9390713d25d7ec3ab9eab0d3344833c4a424e1420f57d7e8b", - "checked_at": "2026-11-17T18:36:41.035045+00:00" - }, - { - "app": "kycalendar", - "image": "ghcr.io/busnes-app/kycalendar:0.6.0.2@sha256:e76bf9abb055b25e72a5e244e18564230b4ef1e0a27f0f578c5988a089699b3c", - "repository": "Busnes-app/KyCalendar", - "tag": "v0.6.0.2", - "identity": "https://github.com/Busnes-app/KyCalendar/.github/workflows/release-image.yml@refs/tags/v0.6.0.2", - "exit_code": 0, - "manifest_sha256": "36634fe928456c95279c8afc8e1b4c7e3f9233bb4beac830844fdfa8f3ea6153", - "checked_at": "2026-11-17T18:36:45.077005+00:00" - }, - { - "app": "kypost", - "image": "ghcr.io/busnes-app/kypost-server:0.6.0.2@sha256:cd7154c167a81a46825d108a3b9b5486bbabdc6c6c1e6013e80a4875428bb108", - "repository": "Busnes-app/KyPost-Server", - "tag": "v0.6.0.2", - "identity": "https://github.com/Busnes-app/KyPost-Server/.github/workflows/release-image.yml@refs/tags/v0.6.0.2", - "exit_code": 0, - "manifest_sha256": "ba25a33bd0698545b15af68f639b1eea2cbc704fc14be78be0f60ecdcb19dd32", - "checked_at": "2026-11-17T18:36:49.021180+00:00" - } - ], - "previous_failed_evidence": [ - "20261117-major-app-upgrades-v1", - "20261117-major-app-upgrades-v2", - "20261117-major-app-upgrades-v3", - "20261117-major-app-content-v1", - "20261117-major-app-content-v2" - ], - "worktree": "suite-calendar-etag", - "branch": "test/suite-calendar-etag", - "acknowledgement": "Only manifest-declared non-migrating versions get explicit --acknowledge-no-backup; migration cases still require verified pre-upgrade-backup ok", - "previous_content_v2_observed": { - "evidence": "20261117-major-app-content-v2", - "exit_code": 1, - "integration_seconds": 1082.514, - "full_seconds": 1256.364, - "passed_before_failure": [ - "seven upgrade commands/deploy/health and all required verified pre-upgrade backups", - "Docker credentials, Identity JWKS, Recovery pairing/key, candidate Pulse deposit with prior pairing", - "fresh candidate Drive/Notes/Calendar reciprocal native API sign-in", - "exact old Calendar event readback including ETag and editability" - ], - "failure": "fixture bare If-Match header rejected HTTP400; corrected isolated source quotes HTTP strong entity-tag", - "not_reached": [ - "successful candidate event edit", - "final Post fresh re-sign-in", - "completed integration outcome" - ], - "kubernetes_secret_payload_count": 0 - }, - "current_passed_checks": { - "upgrade-gate": { - "exit_code": 0, - "duration_seconds": 8.095, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/upgrade-gate.result.json" - }, - "affected-compile-relay": { - "exit_code": 0, - "duration_seconds": 4.491, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/affected-compile-relay.result.json" - }, - "ci": { - "exit_code": 0, - "duration_seconds": 163.326, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/ci.result.json" - } - }, - "results": { - "upgrade-gate": { - "exit_code": 0, - "duration_seconds": 8.095, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/upgrade-gate.result.json" - }, - "affected-compile-relay": { - "exit_code": 0, - "duration_seconds": 4.491, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/affected-compile-relay.result.json" - }, - "ci": { - "exit_code": 0, - "duration_seconds": 163.326, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/ci.result.json" - }, - "real-app-upgrades": { - "exit_code": 0, - "duration_seconds": 1224.364, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/real-app-upgrades.result.json" - }, - "full-qualification": { - "exit_code": 0, - "duration_seconds": 1400.41, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/full-qualification.result.json" - } - }, - "completed_at": "2026-11-17T20:35:59.950686+00:00", - "kubernetes_secret_payload_count": 0 + ] }, "coverage_audit": { - "checked_at": "2026-11-17T21:09:30.474136+00:00", + "checked_at": "2026-11-18T02:23:47.308343+00:00", "status": "in progress; not release qualified", "products": { "kyidentity": [ @@ -596,8 +409,10 @@ "Restored monitoring/offboarding untested" ], "kynotes": [ - "Reciprocal admin/content endpoints passed", - "Native config/account upgrade passed; real note content/offboarding/restore untested" + "Reciprocal native admin/content API and previous-image native configuration/account upgrade passed", + "V12 published old-client native encrypted notebook/page Unicode seed and seven-image CLI upgrade passed; retained browser keys/fresh native SSO decrypted exact server-backed old content", + "Candidate exact Unicode edit/native save and cache-evicted exact edited-body decryption passed, with empty pending/upload queues and unchanged key records; nine seed and two edit request bodies excluded plaintext and matched last PUT digest to stored ciphertext", + "Offboarding, restored notes, client-key-loss recovery and other page/content forms remain unqualified" ], "kycalendar": [ "Reciprocal native admin/content access, previous-image ordinary event content/times/IDs/ETag and candidate edit passed", @@ -609,8 +424,9 @@ "Native config/account upgrade passed in IMAP-proxy mode; real mail migration/restore/offboarding/admin-mail denial untested" ], "kydns": [ - "DNS and fail-closed/unsafe-trust refusal passed", - "Successful edge/admin sign-in unproven on Major; zone/config upgrade/restore/offboarding untested" + "DNS and fail-closed/unsafe-trust refusal passed in controlled fixtures", + "Owner confirms existing in-place upgrade to v0.6.1 is working; operational evidence, not an independently executed controlled campaign", + "Prior version and detailed zone/config retention checks were not supplied; controlled previous-catalog retention, positive edge/admin sign-in on Major, restore and offboarding remain unqualified" ], "kymessage": [ "Published previous0.6.0.1\u21920.6.1 primary upgrade with own verified pre-upgrade snapshot, selected session/directory/OIDC/provider/signing keys and original device sessions passed", @@ -638,140 +454,89 @@ "Production provenance and real editing/desktop saves open" ] }, - "report": "RELEASE-ACCEPTANCE-2026-11-17-MAJOR.md", - "notes_content_source_audit": { - "evidence": "20261117-major-report-notes-193642Z/notes-content-source-audit.json", - "status": "source review only; no product content qualification inferred" + "owner_reported_kydns_upgrade": { + "recorded_at": "2026-11-18T02:23:47.308343+00:00", + "source": "Owner statement in current conversation", + "statement": "I already did a KyDNS in place upgrade to v0.6.1 and it is working fine", + "target_version": "0.6.1", + "previous_version": null, + "working": true, + "agent_executed_or_independently_verified": false, + "live_operations_performed_for_record": false }, - "message_source_execution_audit": { - "evidence": "20261117-major-message-coverage-200546Z/message-coverage-audit.json", - "scope": "Existing candidate execution and source audit only; previous-image case still not run" - } - }, - "calendar_content_upgrade_extension": { - "status": "PASS: fresh fullCI163.326s, real integration1224.364s, controller1400.410s; only named assertions qualified", - "worktree": "suite-calendar-etag", - "branch": "test/suite-calendar-etag", - "base": "77d9f7aabee3bed6d7ccde361ef11ced4e4bde09", - "patch_sha256": "314128ae7c2f3fa570954387110fc1fadc1d6de394f34bd2918faaceb6996510", - "evidence": "20261117-major-app-content-v3", - "scope": "Native everyday calendar/event old-image creation, content/IDs/times/ETag retention and candidate If-Match edit; not restore/offboarding/recurrence/meeting transport", - "prepared_evidence": "20261117-major-calendar-content-prepared", - "previous_content_v2_observed": { - "evidence": "20261117-major-app-content-v2", - "exit_code": 1, - "integration_seconds": 1082.514, - "full_seconds": 1256.364, - "passed_before_failure": [ - "seven upgrade commands/deploy/health and all required verified pre-upgrade backups", - "Docker credentials, Identity JWKS, Recovery pairing/key, candidate Pulse deposit with prior pairing", - "fresh candidate Drive/Notes/Calendar reciprocal native API sign-in", - "exact old Calendar event readback including ETag and editability" + "upgrade_evidence_counts": { + "ky_products": 10, + "controlled_previous_version_campaigns_passed": 8, + "additional_owner_confirmed_working_upgrade_products": [ + "kydns" ], - "failure": "fixture bare If-Match header rejected HTTP400; corrected isolated source quotes HTTP strong entity-tag", - "not_reached": [ - "successful candidate event edit", - "final Post fresh re-sign-in", - "completed integration outcome" + "products_with_successful_upgrade_evidence": 9, + "remaining_without_successful_upgrade_evidence": [ + "kyyard" ], - "kubernetes_secret_payload_count": 0 - }, - "current_passed_checks": { - "upgrade-gate": { - "exit_code": 0, - "duration_seconds": 8.095, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/upgrade-gate.result.json" - }, - "affected-compile-relay": { - "exit_code": 0, - "duration_seconds": 4.491, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/affected-compile-relay.result.json" - }, - "ci": { - "exit_code": 0, - "duration_seconds": 163.326, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/ci.result.json" - } - }, + "scope": "Operational owner reports and controlled campaign results retain distinct provenance; not a whole-suite qualification count" + } + }, + "notes_content_case": { + "tested_base": "8f36d2085c2c4110373733b01b6df62aee508ad9", + "patch_sha256": "9a2d0439e5acdce70e21cd1869ad748d2427ff125bfd5bd3f6a42f539509be31", + "old_client_attested_source": "2fb29f3871a243728d0794c3b93688fe2de45797", + "candidate_client_attested_source": "ba93e8281b3f64a9b0c5a4b786971da56180dc65", "results": { - "upgrade-gate": { + "browser-input-smoke": { + "name": "browser-input-smoke", + "command": [ + "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-notes-content-v12/browser-wrapper.sh", + "node", + "--max-old-space-size=256", + "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-notes-content-v12/browser-input-smoke.mjs" + ], + "source": "8f36d2085c2c4110373733b01b6df62aee508ad9", + "started_at": "2026-11-18T01:51:36.475085+00:00", + "finished_at": "2026-11-18T01:51:40.028217+00:00", + "duration_seconds": 3.553, "exit_code": 0, - "duration_seconds": 8.095, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/upgrade-gate.result.json" + "host": "major" }, "affected-compile-relay": { + "name": "affected-compile-relay", + "command": [ + "go", + "test", + "-tags", + "e2e,goolm", + "-count=1", + "-run", + "^(TestRelaysOffCatalog|TestNotesBrowserCertificate)$", + "./test/e2e/" + ], + "source": "8f36d2085c2c4110373733b01b6df62aee508ad9", + "started_at": "2026-11-18T01:51:40.051422+00:00", + "finished_at": "2026-11-18T01:51:46.618734+00:00", + "duration_seconds": 6.567, "exit_code": 0, - "duration_seconds": 4.491, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/affected-compile-relay.result.json" - }, - "ci": { - "exit_code": 0, - "duration_seconds": 163.326, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/ci.result.json" - }, - "real-app-upgrades": { - "exit_code": 0, - "duration_seconds": 1224.364, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/real-app-upgrades.result.json" + "host": "major" }, - "full-qualification": { - "exit_code": 0, - "duration_seconds": 1400.41, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/full-qualification.result.json" - } - }, - "completed_at": "2026-11-17T20:35:59.950686+00:00", - "kubernetes_secret_payload_count": 0 - }, - "message_history_upgrade_extension": { - "prepared_at": "2026-11-17T20:52:27.781523+00:00", - "source": "78b993ea8628bae6d5ab80c45a62e3ef0bdfb0f0", - "worktree": "/home/yoshi/git/KyQuickStart/.claude/worktrees/suite-message-catalog-upgrade", - "branch": "test/suite-message-catalog-upgrade", - "harness_patch_sha256": "c94cc8884e0b80bef52dd8a49bda514ac3b1ae2e944f7a7d1b277cd542b9caa5", - "scope": "Previous published Messages primary-image migration; old real encrypted event, verified own pre-upgrade backup, selected credential hashes, original refresh sessions/history and new encrypted event, then existing candidate offboarding/restore. Auxiliary Matrix images unchanged.", - "previous_attestation": { - "image": "ghcr.io/busnes-app/kymessage-server:0.6.0.1@sha256:426b2dd604677ecc230821c92924db2a4803fd330d579caac97728ad3e2a64a6", - "repository": "Busnes-app/KyMessage-Server", - "tag": "v0.6.0.1", - "identity": "https://github.com/Busnes-app/KyMessage-Server/.github/workflows/release-image.yml@refs/tags/v0.6.0.1", - "source_installer": "v0.6.0.8", - "source_commit": "724fc276c77a56c392ba0e402a2a90ddcd408257", - "manifest_sha256": "06df7f03202d2af0bd917de83810545c469839b62d8e2b5d2f4262ba7403b3b1", - "checked_at": "2026-11-17T20:16:26.703467+00:00", - "exit_code": 0, - "seconds": 4.23 - }, - "prerequisite": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-app-content-v3/full-qualification.result.json", - "status": "PASS: affected7.045s/fresh fullCI162.118s; real integration511.402s/controller680.688s, including subsequent candidate offboarding/history restore", - "dox": "Root optional verification contract updated; no child scope/index changes; no runtime or pin changes", - "started_by_continuation_at": "2026-11-17T20:42:48.461543+00:00", - "supersedes": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v1", - "historical_compose_sha256": "87545b604d1bcc64bbc434c4f0bbe129aa64179dd806b35fc7cf9ab797ebb060", - "correction": "Install full historical manifest+Compose entry with shared explicit fixture CA/host plumbing; old initializer cannot generate candidate guest-page file. Restore complete candidate manifest+prepatched Compose only for native CLI upgrade. No stub/generated data injection or runtime/pin change.", - "previous_failed_evidence": [ - "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v1" - ], - "previous_failed_results": { "ci": { "name": "ci", "command": [ "make", "ci" ], - "source": "77d9f7aabee3bed6d7ccde361ef11ced4e4bde09", - "started_at": "2026-11-17T20:42:54.971120+00:00", - "finished_at": "2026-11-17T20:45:37.336126+00:00", - "duration_seconds": 162.365, + "source": "8f36d2085c2c4110373733b01b6df62aee508ad9", + "started_at": "2026-11-18T01:51:46.642572+00:00", + "finished_at": "2026-11-18T01:54:29.230225+00:00", + "duration_seconds": 162.588, "exit_code": 0, "host": "major" }, - "real-message-upgrade": { - "name": "real-message-upgrade", + "real-notes-content-upgrade": { + "name": "real-notes-content-upgrade", "command": [ "env", "CGO_ENABLED=0", - "KYQ_TEST_MESSAGE_UPGRADE_MANIFEST=/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v1/previous-manifests/kymessage/manifest.yaml", + "KYQ_TEST_RELEASE_UPGRADE_MANIFESTS=/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-notes-content-v12/previous-manifests", + "KYQ_TEST_NOTES_BROWSER=1", "go", "test", "-json", @@ -781,187 +546,42 @@ "-timeout", "60m", "-run", - "^TestKubernetesKyMessage$", + "^TestKubernetesNPMEdgeJoins$", "./test/e2e/" ], - "source": "77d9f7aabee3bed6d7ccde361ef11ced4e4bde09", - "started_at": "2026-11-17T20:45:37.359019+00:00", - "finished_at": "2026-11-17T20:48:14.548635+00:00", - "duration_seconds": 157.19, - "exit_code": 1, + "source": "8f36d2085c2c4110373733b01b6df62aee508ad9", + "started_at": "2026-11-18T01:54:29.252930+00:00", + "finished_at": "2026-11-18T02:17:26.046469+00:00", + "duration_seconds": 1376.794, + "exit_code": 0, "host": "major" }, "full-qualification": { "name": "full-qualification", "command": [ "/usr/bin/python3", - "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v1/run-qualification.py" + "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-notes-content-v12/run-qualification.py" ], - "source": "77d9f7aabee3bed6d7ccde361ef11ced4e4bde09", - "started_at": "2026-11-17T20:42:48.497511+00:00", - "finished_at": "2026-11-17T20:48:14.557640+00:00", - "duration_seconds": 326.06, - "exit_code": 1, - "host": "major" - } - }, - "results": { - "affected-compile-relay": { - "exit_code": 0, - "duration_seconds": 7.045, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v2/affected-compile-relay.result.json" - }, - "ci": { - "exit_code": 0, - "duration_seconds": 162.118, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v2/ci.result.json" - }, - "real-message-upgrade": { - "exit_code": 0, - "duration_seconds": 511.402, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v2/real-message-upgrade.result.json" - }, - "full-qualification": { - "exit_code": 0, - "duration_seconds": 680.688, - "result_file": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-message-upgrade-v2/full-qualification.result.json" - } - }, - "completed_at": "2026-11-17T21:03:48.525687+00:00", - "publication_tree_equivalence": "20261117-major-message-upgrade-v2/publish-tree-equivalence.result.json:344 non-doc files equal; new report metadata only; no fresh execution claimed on publication ancestry", - "scope_limit": "Primary console migration with unchanged upstream Matrix image versions; selected key/session/history and subsequent candidate restore/offboarding, not restore of old pre-upgrade snapshot or all meeting/guest features" - }, - "notes_content_feasibility": { - "evidence": "20261117-major-notes-content-audit-2029Z/notes-content-feasibility.json", - "kind": "source only; not qualification", - "old_source": "2fb29f3871a243728d0794c3b93688fe2de45797", - "candidate_attested_source": "ba93e8281b3f64a9b0c5a4b786971da56180dc65", - "unchanged_client_files": 6, - "requires": "Ordinary SSO identity enrollment, action-bound KyIdentity reauthentication, saved recovery copy, old bundled-client notebook/page content, isolated key store retained over CLI upgrade, candidate decrypt/edit; no ciphertext injection", - "execution_started": false - }, - "post_fixture_scope": { - "evidence": "20261117-major-post-scope-audit-2034Z/post-fixture-scope.json", - "kind": "source-only scope audit", - "candidate_attested_source": "7b067ded42ca0ede5f3efdfd649cd6ffc3be3cad", - "native_mail_enabled_in_fixture": false, - "limit": "No mail block selects IMAP-proxy mode; native workforce mailbox/content/admin-denial remains unqualified. Empty mailbox listings or absent IMAP config are not isolation proof. Separate saltmarsh workforce capacity tests use different builds and still fail their target." - }, - "consolidated_review_tree": { - "source": "704cf0ab33cbb38cd5b1fbdcd745050d92172482", - "worktree": "suite-lifecycle-acceptance", - "branch": "test/suite-lifecycle-acceptance", - "test_input_patch_sha256": "734ca5c0b30b859ed6db892179b0f2ec813f39b345235cc3e002f20c3b2431fc", - "results": { - "affected-compile-relay": { - "exit_code": 0, - "duration_seconds": 6.689 - }, - "ci": { - "exit_code": 0, - "duration_seconds": 163.476 - }, - "full-qualification": { - "exit_code": 0, - "duration_seconds": 170.24 - } - }, - "integration_reuse": { - "app_integration_source": "/home/yoshi/git/KyQuickStart/.claude/worktrees/suite-calendar-etag", - "identical_non_docs_files_except_drive": 341, - "drive_test_exact_pr206_head": true, - "runtime_pins_and_dependencies_unchanged": true - }, - "fresh_combined_integration_run": false, - "publication_base": "597ec940141b3d7a14000a0c2d995422cba1efc5", - "ancestry_only_rebase": "Old PR206 head tree and merged master base tree identical; feature code tree unchanged by rebase; private ancestry-only-rebase.result.json retains proof" - }, - "calendar_native_restore_extension": { - "status": "PASS: candidate native capsule recovery with retained keys, revoked old sessions and fresh ordinary event access/edit", - "recorded_at": "2026-11-17T22:35:55.331839+00:00", - "worktree": "/home/yoshi/git/KyQuickStart/.claude/worktrees/suite-calendar-native-restore", - "branch": "test/suite-calendar-native-restore", - "base": "50ca7a4d8128950bd4626e3cfdd70c87cb40c5bd", - "patch_sha256": "01eac85d9c8e59b6d3cd931550ef5432ade1986925fceb83d004acba1bce54bb", - "evidence": "20261117-major-calendar-native-restore-v1", - "checks_passed": { - "upgrade-gate": { - "exit_code": 0, - "duration_seconds": 7.536, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/upgrade-gate.result.json" - }, - "affected-compile-relay": { + "source": "8f36d2085c2c4110373733b01b6df62aee508ad9", + "started_at": "2026-11-18T01:51:36.417871+00:00", + "finished_at": "2026-11-18T02:17:26.054783+00:00", + "duration_seconds": 1549.637, "exit_code": 0, - "duration_seconds": 4.533, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/affected-compile-relay.result.json" - }, - "ci": { - "exit_code": 0, - "duration_seconds": 163.822, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/ci.result.json" - } - }, - "scope": "Seven actual previous-image configuration/pairing upgrades + ordinary Calendar event; additional candidate native capsule export/two-share offline restore, one-share refusal, key retention, old-session revocation/fresh native access/event edit. NOT Calendar offboarding, restored old pre-upgrade claim copy, meeting delivery, or installer resume after native restore.", - "dox": "Separate isolated harness root Verification documents KYQ_TEST_CALENDAR_RESTORE=1; baseline ownership/child indexes unchanged", - "results": { - "upgrade-gate": { - "exit_code": 0, - "duration_seconds": 7.536, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/upgrade-gate.result.json" - }, - "affected-compile-relay": { - "exit_code": 0, - "duration_seconds": 4.533, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/affected-compile-relay.result.json" - }, - "ci": { - "exit_code": 0, - "duration_seconds": 163.822, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/ci.result.json" - }, - "real-calendar-native-restore": { - "exit_code": 0, - "duration_seconds": 1242.651, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/real-calendar-native-restore.result.json" - }, - "full-qualification": { - "exit_code": 0, - "duration_seconds": 1418.664, - "evidence": "/home/yoshi/.local/state/kyquickstart-acceptance/20261117-major-calendar-native-restore-v1/full-qualification.result.json" + "host": "major" } }, - "named_assertions_qualified": true, - "whole_suite_qualified": false - }, - "notes_browser_tls_prerequisite": { - "status": "PASS: fixture TLS transport prerequisite only, NOT Notes application acceptance", - "limits": "Go jobs remainTasks128. Browser-onlyTasks256 is owner-approved; same2GiB/noSwap/2CPU/exclusiveheavylock.", - "notes_application_qualification": false, - "previous_failed_run": { - "evidence": "20261117-major-notes-browser-trust-v11", - "exit_code": 1, - "seconds": 2.111, - "peak_tasks": 172, - "pids_limit_events": 0, - "failure": "MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT", - "tls_verification_disabled": false - }, - "last_run": { - "evidence": "20261117-major-notes-browser-trust-v12", - "exit_code": 0, - "seconds": 2.244, - "peak_tasks": 157, - "pids_limit_events": 0, - "positive_https": true, - "wrong_hostname_refused": "SSL_ERROR_BAD_CERT_DOMAIN", - "tls_verification_disabled": false, - "private_ca_trust_only": true - }, - "completed_followup": { - "evidence": "20261117-major-notes-browser-trust-v12", - "status": "PASS: actual isolated browser positiveHTTPS and wrong-host refusal; no Notes application case implemented", - "script_sha256": "1efa42926960b609bcd01e350d825c23ca6d634186afe3713c843e138ab12d33", - "change": "Own namedCA + signed server certificate, only private NSS authority trust, positiveHTTPS and exact wrong-host denial; no TLS override" - } + "notes_content_qualified": true, + "whole_suite_qualified": false, + "scope": "Published old native encrypted notebook/page and exact Unicode content; seven old-image CLI upgrades; retained browser keys/fresh native SSO/server-backed decryption; exact edited UI/native save/cache-evicted exact reload. Not Notes offboarding, key-loss recovery, all page types or whole-suite release qualification.", + "seed_request_bodies_inspected": 9, + "edit_request_bodies_inspected": 2, + "uninspectable_bodies": 0, + "plaintext_markers_seen": false, + "last_put_digests_match_stored_ciphertext": true, + "caret_inside_original_paragraph_at_end": true, + "exact_edited_characters": 78, + "edited_paragraphs": 1, + "key_records_unchanged_after_owned_note_cache_evictions": true, + "private_evidence_name": "20261117-major-notes-content-v12/successful-content-upgrade-milestone.json" } } diff --git a/test/e2e/notes_browser.mjs b/test/e2e/notes_browser.mjs new file mode 100644 index 0000000..99a3ae9 --- /dev/null +++ b/test/e2e/notes_browser.mjs @@ -0,0 +1,388 @@ +// Optional real bundled-client upgrade case. No product crypto is implemented here. +import assert from "node:assert/strict"; +import { appendText, replaceContentText, focusParagraphEnd } from "./notes_input.mjs"; +import { createHash } from "node:crypto"; +import { readFile, writeFile, chmod } from "node:fs/promises"; +import http from "node:http"; +import net from "node:net"; +import path from "node:path"; + +let input = ""; +for await (const chunk of process.stdin) input += chunk; +const config = JSON.parse(input); +input = ""; +const { firefox } = await import(config.module); +const notebook = "Everyday migration notebook 漢字"; +const title = "Private everyday page café"; +const body = "Old image encrypted text ✓ 漢字 café"; +const edited = "Candidate edited text ✓ retained client key"; +let stage = "start"; +let context; +let captureEditorProof; +let badWire = false; +let unexpectedDialog = false; +let confirmations = 0; +const diagnostics = { badResponses: [], failedRequests: [], pageErrors: [], loginProofs: [] }; +const log = (next) => { stage = next; console.log(JSON.stringify({ at: new Date().toISOString(), stage, phase: config.phase })); }; +const sha256 = bytes => createHash("sha256").update(bytes).digest("hex"); +const allowed = new Set([new URL(config.notes).host, new URL(config.identity).host]); +const proxy = http.createServer((_req, res) => { res.writeHead(403).end(); }); +const sockets = new Set(); +proxy.on("connection", socket => { sockets.add(socket); socket.on("close", () => sockets.delete(socket)); }); +proxy.on("connect", (req, client, head) => { + if (!allowed.has(req.url)) { client.end("HTTP/1.1 403 Forbidden\r\n\r\n"); return; } + const remote = net.connect({ host: config.nodeIP, port: 30443 }, () => { + client.write("HTTP/1.1 200 Connection Established\r\n\r\n"); + if (head.length) remote.write(head); + client.pipe(remote); remote.pipe(client); + }); + client.on("error", () => remote.destroy()); + remote.on("error", () => client.destroy()); + client.on("close", () => remote.destroy()); +}); +await new Promise(resolve => proxy.listen(0, "127.0.0.1", resolve)); +const proxyPort = proxy.address().port; +let exitCode = 1; +try { + log("launch"); + context = await firefox.launchPersistentContext(config.profile, { + executablePath: config.browser, channel: "moz-firefox", headless: true, + timeout: 30000, ignoreHTTPSErrors: false, viewport: { width: 1280, height: 900 }, + firefoxUserPrefs: { + "network.proxy.type": 1, "network.proxy.ssl": "127.0.0.1", "network.proxy.ssl_port": proxyPort, + "network.proxy.no_proxies_on": "", "dom.ipc.processCount": 1, + "dom.ipc.processCount.webIsolated": 1, "fission.autostart": false, + "remote.prefs.recommended": false, "browser.newtab.preload": false, + "gfx.webrender.render-backend-thread-count": 1, "dom.ipc.processPrelaunch.enabled": false, + }, + }); + // BiDi exposes no request body. Observe bounded copies of the native fetch + // arguments without changing the request, headers, response or confirmation flow. + await context.addInitScript(({ origin, markers }) => { + const nativeFetch = window.fetch; + const proof = { pending: 0, inspectedBodies: 0, uninspectableBodies: 0, plaintextSeen: false, records: [] }; + window.__kyqContentRequests = proof; + window.fetch = function(resource, init) { + try { + const url = new URL(resource instanceof Request ? resource.url : String(resource), location.href); + const method = String(init?.method ?? (resource instanceof Request ? resource.method : "GET")).toUpperCase(); + if (url.origin === origin && /^\/api\/v1\/(objects|containers)(?:\/|$)/.test(url.pathname) && !["GET", "HEAD"].includes(method)) { + if (proof.records.length >= 128) proof.uninspectableBodies += 1; + else { + const record = { method, path: url.pathname, bytes: 0, sha256: "" }; + proof.records.push(record); + const body = init?.body ?? (resource instanceof Request ? resource.clone().arrayBuffer() : null); + let bytes; + if (body == null) bytes = new Uint8Array(); + else if (typeof body === "string") bytes = new TextEncoder().encode(body); + else if (body instanceof ArrayBuffer) bytes = new Uint8Array(body.slice(0)); + else if (ArrayBuffer.isView(body)) bytes = new Uint8Array(body.buffer, body.byteOffset, body.byteLength).slice(); + else if (body instanceof Blob) bytes = body.slice().arrayBuffer(); + else if (body instanceof URLSearchParams) bytes = new TextEncoder().encode(body.toString()); + else if (body instanceof Promise) bytes = body; + else throw new Error("uninspectable body type"); + proof.pending += 1; + Promise.resolve(bytes).then(async value => { + const data = value instanceof Uint8Array ? value : new Uint8Array(value); + if (data.byteLength > 1048576) throw new Error("observer body cap"); + const text = new TextDecoder().decode(data); + if (markers.some(marker => text.includes(marker))) proof.plaintextSeen = true; + record.bytes = data.byteLength; + record.sha256 = Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", data))).map(byte => byte.toString(16).padStart(2, "0")).join(""); + proof.inspectedBodies += 1; + }).catch(() => { proof.uninspectableBodies += 1; }).finally(() => { proof.pending -= 1; }); + } + } + } catch { proof.uninspectableBodies += 1; } + return Reflect.apply(nativeFetch, this, arguments); + }; + }, { origin: config.notes, markers: [notebook, title, body, edited].flatMap(text => [text, text.split(/[^\x00-\x7F]/)[0].trim()]).filter(text => text.length > 8) }); + // Preserve the client keystore, but force fresh native sessions in both phases. + await context.clearCookies(); + context.setDefaultTimeout(60000); + const page = await context.newPage(); + const safeURL = raw => { const url = new URL(raw); return { origin: url.origin, route: url.pathname.split("/").slice(0, 4).join("/") }; }; + page.on("response", response => { if (response.status() >= 400 && diagnostics.badResponses.length < 20) diagnostics.badResponses.push({ status: response.status(), ...safeURL(response.url()) }); }); + page.on("requestfailed", request => { if (diagnostics.failedRequests.length < 20) diagnostics.failedRequests.push({ ...safeURL(request.url()), code: request.failure()?.errorText.match(/(?:NS_ERROR_[A-Z_]+|SSL_ERROR_[A-Z_]+|ERR_[A-Z_]+)/)?.[0] ?? "network failure" }); }); + page.on("pageerror", error => { diagnostics.pageErrors.push({ name: error.name, kind: error.message.match(/^(?:ReferenceError|TypeError|SyntaxError|Error)/)?.[0] ?? "script error" }); }); + page.on("dialog", async dialog => { + if (dialog.type() === "prompt" && dialog.message() === "Notebook name") await dialog.accept(notebook); + else { unexpectedDialog = true; await dialog.dismiss(); } + }); + async function replaceText(target, control, text) { + await control.click(); + await control.press("ControlOrMeta+A"); + await control.press("Backspace"); + await appendText(target, text); + assert.equal(await control.inputValue(), text); + } + async function identityPassword(target) { + log("identity-origin-redirect"); + await target.waitForURL(url => url.origin === config.identity, { timeout: 30000 }); + const username = target.getByLabel("Username", { exact: true }); + log("identity-username-control"); + await username.waitFor(); + const password = target.getByLabel("Password", { exact: true }); + await password.evaluate(input => { + window.__kyqAuthEvents = { inputs: 0, trustedInputs: 0, submits: 0 }; + input.form.addEventListener("input", event => { window.__kyqAuthEvents.inputs += 1; if (event.isTrusted) window.__kyqAuthEvents.trustedInputs += 1; }, true); + input.form.addEventListener("submit", () => { window.__kyqAuthEvents.submits += 1; }, true); + }); + if (await username.isEditable()) { + await replaceText(target, username, config.username); + } + assert.equal(await username.inputValue(), config.username); + log("identity-password-control"); + await replaceText(target, password, config.password); + assert.equal(await password.inputValue(), config.password); + assert.equal(await password.evaluate(input => input.form.checkValidity()), true); + const observed = target.waitForResponse(response => new URL(response.url()).origin === config.identity && new URL(response.url()).pathname === "/api/auth/login" && response.request().method() === "POST", { timeout: 30000 }).then(response => ({ response }), error => ({ error })); + log("identity-signin-submit"); + await target.getByRole("button", { name: "Sign in", exact: true }).click(); + log("identity-login-response"); + const observation = await observed; + if (observation.error) throw observation.error; + const response = observation.response; + assert.equal(response.request().postDataJSON(), null, "BiDi request-body capability changed; review observer coverage"); + const reply = await response.json(); + assert.ok(reply && typeof reply === "object"); + const proof = { status: response.status(), inputValuesMatchFixture: true, protocolRequestBodyAvailable: false, usernameMatchesFixture: reply.user?.username === config.username, success: reply.success === true, mfaRequired: reply.mfaRequired === true, userReturned: Boolean(reply.user), passwordChangeRequired: reply.user?.passwordChangeRequired === true, enrollmentRestricted: reply.user?.enrollment?.restricted === true, restartAuthorization: reply.restartAuthorization === true }; + diagnostics.loginProofs.push(proof); + console.log(JSON.stringify({ at: new Date().toISOString(), stage: "identity-login-proof", phase: config.phase, ...proof })); + assert.equal(proof.status, 200); + assert.equal(proof.success, true); + assert.equal(proof.usernameMatchesFixture, true); + assert.equal(proof.mfaRequired, false); + assert.equal(proof.userReturned, true); + assert.equal(proof.passwordChangeRequired, false); + assert.equal(proof.enrollmentRestricted, false); + assert.equal(proof.restartAuthorization, false); + } + // Each protected action must complete the product's real action-bound confirmation. + async function confirmAction(dialog) { + const popupPromise = context.waitForEvent("page"); + await dialog.getByRole("button", { name: "Continue to KySignOn", exact: true }).click(); + const popup = await popupPromise; + await identityPassword(popup); + await dialog.waitFor({ state: "hidden" }); + confirmations += 1; + } + async function confirmed(promise) { + let settled; + promise.then(value => { settled = { value }; }, error => { settled = { error }; }); + const deadline = Date.now() + 90000; + while (!settled && Date.now() < deadline) { + const dialog = page.getByRole("dialog", { name: "Confirm this action", exact: true }); + if (await dialog.isVisible()) await confirmAction(dialog); + await new Promise(resolve => setTimeout(resolve, 100)); + } + assert.ok(settled, "protected action did not finish"); + if (settled.error) throw settled.error; + return settled.value; + } + log("native-oidc-signin"); + log("notes-login-navigation"); + await page.goto(config.notes + "/"); + log("notes-sso-link"); + await page.getByRole("link", { name: "Continue with single sign-on", exact: true }).click(); + await identityPassword(page); + log("notes-native-callback"); + await page.waitForURL(url => url.origin === config.notes); + log("notes-workspace-navigation"); + await page.locator("#notebook-navigation").waitFor({ state: "attached" }); + const saved = () => { + const pending = page.waitForResponse(response => response.request().method() === "PUT" && /\/api\/v1\/objects\/obj_/.test(response.url()) && response.ok()); + // A click may fail first. Handle rejection now, while the caller still awaits the original promise. + pending.catch(() => {}); + return pending; + }; + const readState = async objectID => { + const values = await page.evaluate(async id => { + const identityResponse = await fetch("/api/v1/me/identity"); + const objectResponse = await fetch("/api/v1/objects/" + encodeURIComponent(id)); + if (!identityResponse.ok || !objectResponse.ok) throw new Error("native state read refused"); + return { identity: await identityResponse.json(), bytes: Array.from(new Uint8Array(await objectResponse.arrayBuffer())) }; + }, objectID); + const identity = values.identity; + assert.equal(typeof identity.deviceId, "string"); + assert.equal(typeof identity.publicKey, "string"); + assert.equal(typeof identity.recoveryId, "string"); + assert.ok(identity.recoveryId.length > 0); + const bytes = Buffer.from(values.bytes); + assert.ok(bytes.length > 0); + assert.ok(![title, body, edited].some(text => bytes.includes(Buffer.from(text)))); + await page.waitForFunction(() => window.__kyqContentRequests?.pending === 0); + const observed = await page.evaluate(() => window.__kyqContentRequests); + assert.ok(observed); + assert.equal(observed.uninspectableBodies, 0); + assert.equal(observed.plaintextSeen, false); + badWire ||= observed.plaintextSeen; + const objectSHA256 = sha256(bytes); + const lastWrite = observed.records.filter(record => record.method === "PUT" && record.path === "/api/v1/objects/" + objectID).at(-1); + if (config.phase === "seed" || lastWrite) { + assert.ok(lastWrite && lastWrite.bytes > 0); + assert.equal(lastWrite.sha256, objectSHA256, "native fetch body differs from stored ciphertext"); + } + console.log(JSON.stringify({ at: new Date().toISOString(), stage: "native-content-request-proof", phase: config.phase, inspectedBodies: observed.inspectedBodies, uninspectableBodies: 0, plaintextSeen: false, storedCiphertextMatchesLastWrite: Boolean(lastWrite) })); + return { identity: { deviceId: identity.deviceId, publicKey: identity.publicKey, recoveryId: identity.recoveryId }, objectSHA256 }; + }; + captureEditorProof = async label => { + const values = await page.locator(".bn-editor").evaluateAll(editors => Array.from(editors).slice(0, 4).map(editor => ({ text: editor.innerText.slice(0, 65536), raw: (editor.textContent ?? "").slice(0, 65536), paragraphs: editor.querySelectorAll("p").length }))); + const expected = body + " " + edited; + const proofs = values.map(({ text, raw, paragraphs }) => ({ characters: text.length, sha256: sha256(text), rawCharacters: raw.length, rawSHA256: sha256(raw), paragraphs, matchesOld: text === body, matchesExpectedEdit: text === expected, containsOld: text.includes(body), containsEdit: text.includes(edited), expectedPrefix: expected.startsWith(text), expectedSuffix: expected.endsWith(text), matchesIfWhitespaceCollapsed: text.replace(/\s+/gu, " ").trim() === expected, whitespace: Array.from(text).flatMap((character, index) => /\s/u.test(character) ? [{ index, codePoint: character.codePointAt(0) }] : []).slice(0, 128) })); + const proof = { at: new Date().toISOString(), stage: "editor-content-proof", point: label, phase: config.phase, editorCount: values.length, expectedCharacters: expected.length, expectedSHA256: sha256(expected), editors: proofs }; + diagnostics.editorProofs ??= []; + if (diagnostics.editorProofs.length < 8) diagnostics.editorProofs.push(proof); + console.log(JSON.stringify(proof)); + }; + async function flushPage() { + const flushed = saved(); + await page.getByRole("button", { name: "Save", exact: true }).click(); + await confirmed(flushed); + await page.waitForFunction(() => document.querySelector(".save-state .ky-status")?.textContent === "Saved to server" && !document.querySelector(".save-detail")?.textContent.includes("Autosaving")); + } + async function dropOwnedContentCache() { + // No app scripts run on healthz. Remove only this throwaway profile's content cache, + // after proving its queues empty; retained identity/key records must remain byte-identical. + await page.goto(config.notes + "/healthz"); + const proof = await page.evaluate(async () => { + const request = indexedDB.open("kynotes-web"); + const db = await new Promise((resolve, reject) => { request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error); request.onupgradeneeded = () => { request.transaction.abort(); reject(new Error("expected existing client database")); }; }); + try { + if (db.version !== 7 || !["notes", "pending", "uploads", "keys"].every(name => db.objectStoreNames.contains(name))) throw new Error("unexpected client cache schema"); + const all = name => new Promise((resolve, reject) => { const req = db.transaction(name).objectStore(name).getAll(); req.onsuccess = () => resolve(req.result); req.onerror = () => reject(req.error); }); + const digest = async rows => Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(rows, (_key, value) => value instanceof Uint8Array ? Array.from(value) : value))))).map(byte => byte.toString(16).padStart(2, "0")).join(""); + const pending = await all("pending"), uploads = await all("uploads"), keys = await all("keys"); + if (pending.length || uploads.length || !keys.length) throw new Error("unsent data or missing retained client keys"); + const keySHA256 = await digest(keys); + const notes = await all("notes"); + if (!notes.length) throw new Error("expected real cached content before eviction"); + await new Promise((resolve, reject) => { const tx = db.transaction("notes", "readwrite"); tx.objectStore("notes").clear(); tx.oncomplete = resolve; tx.onerror = () => reject(tx.error); tx.onabort = () => reject(tx.error); }); + if ((await all("notes")).length || await digest(await all("keys")) !== keySHA256) throw new Error("cache eviction changed retained keys"); + return { evictedNoteRows: notes.length, retainedKeyRows: keys.length, keySHA256, pendingRows: 0, uploadRows: 0 }; + } finally { db.close(); } + }); + assert.ok(proof.evictedNoteRows > 0); + assert.ok(proof.retainedKeyRows > 0); + log("owned-content-cache-evicted-retained-keys-unchanged"); + return proof; + } + if (config.phase === "seed") { + log("native-device-key-enrollment"); + await page.getByRole("button", { name: "Set up encryption key", exact: true }).click(); + const code = page.locator('[aria-label="Recovery code"]'); + await confirmed(code.waitFor()); + const downloadPromise = page.waitForEvent("download"); + await page.getByRole("button", { name: "Download as a text file", exact: true }).click(); + const download = await downloadPromise; + const recoveryPath = path.join(path.dirname(config.expected), "recovery-code.txt"); + await download.saveAs(recoveryPath); await chmod(recoveryPath, 0o600); + const recoveryText = await readFile(recoveryPath, "utf8"); + const match = recoveryText.match(/\b([A-Z0-9]{4}(?:-[A-Z0-9]{4}){6})\b/); + assert.ok(match); + await page.getByRole("button", { name: "I saved it", exact: true }).click(); + const group = page.getByLabel(/Type group \d of 7 from your saved copy/); + const label = await group.evaluate(input => input.labels[0].textContent); + const number = Number(label.match(/Type group (\d) of 7/)[1]); + await replaceText(page, group, match[1].split("-")[number - 1]); + log("native-recovery-copy-confirmation"); + await page.getByRole("button", { name: "Save recovery code", exact: true }).click(); + await confirmed(page.getByText("Recovery code saved. Keep it somewhere safe.", { exact: true }).waitFor()); + await page.getByRole("navigation", { name: "Primary", exact: true }).getByRole("button", { name: "Notes", exact: true }).click(); + log("old-client-encrypted-notebook-create"); + const containerResponse = page.waitForResponse(response => response.request().method() === "POST" && new URL(response.url()).pathname === "/api/v1/containers" && response.ok()); + await page.getByRole("button", { name: "+ New notebook", exact: true }).click(); + const container = await (await confirmed(containerResponse)).json(); + assert.equal(typeof container.id, "string"); + await confirmed(page.getByText(notebook, { exact: true }).first().waitFor()); + await page.locator('.note-list[aria-busy="false"]').waitFor(); + log("old-client-encrypted-page-create"); + const created = saved(); + const newPage = page.getByRole("button", { name: "New page", exact: true }); + console.log(JSON.stringify({ at: new Date().toISOString(), stage, phase: config.phase, newPageControls: await newPage.count() })); + log("old-client-new-page-click"); + await newPage.click(); + log("old-client-new-page-save-response"); + const objectID = new URL((await confirmed(created)).url()).pathname.split("/").pop(); + assert.match(objectID, /^obj_/); + log("old-client-page-title-input"); + const titled = saved(); + const titleControl = page.getByLabel("Page title", { exact: true }); + await replaceContentText(page, titleControl, title); + const actualTitle = await titleControl.inputValue(); + console.log(JSON.stringify({ at: new Date().toISOString(), stage: "title-input-proof", phase: config.phase, matches: actualTitle === title, actualLength: actualTitle.length, expectedLength: title.length, actualSHA256: sha256(actualTitle), expectedSHA256: sha256(title), prefixMatches: actualTitle.startsWith(title.slice(0, -1)), unicodeSuffixMatches: actualTitle.endsWith(title.slice(-1)) })); + assert.equal(actualTitle, title); + await confirmed(titled); + log("old-client-page-body-input"); + const written = saved(); + await page.getByRole("button", { name: "Add text", exact: true }).click(); + await page.locator(".bn-editor").first().click(); + await appendText(page, body); await confirmed(written); + assert.equal(await page.locator(".bn-editor").first().innerText(), body); + assert.ok(confirmations >= 2); + await flushPage(); + const expected = { containerID: container.id, objectID, ...await readState(objectID) }; + expected.cacheEviction = await dropOwnedContentCache(); + await writeFile(config.expected, JSON.stringify(expected) + "\n", { mode: 0o600, flag: "wx" }); + log("old-client-encrypted-content-seeded"); + } else { + assert.equal(config.phase, "verify"); + const expected = JSON.parse(await readFile(config.expected, "utf8")); + log("candidate-ciphertext-and-identity-retained"); + assert.deepEqual(await readState(expected.objectID), { identity: expected.identity, objectSHA256: expected.objectSHA256 }); + await page.goto(config.notes + "/#/" + expected.containerID); + await confirmed(page.getByText(notebook, { exact: true }).first().waitFor()); + await page.locator(".note-list").getByText(title, { exact: true }).click(); + await page.getByLabel("Page title", { exact: true }).waitFor(); + assert.equal(await page.getByLabel("Page title", { exact: true }).inputValue(), title); + await page.waitForFunction(text => document.querySelector(".bn-editor")?.innerText === text, body); + log("candidate-old-client-key-decryption-passed"); + await captureEditorProof("before-edit"); + log("candidate-append-edit-input"); + const written = saved(); + const editor = page.locator(".bn-editor").first(); + const caret = await focusParagraphEnd(page, editor.locator("p").first()); + console.log(JSON.stringify({ at: new Date().toISOString(), stage: "original-paragraph-caret-proof", phase: config.phase, ...caret })); + assert.deepEqual(caret, { inside: true, collapsed: true, atEnd: true }); + await appendText(page, " " + edited); await confirmed(written); + await captureEditorProof("after-input"); + await page.waitForFunction(text => document.querySelector(".bn-editor")?.innerText === text, body + " " + edited); + log("candidate-edit-visible-before-save"); + await flushPage(); + await captureEditorProof("after-save"); + const changed = await readState(expected.objectID); + assert.deepEqual(changed.identity, expected.identity); + assert.notEqual(changed.objectSHA256, expected.objectSHA256); + await dropOwnedContentCache(); + log("candidate-cache-evicted-reload"); + await page.goto(config.notes + "/#/" + expected.containerID); + await page.locator(".note-list").getByText(title, { exact: true }).click(); + await captureEditorProof("after-reload-open"); + await page.waitForFunction(text => document.querySelector(".bn-editor")?.innerText === text, body + " " + edited); + log("candidate-edit-save-reload-decryption-passed"); + } + assert.equal(badWire, false, "plaintext entered an encrypted content request"); + assert.equal(unexpectedDialog, false, "unexpected user consent dialog"); + log("passed"); + exitCode = 0; +} catch (error) { + try { await captureEditorProof?.("failure"); } catch { /* Primary safe diagnostic still follows. */ } + // Locator call logs can contain entered credentials/recovery codes. Keep only stage and class. + const pages = []; + for (const page of context?.pages() ?? []) { + try { + const url = new URL(page.url()); + pages.push({ origin: url.origin, route: url.pathname.split("/").slice(0, 4).join("/"), + ui: await page.evaluate(() => ({ username: Boolean(document.querySelector('input[autocomplete="username"]')), password: Boolean(document.querySelector('input[type="password"]')), ssoLink: Boolean(document.querySelector('a[href="/api/v1/auth/oidc/login"]')), notebookNavigation: Boolean(document.querySelector("#notebook-navigation")), hasRootChildren: Boolean(document.querySelector("#root")?.childElementCount), secureContext: window.isSecureContext, webCrypto: Boolean(window.crypto?.subtle), formEvents: window.__kyqAuthEvents ?? null, alertPresent: Boolean(document.querySelector('[role="alert"]')), alertCategories: (() => { const text = document.querySelector('[role="alert"]')?.textContent ?? ""; return { csrf: /csrf|cross.site/i.test(text), credentials: /invalid.*password|invalid.*credential|incorrect.*password/i.test(text), responseShape: /invalid.*response|invalid.*reply|reported.*no account/i.test(text), expired: /expired|cancelled/i.test(text) }; })() })) }); + } catch { pages.push({ diagnosticUnavailable: true }); } + } + console.error(JSON.stringify({ at: new Date().toISOString(), stage, phase: config.phase, failed: true, errorClass: error.name, failureKinds: { strictLocator: /strict mode violation/i.test(error.message), timeout: /timeout/i.test(error.message), closed: /has been closed/i.test(error.message), unsupportedKey: /unknown key|unsupported key/i.test(error.message), selector: /selector|aria-role/i.test(error.message), invalidURL: /invalid url/i.test(error.message), assertion: error.name === "AssertionError" }, sourceLocations: Array.from((error.stack ?? "").matchAll(/notes_browser\.mjs:(\d+):(\d+)/g), match => ({ line: Number(match[1]), column: Number(match[2]) })).slice(0, 5), operation: error.message.match(/^(?:page|locator|browserContext|browser)\.[A-Za-z]+/)?.[0], pages, diagnostics })); +} finally { + if (context) { + const closed = await Promise.race([context.close().then(() => true), new Promise(resolve => setTimeout(() => resolve(false), 5000))]); + if (!closed) exitCode = 1; + } + for (const socket of sockets) socket.destroy(); + proxy.close(); +} +process.exit(exitCode); diff --git a/test/e2e/notes_browser_test.go b/test/e2e/notes_browser_test.go new file mode 100644 index 0000000..41db613 --- /dev/null +++ b/test/e2e/notes_browser_test.go @@ -0,0 +1,156 @@ +//go:build e2e + +package e2e + +import ( + "bytes" + "context" + "crypto/rand" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" + "encoding/json" + "encoding/pem" + "math/big" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/Busnes-app/kyquickstart/internal/kube" +) + +// browserEdgeCertificate keeps normal fixture behavior unless the real browser case is selected. +// Browsers need an actual issuing CA, rather than peer trust in a self-signed server leaf. +func browserEdgeCertificate(t *testing.T) ([]byte, []byte) { + t.Helper() + if os.Getenv("KYQ_TEST_NOTES_BROWSER") != "1" { + return testCertificate(t) + } + caKey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + ca := &x509.Certificate{SerialNumber: big.NewInt(11), Subject: pkix.Name{CommonName: "owned Notes acceptance CA"}, NotBefore: time.Now().Add(-time.Hour), NotAfter: time.Now().Add(24 * time.Hour), IsCA: true, BasicConstraintsValid: true, KeyUsage: x509.KeyUsageCertSign | x509.KeyUsageCRLSign} + caDER, err := x509.CreateCertificate(rand.Reader, ca, ca, &caKey.PublicKey, caKey) + if err != nil { + t.Fatal(err) + } + key, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + leaf := &x509.Certificate{SerialNumber: big.NewInt(12), Subject: pkix.Name{CommonName: "*.example.test"}, DNSNames: []string{"*.example.test"}, NotBefore: ca.NotBefore, NotAfter: ca.NotAfter, BasicConstraintsValid: true, KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageKeyEncipherment, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}} + der, err := x509.CreateCertificate(rand.Reader, leaf, ca, &key.PublicKey, caKey) + if err != nil { + t.Fatal(err) + } + chain := append(pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der}), pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: caDER})...) + return chain, pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) +} + +// seedNotesBrowser uses only the published old client's UI and returns the candidate verification. +// Its private browser profile retains client keys; cookies are cleared for fresh native sign-in. +func seedNotesBrowser(t *testing.T, ctx context.Context, c *kube.Client, certPEM []byte, nodeIP string) func() { + t.Helper() + if os.Getenv("KYQ_TEST_NOTES_BROWSER") != "1" { + return nil + } + work := t.TempDir() + profile := filepath.Join(work, "profile") + if err := os.Mkdir(profile, 0o700); err != nil { + t.Fatal(err) + } + var caPEM []byte + for rest := certPEM; len(rest) > 0; { + block, next := pem.Decode(rest) + rest = next + if block == nil { + t.Fatal("invalid browser fixture chain") + } + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + t.Fatal(err) + } + if cert.IsCA { + caPEM = pem.EncodeToMemory(block) + } + } + if len(caPEM) == 0 { + t.Fatal("browser fixture has no issuing CA") + } + caFile := filepath.Join(work, "ca.pem") + if err := os.WriteFile(caFile, caPEM, 0o600); err != nil { + t.Fatal(err) + } + for _, args := range [][]string{{"-N", "-d", "sql:" + profile, "--empty-password"}, {"-A", "-d", "sql:" + profile, "-n", "owned Notes acceptance CA", "-t", "C,,", "-i", caFile}} { + if out, err := exec.CommandContext(ctx, "certutil", args...).CombinedOutput(); err != nil { + t.Fatalf("private browser CA: %v %s", err, out) + } + } + ns, pod, container, err := c.AppPod(ctx, "kyidentity") + if err != nil { + t.Fatal(err) + } + password, err := c.Exec(ctx, ns, pod, container, []string{"cat", "/data/installer/" + identityFixturePreparation().SetupID + "/everyday.password"}) + if err != nil || len(password) == 0 { + t.Fatal("browser everyday credential unavailable") + } + defer clear(password) + config := map[string]string{"profile": profile, "expected": filepath.Join(work, "expected.json"), "notes": "https://" + catalogNotesURLHost, "identity": "https://" + catalogIdentityURLHost, "username": "prepared-user", "password": strings.TrimSpace(string(password)), "nodeIP": nodeIP, "module": os.Getenv("KYQ_TEST_BROWSER_MODULE"), "browser": os.Getenv("KYQ_TEST_BROWSER_EXECUTABLE")} + run := func(phase string) { + t.Helper() + config["phase"] = phase + input, err := json.Marshal(config) + if err != nil { + t.Fatal(err) + } + defer clear(input) + bounded, cancel := context.WithTimeout(ctx, 6*time.Minute) + defer cancel() + args := []string{"--max-old-space-size=256", "notes_browser.mjs"} + command := "node" + if wrapper := os.Getenv("KYQ_TEST_BROWSER_WRAPPER"); wrapper != "" { + command = wrapper + args = append([]string{"node"}, args...) + } + cmd := exec.CommandContext(bounded, command, args...) + cmd.Stdin = bytes.NewReader(input) + cmd.Env = append(os.Environ(), "DEBUG=", "PUSH_RELAY_URL=", "APNS_RELAY_URL=") + out, err := cmd.CombinedOutput() + t.Logf("Notes native browser %s: %s", phase, out) + if err != nil { + t.Fatalf("Notes native browser %s failed: %v", phase, err) + } + } + run("seed") + return func() { run("verify") } +} + +func TestNotesBrowserCertificate(t *testing.T) { + t.Setenv("KYQ_TEST_NOTES_BROWSER", "1") + chain, key := browserEdgeCertificate(t) + pair, err := tls.X509KeyPair(chain, key) + if err != nil || len(pair.Certificate) != 2 { + t.Fatalf("browser certificate chain: %v", err) + } + leaf, err := x509.ParseCertificate(pair.Certificate[0]) + if err != nil { + t.Fatal(err) + } + ca, err := x509.ParseCertificate(pair.Certificate[1]) + if err != nil { + t.Fatal(err) + } + roots := x509.NewCertPool() + roots.AddCert(ca) + if _, err := leaf.Verify(x509.VerifyOptions{Roots: roots, DNSName: catalogNotesHost}); err != nil { + t.Fatal(err) + } + if _, err := leaf.Verify(x509.VerifyOptions{Roots: roots, DNSName: "wrong.invalid"}); err == nil { + t.Fatal("fixture certificate accepted wrong hostname") + } +} diff --git a/test/e2e/notes_input.mjs b/test/e2e/notes_input.mjs new file mode 100644 index 0000000..a2b79e5 --- /dev/null +++ b/test/e2e/notes_input.mjs @@ -0,0 +1,29 @@ +// Keep ASCII keyboard actions; use the browser editing engine for unmapped Unicode. +export async function appendText(page, text) { + for (const character of text) { + if (character >= " " && character <= "~") await page.keyboard.type(character); + else if (!await page.evaluate(text => document.execCommand("insertText", false, text), character)) + throw new Error("browser Unicode editing command refused"); + } +} + +export async function replaceContentText(page, control, text) { + await control.click(); + await control.press("ControlOrMeta+A"); + if (!await page.evaluate(text => document.execCommand("insertText", false, text), text)) + throw new Error("browser content replacement command refused"); +} + +export async function focusParagraphEnd(page, paragraph) { + await paragraph.click(); + await page.keyboard.press("End"); + return paragraph.evaluate(element => { + const selection = window.getSelection(); + const inside = Boolean(selection?.anchorNode && element.contains(selection.anchorNode)); + if (!inside) return { inside: false, collapsed: Boolean(selection?.isCollapsed), atEnd: false }; + const beforeCaret = document.createRange(); + beforeCaret.selectNodeContents(element); + beforeCaret.setEnd(selection.anchorNode, selection.anchorOffset); + return { inside, collapsed: selection.isCollapsed, atEnd: beforeCaret.toString() === element.textContent }; + }); +} diff --git a/test/e2e/npm_joins_kube_test.go b/test/e2e/npm_joins_kube_test.go index f195d87..358d73c 100644 --- a/test/e2e/npm_joins_kube_test.go +++ b/test/e2e/npm_joins_kube_test.go @@ -38,6 +38,11 @@ func TestKubernetesNPMEdgeJoins(t *testing.T) { testKubernetesEdgeJoins(t, "npm" // testKubernetesEdgeJoins is the joins suite behind proxy: the catalog npm, or nginx. func testKubernetesEdgeJoins(t *testing.T, proxy string) { + if os.Getenv("KYQ_TEST_NOTES_BROWSER") == "1" { + if proxy != "npm" || os.Getenv("KYQ_TEST_RELEASE_UPGRADE_MANIFESTS") == "" || os.Getenv("KYQ_TEST_BROWSER_MODULE") == "" || os.Getenv("KYQ_TEST_BROWSER_EXECUTABLE") == "" { + t.Fatal("Notes browser case requires NPM, historical manifests and explicit browser/module paths") + } + } ctx := context.Background() work := t.TempDir() state := filepath.Join(work, "state") @@ -96,6 +101,7 @@ func testKubernetesEdgeJoins(t *testing.T, proxy string) { os.WriteFile(plan, []byte("version: 1\ntargets:\n - name: k8s\n kubeconfig: "+kc+"\n storage_class: standard\napps:\n - name: "+proxy+"\n target: k8s\n - name: hello\n target: k8s\n"), 0o600) var outputs, trust []string var restoreCalendar func() + var verifyNotes func() apply := func(want string) string { t.Helper() var out bytes.Buffer @@ -225,6 +231,13 @@ func testKubernetesEdgeJoins(t *testing.T, proxy string) { } } + // Diagnose real browser/key enrollment as soon as old Notes is ready, before + // installing unrelated Calendar/Post fixtures. Later apply calls keep its data. + if os.Getenv("KYQ_TEST_NOTES_BROWSER") == "1" { + trustTestCA(t, ctx, cs, connected, "kynotes", certPEM) + verifyNotes = seedNotesBrowser(t, ctx, connected, certPEM, nodeIP) + } + // KyCalendar joins after KyIdentity's first setup too, by setup amendment. Its setup needs // no issuer probe, so it runs before the edges as kyPulse's does; its everyday account's // subject comes from KyIdentity's read-only check of its first setup. @@ -285,6 +298,7 @@ func testKubernetesEdgeJoins(t *testing.T, proxy string) { // must not append duplicate volumes, mounts or environment values. trustTestCA(t, ctx, cs, connected, "kycalendar", certPEM) trustTestCA(t, ctx, cs, connected, "kycalendar", certPEM) + trustTestCA(t, ctx, cs, connected, "kynotes", certPEM) verifyCalendar, verifyRestoredCalendar := seedCalendarUpgrade(t, ctx, calendarSignOn(t, ctx, connected, certPEM, nodeIP)) fingerprints := func() map[string][32]byte { t.Helper() @@ -400,6 +414,9 @@ func testKubernetesEdgeJoins(t *testing.T, proxy string) { t.Logf("preserved %d Kubernetes Secret payloads, Docker client/session keys, Identity JWKS and Recovery pairing; candidate Pulse deposited with its prior pairing", len(before)) driveSignOn(t, ctx, kc, certPEM, nodeIP, driveSecrets[1]) notesSignOn(t, ctx, connected, certPEM, nodeIP) + if verifyNotes != nil { + verifyNotes() + } calendarEveryday := calendarSignOn(t, ctx, connected, certPEM, nodeIP) verifyCalendar(calendarEveryday) if os.Getenv("KYQ_TEST_CALENDAR_RESTORE") == "1" { diff --git a/test/e2e/npm_kube_test.go b/test/e2e/npm_kube_test.go index edd2194..3b8cc60 100644 --- a/test/e2e/npm_kube_test.go +++ b/test/e2e/npm_kube_test.go @@ -412,7 +412,7 @@ func uploadCertificate(t *testing.T, ctx context.Context, tunnel edge.Dial, toke json.NewDecoder(res.Body).Decode(result) } } - certPEM, keyPEM := testCertificate(t) + certPEM, keyPEM := browserEdgeCertificate(t) var created struct { ID int `json:"id"` }