Download release assets through the gateway on Fjord Account hosts (#222) #313
Loading…
Reference in a new issue
No description provided.
Delete branch "stephen/fj-222-release-download-gateway"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes
fj release downloadon a Fjord Account host (part of #222). It fetched each asset'sbrowser_download_urlwith an unauthenticated client. On a Fjord Account host that URL is the forge's web origin, which answers 404 for a private repository (reproduced withfj release download v0.2.0 -R rasterstate/dock-controlon shop-dev-01) and must never receive the Fjord bearer.The asset is now fetched through the gateway with the session, using the same client path as API calls (401 refresh and account-override checks included). The gateway already forwards any path to the instance with a per-user forge token, so no platform change.
Path checks. The gateway has no path allowlist, so fj constrains the request. The asset URL must be on the origin of the release's own page and, decoded, equal
/<owner>/<repo>/releases/download/<tag>/<name>for the repository and tag being downloaded, with no query, fragment or dot segments. Anything else is refused before any request. An instance mounted under a base path is refused too, because fj does not know the base the gateway appends to. PAT hosts are unchanged.Redirects. A redirect to storage on another origin is followed without
Authorization(covered by a test).Not verified here: whether rasterhub's Forgejo accepts the gateway's forge token on the web download route. That needs one run of
fj release download v0.2.0 -R rasterstate/dock-controlwith the new build installed.Adds
percent-encodingas a direct dependency; it was already inCargo.lockthroughurl. Tests: gateway mapping, refusal matrix, bearer on the gateway fetch, no credential on a cross-origin redirect, path-mounted and wrong-repository refusal, PAT client unchanged. clippy on this host's newer toolchain stops at an existing lint insrc/cli/pr_line_comment.rs, untouched here.Automated Codex review (read-only) of head
987aa91e54.No confirmed findings in the diff against
~/fleet-week/STANDARDS.mdand the surrounding request, refresh, redirect, and download code.The gateway’s acceptance of forge tokens on the web download route remains unverified, as disclosed in the PR body. No network requests or tests were run.
BLOCKING: 0
Reviewed head
987aa91e54at 2026-11-11T15:25:51Z by codex exec (read-only sandbox).