vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Harden the web transport and bound the pages that run git
701232cf37157ff392e3b35a3279735d72e585d4 · Keenan Nemetz · 12d ago · parent 6bfc4294
Harden the web transport and bound the pages that run git Generated clone and LFS download links were derived from the request's Host header, with X-Forwarded-Proto believed from anyone. Those links are copied out of a page and pasted into a terminal, and the LFS hrefs are followed by a client, so a forged Host chose where somebody else's download went. Links now use public_url when it is configured, which is how a production instance is meant to be set up; without it the request origin is all there is, and forwarded headers are honoured only when git_http_client_ip_header is set, because that is the instance's statement that a proxy it trusts rewrites them. Site links follow the forge's scheme instead of always saying http, so an HTTPS forge does not link to a mixed-content site. The security headers now close the rest of the surface: object-src is none, inline styles are no longer allowed (no template or generated markup contains one), and Permissions-Policy, COOP and CORP are set. The CSRF check gained a second lock: when the browser says where a request came from, that origin must be this instance, on form posts and on the JSON ceremony endpoints alike. A missing Origin and Referer is not evidence, so only a request that names somewhere else is refused. The pages that shell out to git are bounded. Search, compare, blame, file history, commit history and both archive formats take a slot from a pool of eight and run under a 30-second deadline, which is attached to the git handle so the process is killed rather than left running after the reader has gone. Past a five-second wait for a slot the page answers 503 with Retry-After. Plain tar now takes the archive slot too: it is cheaper than gzip, not free, and both stream for as long as the client reads. Tests: clone URLs ignore a forged Host when public_url is set and honour forwarded headers only behind a declared proxy; LFS hrefs likewise; site links follow the scheme; the CSP has no unsafe-inline and names object-src; a saturated git pool answers 503 with Retry-After; a cross-origin post is refused with a valid CSRF token, end to end; the JSON endpoints refuse a foreign origin. Docs: public_url now explains that it decides generated links and that forwarded headers are only trusted with the proxy header set; Sites gains a same-site risk section recommending a separate registrable domain when sites are not trusted.
docs/sites.md +20
| @@ -72,3 +72,23 @@ and [Configuration § Running behind a proxy](configuration.md#running-behind-a- | |||
| 72 | 72 | ||
| 73 | 73 | A workflow can publish the site as its last step. See | |
| 74 | 74 | [Workflows § Publish a website](workflows.md#publish-a-website). | |
| 75 | |||
| 76 | ## Same-site risk | ||
| 77 | |||
| 78 | A site is content somebody else wrote, served from a hostname you control. If | ||
| 79 | `pages_domain` shares a registrable domain with the forge — `forge.example.com` | ||
| 80 | and `*.pages.example.com`, say — then every site is *same-site* with the forge, | ||
| 81 | and a malicious site can: | ||
| 82 | |||
| 83 | - make the browser send the forge's `SameSite=Lax` cookies on a top-level | ||
| 84 | navigation (Vole's writes still need a CSRF token, so this does not authorize | ||
| 85 | anything on its own, but it is the assumption a weaker application would rely on); | ||
| 86 | - open the forge in a window or frame and interact with it as a same-site | ||
| 87 | document, which is why `Cross-Origin-Opener-Policy` and the CSP frame rules are | ||
| 88 | set on every page; | ||
| 89 | - share a cookie domain if you ever set one wider than a host. | ||
| 90 | |||
| 91 | Use a separate registrable domain for sites when the repositories publishing them | ||
| 92 | are not all trusted: `pages.example.net` for a forge at `forge.example.com`. The | ||
| 93 | two then cannot be same-site. If the sites are as trusted as the forge itself, a | ||
| 94 | subdomain is fine and keeps certificate management to one domain. | ||