Repository navigation
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add version 1 manifest and policy schemas, exact storage keys, scrypt password hashing, cookie proofs, manifest-only file resolution, a cached share state reader, and bounded Azure Blob and filesystem object readers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reader opens /s/<shareId>, checks expiry, revocation and the password on every file and HEAD request, serves exact manifest files with an SPA fallback, and never lists storage or contacts Hub. It refuses to start with Hub settings and is not deployed or enabled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Share one byte allowance across file, manifest and policy reads, keep a file's reservation until its read and response end, and abort reads on disconnect. Recheck expiry after the manifest loads, the password after file reads and verification, start policy freshness at read time, check the newest share cookies first, and throttle wrong passwords per caller. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refresh the policy after a slow manifest load, give policy and manifest reads their own allowance so a large file cannot block its own checks, reissue a reopened share's cookie so it becomes the newest, and return 503 when the post-read check cannot reach storage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace PUBLIC_SHARE_ORIGIN with a required PUBLIC_SHARE_GENERATED_ORIGIN and an optional PUBLIC_SHARE_CUSTOM_ORIGIN, so adding a custom domain keeps existing links working. Password forms must come from the host that received them, and share passwords need at least 8 characters. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues break browser password submissions, permit Hub credentials in the reader, weaken password-attempt limits, and let stalled or disconnected requests exhaust reader capacity.
9 open issues
Hub-only credentials bypass the startup isolation guard · New Password-page referrer policy causes browser POSTs to fail · New Password attempt limits are not atomic across requests or replicas · New Disconnect during metadata loading leaks a file reservation · New Stalled downloads can hold file reservations indefinitely · New Valid large Builds exceed the manifest size limit · New Entry schema rejects start pages accepted by Hub · New Dark-mode error text fails minimum contrast · New Slashless directory URLs break relative asset paths · New
What changed in this PR
Adds an isolated, read-only service for exported public Build links, laying the foundation for sharing without wildcard preview hosts. Hub export writing and deployment remain follow-up work; existing share links are unchanged.
Changes:
- Defines export schemas, storage keys, password hashing, and cookie proofs.
- Adds file serving with policy checks, bounded reads, strict response headers, and filesystem/Azure storage adapters.
- Adds startup commands, focused tests, and architecture and operating guides.
| File | Description |
|---|---|
hub/server/scripts/start-public-share-reader/index.ts |
Starts and shuts down the standalone reader. |
hub/server/scripts/start-public-share-reader/index.test.ts |
Checks the reader’s import isolation. |
hub/server/routes/public-share-reader/index.ts |
Handles share entry, passwords, and file responses. |
hub/server/routes/public-share-reader/index.test.ts |
Covers access checks, serving, and resource limits. |
hub/server/integrations/filesystem/create-public-share-object-reader/index.ts |
Reads bounded local export objects. |
hub/server/integrations/express/send-public-share-page/index.ts |
Renders password and unavailable pages. |
hub/server/integrations/azure-blob/create-public-share-object-reader/index.ts |
Reads Azure exports using managed identity. |
hub/server/integrations/azure-blob/create-public-share-object-reader/index.test.ts |
Covers blob errors and bounded reads. |
hub/server/domains/public-share-export/verify-public-share-password/index.ts |
Verifies passwords against stored scrypt hashes. |
hub/server/domains/public-share-export/types.ts |
Defines export schemas, limits, and interfaces. |
hub/server/domains/public-share-export/resolve-public-share-file/index.ts |
Resolves manifest files and navigation fallbacks. |
hub/server/domains/public-share-export/read-public-share-reader-settings/index.ts |
Validates reader configuration and rejects forbidden settings. |
hub/server/domains/public-share-export/read-public-share-reader-settings/index.test.ts |
Covers configuration acceptance and refusals. |
hub/server/domains/public-share-export/public-share-storage-key/index.ts |
Constructs exact export object keys. |
hub/server/domains/public-share-export/hash-public-share-password/index.ts |
Creates salted password hashes. |
hub/server/domains/public-share-export/hash-public-share-password/index.test.ts |
Covers password length and Unicode handling. |
hub/server/domains/public-share-export/create-public-share-state-reader/index.ts |
Loads and caches policies and manifests. |
hub/server/domains/public-share-export/create-public-share-state-reader/index.test.ts |
Covers caching, state changes, and storage failures. |
hub/server/domains/public-share-export/create-public-share-proof/index.ts |
Creates password-bound cookie proofs. |
hub/server/domains/public-share-export/create-public-share-byte-allowance/index.ts |
Bounds concurrent storage-read reservations. |
hub/package.json |
Adds production and development reader commands. |
hub/docs/README.md |
Links the reader guide. |
hub/docs/public-share-reader.md |
Documents the export contract and runtime operation. |
docs/adr/0003-public-sharing-export-reader.md |
Records the architecture, trade-offs, and follow-up scope. |
Review effort: Max (adaptive)
weastler
marked this pull request as draft
November 30, 2026 00:38
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow only the reader's own settings, keep the password form's origin, count password attempts before checking them with a 5-attempt cooldown per visitor and replica, release reservations after early disconnects, drop stalled downloads, accept Build-sized manifests and Hub-normalized start pages, redirect slashless directories, and raise dark-mode alert contrast. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ad room Also show a working local run of the public share reader with env -i. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
15f8b27a1ac0c3d885a8254b5fce3d0ebfb8914e↑ All 57 CI checks pass on this revision, including Hub lint, typecheck, unit tests and build on both Node versions.
↑ An independent review and the conventions gate passed on
f889e81b; the only later commit adds tests and fixes the local-run example, which was run as written.↓ Never run against real Azure Blob storage or a managed identity; that waits for PR 3's non-production installation.
↓ The password and unavailable pages, including the dark-mode contrast fix, were not checked in a browser.
Why
Public share links today depend on wildcard preview hosts that the Azure installation does not provision, so hosted Builds cannot be shared publicly. ADR 0003 records the accepted design: Hub copies a shared Build into a separate public export storage, and a separate read-only reader serves it. The reader never contacts Hub and holds no Hub data or secrets. This first PR adds that reader and the storage contract. Hub does not write exports yet, and nothing is deployed or enabled.
What changes
A viewer opens
https://<public-hostname>/s/<shareId>. The reader checks the share's policy, asks for a password if the link has one, then sets a cookie for the Build's own mount path and redirects there. The Build loads unchanged, because it was already compiled for that path.flowchart LR viewer["Link viewer"] -- "/s/shareId" --> reader["Public share reader"] reader -- "reads policy, manifest and files by exact name" --> exports[("Public export storage")] hub["Hub (later PR)"] -- "writes and revokes" --> exports reader -. "no route" .-> hubmanifest.json, and apolicy.jsonwritten last to activate the share. Revoking means overwriting the policy. Schemas, storage keys, scrypt password hashing (at least 8 characters) and cookie proofs live inhub/server/domains/public-share-export/.HEADand revalidations all recheck revocation, expiry and the current password. The checks run again after slow reads. Revocation reaches every replica within 5 seconds.noindexandno-referrer(same-originon the password page, so its form keeps its origin), and set only the reader's own share cookies.Run it with
npm run start:public-share-reader; the reader guide lists its settings. Existing share links are unchanged.Hub export, share records and UI (PR 2) and Terraform and setup wizard support (PR 3) follow. The reader has not run against real Azure storage or a managed identity; PR 3's non-production installation covers that. It does not support byte-range requests, which Safari needs to play video.