Skip to content

Prevent deployment secret sprawl with a classification ratchet and config migration #9663

Closed

Description

@Git-on-my-level

Summary

Prevent secret sprawl at the deployment boundary and migrate the known non-secret settings currently stored as GitHub Actions secrets or Secret Manager entries.

This is one ratchet issue: new deployment settings must be classified and cannot be wired as secrets by default; existing safe-to-declassify settings move out incrementally.

No secret values belong in this issue, CI output, fixtures, or tests.

Why now

Read-only audit evidence found two recurring failure modes:

  1. Public client configuration is passed to Docker builds as GitHub secrets.* even though it is intentionally shipped to browsers and is listed as public build configuration in app/config/client_env_policy.yaml.
  2. Identifiers, hostnames, URLs, redirect allowlists, and model-selection policy are co-located with credentials in the backend ExternalSecret contract.

Existing protections are valuable but do not close this gap:

  • scripts/check-public-client-secrets.py prevents server credentials entering client artifacts.
  • backend/scripts/validate-backend-runtime-env.py validates runtime bindings.
  • Neither currently rejects a non-secret setting being introduced as a Secret Manager/GitHub secret binding.

Scope

A. Add a secret-boundary CI ratchet

Add a checked-in, name-only classification policy with three kinds:

  • secret: credential, private key, password, signing/auth material, or sensitive aggregate configuration;
  • config: server-side non-secret runtime setting;
  • public_build: intentional browser/client build configuration.

For every new or changed deployment binding, CI must enforce:

  • ${{ secrets.NAME }} is classified as secret;
  • ${{ vars.NAME }} is classified as config or public_build;
  • Cloud Run secrets: and Helm/ExternalSecret mappings only use secret names;
  • normal env:/Helm values do not source a secret name;
  • public web build settings may not be supplied via secrets.*.

Use a diff ratchet rather than requiring an all-at-once legacy migration. Existing unclassified bindings may be a shrinking baseline, but new or changed bindings must be classified. Any exception must declare an owner, reason, and expiry date.

Register the check in .github/checks-manifest.yaml for both local and ci lanes, so it runs via make preflight, pre-push, and PR CI. Add unit fixtures proving accepted and rejected classifications without loading production configuration values.

B. Migrate audited non-secret settings

Use normal GitHub environment variables, checked-in runtime manifest values, Helm values, or ConfigMap-style configuration as appropriate. Preserve an additive rollout and remove old secret bindings only after deployment validation.

1. Public web build configuration — move from GitHub Secrets to GitHub Variables

  • API_URL
  • NEXT_PUBLIC_API_BASE_URL
  • NEXT_PUBLIC_FIREBASE_API_KEY
  • NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN
  • NEXT_PUBLIC_FIREBASE_PROJECT_ID
  • NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
  • NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID
  • NEXT_PUBLIC_FIREBASE_APP_ID
  • NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID
  • NEXT_PUBLIC_FIREBASE_VAPID_KEY
  • NEXT_PUBLIC_MIXPANEL_TOKEN
  • NEXT_PUBLIC_EXTRA_PROMPT_RULES

Evidence:

  • public-build allowlist: app/config/client_env_policy.yaml:24-40;
  • current secret-backed web build args: .github/workflows/gcp_app.yml:46-53, .github/workflows/gcp_frontend.yml:56-63, .github/workflows/gcp_personas.yml:53-61.

Confirm Firebase API restrictions/App Check remain appropriate. Moving values does not create new public exposure because they are already intentionally delivered to clients.

2. Backend runtime metadata — move out of Secret Manager/ExternalSecret

Strong candidates:

  • STT route policy: STT_PRERECORDED_MODEL; assess STT_SERVICE_MODELS under a schema that rules out credentials.
  • OAuth public metadata: GOOGLE_CLIENT_ID, X_OAUTH_CLIENT_ID, X_OAUTH_REDIRECT_URI.
  • MCP public metadata: MCP_AUTHORIZATION_SERVER_URL, MCP_RESOURCE_URL, public client IDs/names, and redirect-URI allowlists.
  • Endpoint and host configuration: REDIS_DB_HOST, TYPESENSE_HOST, RAPID_API_HOST.
  • Twilio identifiers: TWILIO_ACCOUNT_SID, TWILIO_API_KEY_SID, TWILIO_TWIML_APP_SID.
  • Product selection policy: CONVERSATION_SUMMARIZED_APP_IDS.

Evidence:

  • production ExternalSecret map: backend/charts/backend-secrets/prod_omi_backend_secrets_values.yaml:33-34,45-46,63-78,83-100,101-122;
  • STT model preference is parsed as a model list: backend/config/prerecorded_stt.py:81-115;
  • Claude MCP client uses token_endpoint_auth_method: "none" with no client secret hash: backend/database/mcp_oauth.py:215-226;
  • Twilio code distinguishes *_SID identifiers from TWILIO_AUTH_TOKEN and TWILIO_API_KEY_SECRET: backend/utils/twilio_service.py:34-70.

Explicitly retain as secrets

Keep real credentials protected, including provider API keys, passwords, signing/encryption secrets, OAuth client secrets, bearer tokens, private keys, and MCP_OAUTH_CLIENTS_JSON until its schema is split: its parser supports confidential-client material and client-secret hashes.

Do not declassify NEXT_PUBLIC_RAPIDAPI_KEY or NEXT_PUBLIC_LINKEDIN_API_KEY; despite misleading names, they are server-side provider credentials. Rename them as part of cleanup if practical.

Acceptance criteria

  • A checked-in name-only secret/config/public-build policy exists with owner/reason/expiry for exceptions.
  • CI and local preflight fail for a new or changed unclassified secret reference, a config value wired as a secret, or a public-build value wired through secrets.*.
  • The check is registered in .github/checks-manifest.yaml for both local and CI lanes.
  • Tests use fake names/fixtures and never access or print live secret values.
  • The listed public web settings use GitHub environment variables and corresponding workflows use vars.*.
  • The listed backend config settings are moved from Secret Manager/ExternalSecret through additive dev then prod rollout with contract validation.
  • Only live credential bindings remain in ExternalSecrets; GKE ExternalSecret and Cloud Run validation pass after each migration.
  • Documentation explains the three classifications and how to add a new setting.

Non-goals

  • Reading, logging, or committing any secret values.
  • Replacing static GCP deployment credentials with GitHub OIDC/WIF in this issue; track that as a separate IAM migration.
  • Removing SERVICE_ACCOUNT_JSON without proving the relevant workload identity/ADC replacement.
  • Deploying production changes as part of issue creation.

Related

Activity

  1. added
    enhancement
    backend
    security-review
    on Jul 14, 2026
  2. added a commit that references this issue on Jul 14, 2026
    08c8589
  3. added a commit that references this issue on Sep 29, 2026
    9c5adb9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendenhancementsecurity-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions