Skip to content

app/: routing by hostname, hardened (sc-8900) - #63

Merged
ndbroadbent merged 5 commits into
mainfrom
laravel-hosts-hardening
Dec 2, 2026
Merged

ndbroadbent merged 5 commits into
mainfrom
laravel-hosts-hardening

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

The coordinator's follow-ups from reviewing #53:

  1. Fail closed in production: a booted hook refuses to start when APP_ENV is production and any of VISUALCI_SITE_URL, VISUALCI_APP_URL, VISUALCI_API_URL or VISUALCI_MCP_URL is missing, naming the missing ones. Development and tests still serve every path when they aren't set.
  2. The renderer API's token check (/internal must check the renderer token whatever the Host) belongs to the renderer API on visualci features' side. I've passed it to them, including the test for an unknown Host with no token.
  3. Odd paths: the host check now judges a normalised path (percent-decoded, repeated slashes collapsed, lowercased), so /%61pi/v1/builds, //api/v1/builds, /API/v1 and /%2Fapi/v1 all count as /api/v1. They can't reach an API handler through the app host, whatever the router does with them.

Tests: unit tests for normalisation, for each odd path on both hosts and for the production check, plus an integration test showing the odd paths get a 404 on the app host.

@visualci-com

visualci-com Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #309 · 331 unchanged · no changes

This PR vs base: nothing since #223, across 7 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent force-pushed the laravel-hosts-hardening branch from 5a86b75 to 28cfb96 Compare December 2, 2026 14:00
@ndbroadbent
ndbroadbent force-pushed the laravel-hosts-hardening branch 2 times, most recently from b94c220 to 10fe553 Compare December 2, 2026 15:22
…fuses to boot without all four host URLs; the host check judges a normalised path (percent-decoded, repeated slashes collapsed, lowercased), so /%61pi/v1, //api/v1 and /API/v1 can't reach the API through the app host; tests
…r host URLs name a host and no two are the same (a bare app.visualci.com fails); in production a request for any other host reaches only /up and the renderers' /internal paths; Laravel's TrustHosts trusts every host, since it would refuse the API and MCP hosts and the pods' probes and route_by_host is the host check; tested in production for an unknown host and a boot that fails
…e in production (sign-in's callback, OAuth metadata, the device code and redirects are unreachable from it; every other URL comes from the configured host URLs)
… (one host serves everything, as a self-hosted VisualCI does, every URL from APP_URL) or all four, each naming a host and no two the same; only some of them is a boot error; tested in production for one host, the partial case, and four
…uth settings; one Cargo.toml tracing entry; the OAuth discovery test expects the tests' APP_URL (https://app.visualci.test, since #59)
@ndbroadbent
ndbroadbent force-pushed the laravel-hosts-hardening branch from 10fe553 to 4dbdbb2 Compare December 2, 2026 15:42
@ndbroadbent
ndbroadbent merged commit 8ce69b0 into main Dec 2, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the laravel-hosts-hardening branch December 2, 2026 15:52
ndbroadbent added a commit that referenced this pull request Dec 2, 2026
…SSUER and OAUTH_AUTHORIZATION_ENDPOINT matching), as app/'s boot checks require (#63)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant