Skip to content

security: OAuth client secret exposed in source code (digitalocean) #3076

@louisgv

Description

@louisgv

Severity

CRITICAL

Location

packages/cli/src/digitalocean/digitalocean.ts lines 91-93

Description

The DigitalOcean OAuth client secret is hardcoded in the source code:

const DO_CLIENT_SECRET =
  process.env["DO_CLIENT_SECRET"] ?? "8083ef0317481d802d15b68f1c0b545b726720dbf52d00d17f649cc794efdfd9";

While the inline comment explains this is similar to other CLI tools (gh, doctl, gcloud, az) and notes that "any secret shipped in source code or a binary is extractable and provides zero confidentiality", having the secret in plaintext makes it trivially easy for attackers to extract.

Risk

An attacker with this secret could potentially:

  1. Impersonate the spawn CLI application during OAuth flows
  2. Create phishing attacks that appear to use legitimate spawn OAuth credentials
  3. Monitor or intercept spawn's OAuth flows more easily

Impact

All users authenticating to DigitalOcean via spawn's OAuth flow.

Recommendation

  1. Consider using PKCE (Proof Key for Code Exchange) without a client secret if DigitalOcean supports it
  2. If PKCE is not available, document this as a known limitation of DigitalOcean's OAuth implementation
  3. Add monitoring/rate limiting on the OAuth application to detect abuse
  4. Consider rotating the secret periodically and using a build-time secret injection mechanism

Context

The code includes a TODO comment about migrating to PKCE when DigitalOcean adds support (lines 80-90), which would eliminate the need for a client secret entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processingsecuritySecurity vulnerabilities and concerns

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions