Skip to content

app/: gallery rate limit on the trusted-proxy address; DB_APPLICATION_NAME per process (sc-8900 cutover) - #98

Merged
ndbroadbent merged 2 commits into
mainfrom
laravel-cutover-fixes
Dec 3, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
laravel-cutover-fixes

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

Part of sc-8900, from talira infra's check of the cutover manifests (infra#2) against the app.

The gallery's rate limit uses request.ip().

  • The path: Cloudflare → the tunnel (cloudflared on the app nodes) → Envoy → pod. No hop ever comes from a Cloudflare IP range, so app/: renderer API, bulk downloads, public gallery and retention (sc-8900) #81's rule ("believe cf-connecting-ip only from Cloudflare's ranges") could never match.
  • Why request.ip(): with TRUSTED_PROXIES set to Envoy's nodes (infra#2: 10.42.0.0/24 and 10.42.1.0/24), it resolves to the client Cloudflare names, and a client can't set it with headers of its own.
  • Removed: the Cloudflare ranges config (VISUALCI_CLOUDFLARE_IP_RANGES, CLOUDFLARE_IP_RANGES), caller() and the ipnet dependency.

DB_APPLICATION_NAME names each process's connections.

  • Each new connection runs SET application_name = '<name>', so Postgres's metrics and pg_stat_activity split by process.
  • The deploy sets visualci-web, visualci-worker, visualci-scheduler and migrate beside the URL from CloudNativePG's Secret.
  • Only letters, digits, dashes and underscores are used (up to 63 characters); anything else is ignored. A unit test covers this.

The full app suite passes on docspring-dev, and clippy and fmt are clean.

@ndbroadbent
ndbroadbent force-pushed the laravel-cutover-fixes branch from 4f13021 to fe06ac0 Compare December 2, 2026 23:49
…the trusted proxies (behind Cloudflare's tunnel no hop comes from Cloudflare's ranges, so the cf-connecting-ip range check never applied); each process names its database connections from DB_APPLICATION_NAME (SET application_name), for Postgres's per-process metrics
…trusted proxy, request.ip() is the right-most X-Forwarded-For entry that isn't one, so a forged first entry changes nothing
@ndbroadbent
ndbroadbent force-pushed the laravel-cutover-fixes branch from fe06ac0 to 343d0f2 Compare December 3, 2026 00:27
@ndbroadbent
ndbroadbent merged commit 10520f6 into main Dec 3, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the laravel-cutover-fixes branch December 3, 2026 00:42
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