Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

Previews answer only requests Cloudflare Access signed in #381

Mergedsyntaqx merged 380-preview-access into main

Merged into main by syntaqx via a merge commit in 4d5eaf0

syntaqxopened this pull request

Previews (pr-<N>-g1t.syntaqx.workers.dev) run against production's data. Cloudflare Access now stands in front of them, with the g1t staff policy (Worker → Access, previews only).

This is the second lock, in the Worker: a request to any *.workers.dev address must carry Access's Cf-Access-Jwt-Assertion token, signed by the team's keys (syntaqx.cloudflareaccess.com), issued by that team, unexpired, and made for the previews' application (its AUD tag, in PREVIEW_ACCESS_AUD). Anything else gets a 403, so a preview stays shut if Access is ever switched off. Without the settings, every preview request is refused.

g1t.sh and the other custom domains never reach the check. The production workers.dev address is turned off, and is refused here too.

  • apps/web/app/lib/preview-access.ts: the check. The team's keys are kept for an hour and fetched again for an unknown key id.
  • apps/web/app/lib/preview-access.test.ts: valid tokens, missing ones, wrong audience, wrong issuer, expired, unknown key, a changed body, no settings.
  • apps/web/workers/app.ts: runs it before the site.
  • apps/web/wrangler.jsonc: the team and AUD vars.

Checked: the tests, the type check and the web build with its load and deploy checks. Signed out, a preview now redirects to Access's sign-in (302).

syntaqxturned on auto-merge (merge commit)·
syntaqxadded this to the merge queue·
g1tbotturned off auto-merge: It joined the merge queue.·
syntaqxmerged this·
syntaqxdeleted the 380-preview-access branch·

All checks have passed

4 passed · on d18cf88

Workflows

CI / pull_request — CI passedDetails
Dependency review — No dependency changesDetails
Preview / pull_request — Preview passedDetails
preview / web — The site as this pull request makes it

380-preview-access was deleted

It can be made again at d18cf88, where it was.

Sign in to comment.