HIGH: Environment variable listing endpoint leaks secret values #27

Closed
opened 2026-05-08 23:50:46 +00:00 by Mark · 7 comments
Owner

Issue

The GET /sessions/{id}/env endpoint returns ALL environment variable values including actual secret values (passwords, tokens, API keys). While it marks variables as is_secret: true, it still transmits the actual secret values to the client.

Location

  • services/api/app/routes/env.py:62-87

Current Implementation

is_secret = any(pattern in key.lower() for pattern in secret_patterns)
env_vars.append({
    "key": key,
    "value": value,  # <-- actual secret value sent to client
    "is_secret": is_secret,
    "source": "session",
})

Risk

  • Secret values (API keys, tokens, passwords) are transmitted to clients in plain text
  • The is_secret flag is advisory only — secrets are still fully exposed
  • Affects: BROWSER_USE_API_KEY, any user-set env vars containing secrets
  • Network-level exposure if not using HTTPS

Proposed Fix

  1. Mask secret values in the API response (e.g., show first 4 chars + "****")
  2. Add a separate endpoint for retrieving actual secret values (with additional auth)
  3. Use the existing is_secret field to properly redact values

Priority: High
Type: Security

## Issue The `GET /sessions/{id}/env` endpoint returns ALL environment variable values including actual secret values (passwords, tokens, API keys). While it marks variables as `is_secret: true`, it still transmits the actual secret values to the client. ## Location - `services/api/app/routes/env.py:62-87` ## Current Implementation ```python is_secret = any(pattern in key.lower() for pattern in secret_patterns) env_vars.append({ "key": key, "value": value, # <-- actual secret value sent to client "is_secret": is_secret, "source": "session", }) ``` ## Risk - Secret values (API keys, tokens, passwords) are transmitted to clients in plain text - The `is_secret` flag is advisory only — secrets are still fully exposed - Affects: BROWSER_USE_API_KEY, any user-set env vars containing secrets - Network-level exposure if not using HTTPS ## Proposed Fix 1. Mask secret values in the API response (e.g., show first 4 chars + "****") 2. Add a separate endpoint for retrieving actual secret values (with additional auth) 3. Use the existing `is_secret` field to properly redact values **Priority:** High **Type:** Security
Author
Owner

This is a security/design issue that needs human review before action.

This is a security/design issue that needs human review before action.
Author
Owner

🤖 Claimed by gsd-issue-fixer-devforge-27 — starting work

🤖 Claimed by `gsd-issue-fixer-devforge-27` — starting work
Author
Owner

🤖 [gsd-issue-fixer-devforge-27] still working — claimed — starting pipeline

🤖 [`gsd-issue-fixer-devforge-27`] still working — claimed — starting pipeline
Author
Owner

🤖 [gsd-issue-fixer-devforge-27] still working — research

🤖 [`gsd-issue-fixer-devforge-27`] still working — research
Author
Owner

🤖 [gsd-issue-fixer-devforge-27] still working — plan

🤖 [`gsd-issue-fixer-devforge-27`] still working — plan
Author
Owner

🤖 [gsd-issue-fixer-devforge-27] still working — implement attempt 1

🤖 [`gsd-issue-fixer-devforge-27`] still working — implement attempt 1
Author
Owner

Fixed in commit. Closing.

Fixed in commit. Closing.
Mark closed this issue 2026-05-27 16:27:29 +00:00
Sign in to join this conversation.
No description provided.