Skip to content

feat(server): a guest sees a project's favicon, served by J5 - #591

Merged
Jacksondr5 merged 1 commit into
j5code/share-3c-open-linkfrom
j5code/share-3d-project-favicon
Oct 13, 2026
Merged

Jacksondr5 merged 1 commit into
j5code/share-3c-open-linkfrom
j5code/share-3d-project-favicon

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Problem

A guest sees upstream's default icon for a project whose icon is a favicon file. Upstream's client asks for a favicon by the project's folder on the host, and the link upstream signs for it carries that folder in readable base64, so a guest could be given neither. Jackson, 2026-10-12: "Have J5 serve the favicon." Part of #535.

What changed

J5-owned code only; no upstream file is edited.

  • The project names itself by id. A guest's reduced project keeps its placeholder folder and carries guestIconPath(projectId) as faviconPath: the project's id in the shape of a relative image path (j5-shared-project/<id>.png). Upstream's ProjectFavicon (web and mobile) sends faviconPath back as the request's path, so the request now says which project it is about.
  • The gate answers the request. For a guest's assets.createUrl with a project-favicon whose path names a project, the rule checks PersonAccess.projectInFeed (a grant on the project, or a thread the guest can see lives in it) and answers in place of upstream's handler with a link to J5's route. The link is signed with J5's own key and holds the project id and an expiry, nothing else. Its file name is a hash and the favicon's extension.
  • The route serves it. GET /api/j5/sharing/project-icon/<token>/<name> takes no sign-in, as upstream's asset route takes none (an <img> cannot send one). It finds the project by id and serves the file through upstream's exported issueAssetUrl, resolveAsset and assetFileResponse, so the favicon search, the check that the file is inside the project, and the response headers (no sniffing, SVG sandboxed) are upstream's.
  • The join page gets the same link. The describe route adds projectFaviconUrl to each entry of a link that works: the J5-signed link above, when the project has a favicon and no chosen icon, and null otherwise. A link that does not work gets its 404 before anything is resolved. It needed one call into this layer and nothing new, and the holder of a working link could pair and be given the same link anyway. A link that does not work is told nothing.
  • No favicon. The answer ends in upstream's own project-favicon-missing marker, which upstream's client reads as "draw the default" and never fetches.

A member's connection is untouched: the guest rules are not installed for it.

UI changes

No client code changed; the guest's sidebar and thread header now draw the favicon.

Before After
A guest's view of a thread in a project with a favicon file: sidebar and thread header before after

Decisions to check

  • faviconPath carries the project id for a guest. This is the one design choice Jackson may want to see. It needs no upstream edit and does not change workspaceRoot. The alternatives were an edit inside upstream's ProjectFavicon on web and mobile, or putting the id in the reduced workspaceRoot, which other client code reads. It also fixes a latent clash: upstream's client caches favicons by folder and favicon path, and every guest project has the same placeholder folder.
  • The route runs on the calling fiber's services. Upstream's asset code needs a dozen services. Rather than add a J5 service that requires them all (and thread them through J5's route tests), GuestProjectIcons.ts provides whatever is in the fiber, which is where upstream's own asset request and route run. If one were missing the answer is a refusal or a 404, never a wider read. The live test is what shows they are present on a real server.
  • A favicon set to a file outside the project is served too. A member can point a project's favicon at an absolute path (upstream's external override). The route serves that file to a guest for the hour the link lives. It is the same file every member is shown, chosen by a member, and nothing a guest can steer.
  • Each fetch re-reads the favicon file to hash it, on a route that needs no sign-in. A link names one project its holder already sees, so the cost is bounded.
  • A link works for its hour after a grant is removed, as upstream's attachment links do (Sharing v2: what was set aside #542 already lists that).
  • The feed check has a slower path. A project grant or a grant on a thread in the project is one indexed read. Only when neither holds does it walk the project's threads, for an agent placed under a granted thread in another project.
  • A favicon added to a project after the server looked for one shows only after upstream's cache of the miss clears. That is upstream's behaviour for a member too; I met it in the live test.

Live testing

Run by the builder on isolated j5-live-test servers (--base d45a1101bd for the layer below beside this branch at 6c652b699f), with a guest paired through a real share link.

  • Live: for a project with no favicon the guest's request was answered with the project-favicon-missing marker. After adding favicon.svg and restarting, the request was answered with a J5 link; fetching it returned 200, image/svg+xml, x-content-type-options: nosniff and a sandboxing content-security-policy, with bytes equal to the file. The answer, the token (version, projectId, expiresAt) and the response headers held no host path or file name. A tampered link got 404. In the browser the guest's sidebar and thread header drew the favicon. On the layer below the same request was refused and the default icon showed.
  • Live (tip 6d1bf35774): describing a join link for a thread whose project has a favicon and no chosen icon returned a favicon link; fetching it returned the file's bytes as image/svg+xml; the answer held no host path. Three describes left the link unused. With a chosen icon set, the answer carried the icon and no favicon link. A revoked and a made-up link each got the same 404.
  • Live, after the rebase onto j5/main (tip 3ed8990140): a guest's browser asked assets.createUrl for its project's favicon once and J5 answered it (one guestProjectIcons.upstreamFavicon span); the wider pass is described in feat(server): a member brings a guest in with a share link #582.
  • Not shown directly: that the client stopped sending a refused request on every draw. The browser's resource timings were crowded out by the dev server's module requests. What I can say is that the request the client sends is now answered where it was refused.
  • Not exercised live: mobile, a PNG or ICO favicon, a project with a chosen icon and a favicon both.

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 — one pair; no motion
  • 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 describes the three upstream functions it calls and what to reread on an advance
  • 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
  • Surfaces: entry points, clients, providers, contracts, reverse states, connection modes (see AGENTS.md) — server only. Web and mobile share the client path; only web was looked at. Removing the grant refuses the next request
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them — none needed

Tests: apps/server/src/j5/sharing/GuestProjectIcons.test.ts, through the real gate, upstream's real favicon resolution and asset serving, real files and a real database: an SVG and a PNG favicon served with upstream's headers; nothing handed to the guest naming a folder or file; a project not in the feed by id and by real folder; a made-up id; a guest with no person; nine tampered tokens; a link for one project asked for another's name; an expired link; a deleted project; no favicon; a member getting upstream's own handler. Upstream's apps/server/src/assets tests pass unchanged.

Claude Opus 5.5, Claude Code

🤖 Generated with Claude Code

@Jacksondr5
Jacksondr5 added this pull request to stack #583 October 13, 2026 03:40
@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:53am UTC

Request Review

Jacksondr5 added a commit that referenced this pull request Oct 13, 2026
@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Oct 13, 2026
@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). label Oct 13, 2026
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from 6c652b6 to 785ba91 Compare October 13, 2026 04:00
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from 785ba91 to 3f6b07f Compare October 13, 2026 04:09
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from 3f6b07f to e1123fb Compare October 13, 2026 04:16
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from e1123fb to 1420312 Compare October 13, 2026 04:17
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from 1420312 to b4c969c Compare October 13, 2026 04:28
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from b4c969c to 7924d24 Compare October 13, 2026 04:30
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch 2 times, most recently from faa7532 to 6d1bf35 Compare October 13, 2026 04:36
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from 6d1bf35 to eadf3cf Compare October 13, 2026 04:41
@Jacksondr5
Jacksondr5 force-pushed the j5code/share-3d-project-favicon branch from eadf3cf to 704423b Compare October 13, 2026 04:54
A guest saw upstream's default icon for a project whose icon is a favicon
file. Upstream's client asks for a favicon by the project's folder, and
the link upstream signs for it carries that folder in readable base64,
so a guest could be given neither.

A guest's reduced project now names itself by id where a favicon's path
would be. The guest gate reads the id from the request, checks the
project is in the guest's sidebar, and answers with a link to a J5 route
signed by J5 that names the project id and an expiry only. The route
serves the file through upstream's own favicon resolution and asset
serving. No upstream file is edited.

Refs #535

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

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 13 billable files and costs up to $3.25.

  • 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: d686ebee-9aa4-4615-aa9e-f8cb2cc63ae6
📥 Commits

Reviewing files that changed from the base of the PR and between 6979fbc and 0fbe8b0.

📒 Files selected for processing: 13
  • FORK.md
  • apps/server/src/j5/a2a/J5AuthenticatedRoutes.ts
  • apps/server/src/j5/sharing/GuestGate.ts
  • apps/server/src/j5/sharing/GuestProjectIcons.test.ts
  • apps/server/src/j5/sharing/GuestProjectIcons.ts
  • apps/server/src/j5/sharing/GuestView.test.ts
  • apps/server/src/j5/sharing/GuestView.ts
  • apps/server/src/j5/sharing/OpenLinkHttp.ts
  • apps/server/src/j5/sharing/OpenLinks.test.ts
  • apps/server/src/j5/sharing/OpenLinks.ts
  • apps/server/src/j5/sharing/PersonAccess.ts
  • docs/j5/product/upstream.md
  • packages/contracts/src/j5/sharing.ts
  • 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 46af1e1 into j5/main Oct 13, 2026
60 of 72 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/share-3d-project-favicon branch October 13, 2026 20:40
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026

This branch was successfully deployed

1 active deployment
Preview — 0fbe8b00 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:L 100-499 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.

1 participant