Skip to content

feat(server): a project guest reads the project's artifacts - #581

Merged
Jacksondr5 merged 1 commit into
j5/mainfrom
j5code/share-3a-project-artifacts
Oct 13, 2026
Merged

Jacksondr5 merged 1 commit into
j5/mainfrom
j5code/share-3a-project-artifacts

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Problem

A guest holding a View grant on a project is refused that project's artifacts, which Shared server AC9 promises them. The guest gate refuses every route that is not a GET, and reading an artifact is a POST; the artifact list and the change subscription, both requests on the socket, are not in the guest's WebSocket allow-list either. Closes #578.

What changed

All in J5-owned apps/server/src/j5/sharing/GuestGate.ts.

  • guestHttpRule names POST /api/j5/artifacts/read as the only non-GET route a guest keeps permissions on. The gate reads the project from the request's JSON body and checks it with PersonAccess.projectAccess, so a grant on a thread gives none. The body is cached by the request, so the route reads the same bytes the gate checked.
  • GUEST_RPC_RULES gains a project rule kind, used by j5.artifacts.list and j5.artifacts.subscribeChanges. The list was an HTTP route until the read stack made it a request on the socket (feat(j5): J5's client reads run over WebSocket methods #584); its rule moved with it at the rebase. Like a thread feed, an open change feed ends when the grant on its project is removed.
  • A test asserts a guest is refused every J5 client read and j5.reads.subscribeChanges: none is listed, so each is refused by default.
  • j5.artifacts.delete is not listed, so it stays refused. There is no artifact write route for a client.

A member's connection is unchanged: the gate still looks only at the session's subject.

Live testing

Run by the builder on an isolated j5-live-test server (commit 1502675f48, the layer above this one, default flags), with a guest paired through a real share link and requests sent with its bearer token.

  • Live: a thread guest of the project is refused the list (403). After a project grant the same guest lists and reads plan.md (200). A path of ../../settings.json is refused (409, "Artifact paths cannot leave the artifacts directory"), another project id is refused (403), and j5.artifacts.delete is refused. An open j5.artifacts.subscribeChanges delivered a change, then ended with "This is not shared with you on this server" when the guest left the project grant, and the next list was 403.
  • Live, after the rebase onto j5/main (commit 3ed8990140, the top of the stack; the pushed tip differs only in one test file's formatting): a project guest listed the project's one artifact with j5.artifacts.list and read it over POST /api/j5/artifacts/read (200). The same guest was refused the list for another project id, j5.reads.subscribeChanges and j5.inbox.openCount, and the old /api/j5/artifacts/list route is gone (404).
  • Found live, not fixed here: in a guest's browser the Artifacts page shows "This is not shared with you on this server" for a project the guest holds, and sends no request. The client's j5Read (packages/client-runtime/src/j5/state.ts) refuses every J5 read once the connection is known to be a guest's, and the artifact list now goes through it. The server allows the request; the client never sends it. Reported to the read stack's owner.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior (backend changes ship with focused tests)
  • UI changes: before/after screenshots above, and a video for motion or interaction — no UI in this PR
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR — none edited; case 69's text says what a guest may now ask
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md — D33 extended by one sentence
  • Surfaces: entry points, clients, providers, contracts, reverse states, connection modes (see AGENTS.md) — server only; both artifact entry points (HTTP reads, socket subscription) are covered, and removing the grant is the way back out
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them — none needed

Tests: apps/server/src/j5/sharing/GuestArtifacts.test.ts runs the real artifact routes, the real artifact folder and the real gate: another project's artifacts, a Collaborate thread guest of the same project, a guest session with no person, bodies that name no project or are not JSON, six paths that try to leave the folder, a member reading both, and the grant being removed.

Claude Opus 5.5, Claude Code

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Oct 13, 2026 5:32am UTC

Request Review

@Jacksondr5
Jacksondr5 added this pull request to stack #583 October 13, 2026 01:45
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 effective changed lines (test files excluded in mixed PRs). labels Oct 13, 2026
@Jacksondr5

Copy link
Copy Markdown
Owner Author

Heads-up for this stack: #584 and #586 (#506) move J5's client reads onto the socket and delete POST /api/j5/artifacts/list, which becomes j5.artifacts.list. They are expected to merge first. After they do, this stack is rebased onto j5/main and this PR drops the HTTP list allowance in guestHttpRule and adds a project rule for j5.artifacts.list; /read stays. The rebase also gets a live pass that a guest's client makes no J5 reads and opens no change stream once it knows it is a guest's.

A guest holding a View grant on a project was refused that project's
artifacts: the guest gate refused every route that is not a GET, and
reading an artifact is a POST. The list and the change subscription, both
requests on the socket, were not listed for a guest either.

The gate now allows the artifact read for a guest whose grant is on the
project the request body names, and the list and the change subscription
for that project only. A grant on a thread gives none (Shared server AC9),
and writing and deleting stay refused. An open change feed ends when the
grant on its project is removed.

Refs #578

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bryantderosier

bryantderosier commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Ran a three-reviewer crew over the whole sharing stack (#581 → #602). Each reviewer was on a different vendor: acceptance criteria on Claude Fable 5.1, code review on GPT-6.1-Sol, and security on Grok 4.7. Every finding was checked against each higher branch up to #602, and only stuff that still survives at the top is listed here. Inline comments are on the PR that introduced each one.

Overall: the guest gate looks solid. It's default-deny on both HTTP and RPC, scoped by thread/project, and View vs Collaborate is enforced on the server. Revoking a grant ends open feeds, tokens and errors look fine, and FORK.md/D33 are thorough. The real problems are where guest input reaches the agent, plus a couple of attribution bugs in the web client.

Hold before merge (updated: one more security finding added on #600)

Smaller

Focused tests the code reviewer ran: 6 files / 101 tests, all passing. Nothing was run in a real browser or on mobile.

🤖 Generated with Claude Code

@Jacksondr5
Jacksondr5 removed this pull request from stack #583 October 13, 2026 15:20
@Jacksondr5
Jacksondr5 added this pull request to stack #605 October 13, 2026 15:20
@Jacksondr5
Jacksondr5 marked this pull request as ready for review October 13, 2026 20:39
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 21 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 61 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 80b12799-2775-4fbb-80b2-f5a703d0b910
📥 Commits

Reviewing files that changed from the base of the PR and between fcff4af and b5bf3cc.

📒 Files selected for processing: 4
  • FORK.md
  • apps/server/src/j5/sharing/GuestArtifacts.test.ts
  • apps/server/src/j5/sharing/GuestGate.ts
  • docs/j5/product/upstream.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Jacksondr5
Jacksondr5 merged commit 67ca824 into j5/main Oct 13, 2026
41 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/share-3a-project-artifacts branch October 13, 2026 20:40

This branch was successfully deployed

1 active deployment
Preview — b5bf3cce Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share links: a project guest reads the project's artifacts

2 participants