Skip to content

Hardening: refuse to boot if REACT_APP_GOOGLE_API_KEY has GOCSPX- prefix #2317

@aalemayhu

Description

@aalemayhu

Context

On 2026-05-16 the Drive feature deployed with a misconfigured env: `REACT_APP_GOOGLE_API_KEY` was set to a value starting with `GOCSPX-`, which is the Google OAuth Client Secret format — not an API key (which starts with `AIza`).

Two bad consequences:

  1. The Picker rejected the credential ("API developer key is invalid")
  2. The Client Secret got inlined into the public JS bundle, briefly leaking it

What to do

Add a boot-time / build-time check that refuses to start (or fails CI) if any `REACT_APP_GOOGLE_API_KEY` value starts with `GOCSPX-`. The check belongs in:

  • The web build step (catches at CI before it ships)
  • Server startup (catches at deploy time even when CI is bypassed)

Pattern: a single guard function, e.g. `assertGoogleApiKeyShape(value)`, that throws on `GOCSPX-` prefix and warns on missing `AIza` prefix.

Why this is worth doing

The 30 minutes spent diagnosing the bad key value during the original Drive ship-week was preventable. A one-line check would have caught it at deploy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions