fix(arc-paste): default-deny via allowlist + scrub stale dual-URL docs - #49
Merged
Merged
Conversation
Address two findings from the PR #47 adversarial review: 1. arc-paste binary now genuinely mirrors the Caddy edge. The previous guards only blocked / and /api/v1/* — every other path (e.g. /labels, /dashboard, /<projectId>/issues) still fell through the SPA wildcard in web.RegisterSPA and served the arc app shell. Replaced with a single allowlist middleware (arcPasteAllowedPath) that mirrors the Caddyfile @assets + @share matchers exactly: /_app/*, /api/paste, /api/paste/*, /robots.txt, and /share/<single-segment>. Tests cover both the rejected set (including shape edges like /share/, /share/a/b, /api/pasteX, /robots.txt.bak) and the allowed set, plus a direct table-driven test of the predicate. 2. Documentation drift: review_howto.md still described the deprecated dual-URL CLI output, and paste-server.md had four lingering "Share URL" mentions that didn't match the new in-page Share-link button flow. Rewrote review_howto.md's "URLs you'll receive" section around the Author URL / reviewer URL split, and replaced the paste-server.md mentions with consistent "reviewer URL" terminology matching the rest of the runbook. The /api/v1/* JSON-404 carve-out is gone — Caddy returns text/plain at the edge, and the binary now matches. The arc SPA shell that motivated the JSON 404 doesn't load anymore (/ is 404), so nothing parses the body.
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 #47 addressing two findings from an adversarial review of that PR.
1. arc-paste binary now genuinely mirrors the Caddy edge
Previously the in-binary guards only blocked
/and/api/v1/*. Every other path (/labels,/dashboard,/<projectId>/issues, etc.) still fell through the SPA wildcard registered byweb.RegisterSPAand served the arc app shell — exactly the failure mode #47 claimed to fix. The "Mirrors the Caddy edge config so dev and prod behave the same" comment overclaimed.Replaced with a single allowlist middleware (
arcPasteAllowedPath) that mirrors theCaddyfile@assets+@sharematchers exactly:/_app/*/api/paste/api/paste/*/robots.txt/share/<single-segment>Tests cover both the rejected set (including shape edges like
/share/,/share/a/b,/api/pasteX,/robots.txt.bak) and the allowed set, plus a direct table-driven test of the predicate.The
/api/v1/*JSON-404 carve-out is gone — Caddy returns text/plain at the edge, and the binary now matches. The arc SPA shell that motivated the JSON 404 doesn't load anymore (/is 404), so nothing parses the body.2. Documentation drift from the
--share→--remote/ single-URL output renamedocs/runbooks/review_howto.mdstill described the deprecated dual-URL CLI output (with a "Share URL" / "Author URL" table).docs/runbooks/paste-server.mdhad four lingering "Share URL" mentions that didn't match the new in-page Share link button flow.review_howto.md"URLs you'll receive" section around the Author URL / reviewer URL split, with the in-page Share-link button as the canonical reviewer-URL source.paste-server.mdmentions with consistent "reviewer URL" terminology matching the rest of the runbook.Test plan
go test -count=1 ./arc-paste/... ./cmd/arc/...passes (verified locally)make lintclean (verified locally — Go, Biome, ESLint, svelte-check)make buildand run./bin/arc-paste.curl -i http://localhost:7433/→ 404.curl -i http://localhost:7433/labels→ 404.curl -i http://localhost:7433/dashboard→ 404.curl -i http://localhost:7433/api/v1/projects→ 404.curl -i http://localhost:7433/share/abc→ 200 (the SPA shell).curl -i http://localhost:7433/api/paste -X POST …→ 201 with a real CreatePasteRequest body.docs/for any remainingShare URLreferences (should find none).