diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index d9ec669a63ea..bff3049c1bb9 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -360,6 +360,7 @@ jobs: --set-env-vars="ORIGIN_PLAY=mdnplay.dev" \ --set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \ --set-env-vars="SOURCE_API=https://api.developer.mozilla.org/" \ + --set-env-vars="ORIGIN_TRIAL_TOKEN=A9YWJd0eN0+JyqsF5/4sYlFePcOgkAIKtGSnrERJ7zmzK65fqcrdYjmHUlxAV79Fphmwt96Gkyw2F1WmMEUEztgAAABdeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb24iLCJleHBpcnkiOjE3NDk3NDMyNjF9" \ --set-env-vars="BSA_ENABLED=true" \ --set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \ --set-env-vars="SENTRY_ENVIRONMENT=prod" \ diff --git a/.github/workflows/stage-build.yml b/.github/workflows/stage-build.yml index 5cada942e5ff..d720dba3e4f3 100644 --- a/.github/workflows/stage-build.yml +++ b/.github/workflows/stage-build.yml @@ -376,6 +376,7 @@ jobs: --set-env-vars="ORIGIN_PLAY=mdnyalp.dev" \ --set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \ --set-env-vars="SOURCE_API=https://api.developer.allizom.org/" \ + --set-env-vars="ORIGIN_TRIAL_TOKEN=A708kbzhofFLGMe7BHKr3aym5saxaywBDqhAzxv4vU9sM6B49iYwec+xy2Y3Imt0+nhR03/jmbuNY0BRvM+Ng5cAAABdeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5hbGxpem9tLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb24iLCJleHBpcnkiOjE3NDk3NDMzMDB9" \ --set-env-vars="BSA_ENABLED=true" \ --set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \ --set-env-vars="SENTRY_ENVIRONMENT=stage" \ diff --git a/cloud-function/src/env.ts b/cloud-function/src/env.ts index d70ec2088043..4f88750106be 100644 --- a/cloud-function/src/env.ts +++ b/cloud-function/src/env.ts @@ -64,6 +64,10 @@ export function sourceUri(source: Source): string { } } +// Origin trial. +export const ORIGIN_TRIAL_TOKEN: string | undefined = + process.env["ORIGIN_TRIAL_TOKEN"]; + // Kevel. export const KEVEL_SITE_ID = Number(process.env["KEVEL_SITE_ID"] ?? 0); export const KEVEL_NETWORK_ID = Number(process.env["KEVEL_NETWORK_ID"] ?? 0); diff --git a/cloud-function/src/headers.ts b/cloud-function/src/headers.ts index aaaee28d7145..9deeebc3fa95 100644 --- a/cloud-function/src/headers.ts +++ b/cloud-function/src/headers.ts @@ -5,6 +5,7 @@ import { PLAYGROUND_UNSAFE_CSP_VALUE, } from "./internal/constants/index.js"; import { isLiveSampleURL } from "./utils.js"; +import { ORIGIN_TRIAL_TOKEN } from "./env.js"; const HASHED_MAX_AGE = 60 * 60 * 24 * 365; const DEFAULT_MAX_AGE = 60 * 60; @@ -94,6 +95,7 @@ export function setContentResponseHeaders( ["Strict-Transport-Security", "max-age=63072000"], ...(csp ? [["Content-Security-Policy", CSP_VALUE]] : []), ...(xFrame ? [["X-Frame-Options", "DENY"]] : []), + ...(ORIGIN_TRIAL_TOKEN ? [["Origin-Trial", ORIGIN_TRIAL_TOKEN]] : []), ].forEach(([k, v]) => k && v && setHeader(k, v)); }