Repository navigation
feat(org-fs): password-protected file/folder sharing - #4135
Merged
Merged
Conversation
…hare_secret) First step of password-protected sharing (design: .context/file-share-password-spec.md). Adds the two nullable columns the gate needs — a scrypt hash (null = fully public, set = password-gated) and a per-node secret rotated on password change to invalidate unlock cookies. Layered on read_public (link-accessible); proxy gate + UI follow after design sign-off. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds a third share mode on top of public sharing. The /read proxy serves an
interstitial password form before content; one unlock (a signed, scoped
cookie) covers the node the password sits on — a file, or a whole folder + its
assets — mirroring public. Most-specific published node governs.
- crypto (share-password.ts): scrypt hash/verify, per-node share_secret,
HMAC unlock tokens (MESH_JWT_SECRET); rotation + expiry fail closed.
- storage: derive shareMode in the DTO (hash never leaves the server),
setShareMode, resolveGoverningShare (most-specific public node).
- service: OrgFs.setShareMode (hash + rotate secret), resolveReadAccess
(private/public/password + govPath/secret).
- route: read branch (cookie check → form), POST /unlock (scrypt verify,
rate-limited, sets scoped cookie), /public now takes { mode, password? }.
Members bypass the prompt; non-members/anonymous get the form. Password
content is never shared-cached.
- middleware: carve-out so non-members can POST /unlock.
- UI: ShareControls 3-way control (Org only / Public / Password) + password
field; card badge gains a password (key) tier.
- tests: crypto unit (7) + integration (governing resolution, inheritance,
most-specific override, password-change rotation).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
viktormarinho
marked this pull request as ready for review
June 24, 2026 20:46
Address review #1: a folder password is one credential for the whole subtree, so keying the brute-force limiter on the requested file path let an attacker multiply the lockout by guessing sibling sub-paths under the same share. Resolve the governing share first, then key the limiter on access.govPath. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
#1 Inherited-public files now render a read-only "shared via a parent folder" state instead of the editable 3-way control — clicking "Org only" used to toast success while the published parent kept serving it (false confirmation). Restores the guard the old 2-way switch had. #2 Unlock rate limiter no longer trusts the spoofable leftmost X-Forwarded-For alone: prefer cf-connecting-ip / x-real-ip, and add a per-share global cap (50/5min, IP-independent) as a backstop so rotating XFF can't fully unthrottle brute-force. Per-IP cap (10/5min) stays for the normal case. #3 Password hashing/verification moved to async scrypt — scryptSync on the public, unauthenticated /unlock route blocked the event loop and serialized concurrent attempts. Callers + tests updated to await. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
decocms Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
PR: #4135 feat(org-fs): password-protected file/folder sharing Bump type: minor - decocms (apps/mesh/package.json): 3.55.0 -> 3.56.0 Deploy-Scope: both
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.
Follow-up to #4125 (merged). A third share mode — password — on top of public sharing. The
/readproxy serves an interstitial password form before content; one unlock (a signed, scoped cookie) covers the node the password sits on — a single file, or a whole folder + its assets — mirroring public. Most-specific published node governs.How it works
share-password.ts): scrypt hash/verify, a per-nodeshare_secret, and HMAC unlock tokens signed withMESH_JWT_SECRET. Rotation + expiry + org/volume binding all fail closed.shareMode(private/public/password) is derived in the DTO — the password hash never leaves the server.resolveGoverningSharefinds the most-specific published node;resolveReadAccessreturns private/public/password (+ govPath/secret).GET /readchecks the unlock cookie → serves or returns the form.POST /unlockverifies the password (scrypt, rate-limited) and sets a scopedhttpOnly; SameSite=Laxcookie.POST /publicnow takes{ mode, password? }(back-compat:{ public }). A non-member/anonymous gets the form; a member bypasses it (reads viaORG_FS_READ). Password content is never shared-cached.ShareControlsbecomes a 3-way control (Org only / Public / Password) with a set/update password field; the card badge gains a password (key) tier.Decisions made (open to push-back)
read_public, not ashare_modeenum — reuses feat(org-fs): public file sharing via read_public flag #4125 whole.ORG_FS_WRITE(same as public).ORG_FS_PUBLISHdeliberately not built here — kept as the governance/agent follow-up.Migration
121-org-fs-share-passwordaddsshare_password_hash+share_secret(both nullable). Auto-runs on boot /bun run migrate.🤖 Generated with Claude Code