Skip to content

fix: mask sensitive API keys in /api/config response#633

Open
mango766 wants to merge 1 commit into666ghj:mainfrom
mango766:fix/mask-api-keys-in-config
Open

fix: mask sensitive API keys in /api/config response#633
mango766 wants to merge 1 commit into666ghj:mainfrom
mango766:fix/mask-api-keys-in-config

Conversation

@mango766
Copy link

Closes #632, related to #620

The /api/config GET endpoint currently returns API keys in plaintext. This masks sensitive config values (anything containing API_KEY, SECRET, or PASSWORD) in the response, showing only the last 4 characters.

This way the frontend can still indicate whether a key is configured, without exposing the actual value to anyone with network access.

Changes:

  • Added a helper to identify and mask sensitive config keys
  • GET /api/config now returns masked values for sensitive fields
  • POST /api/config response is also masked (the write itself still accepts full values)

The GET /api/config endpoint was returning all configuration values in
plaintext, including API keys and passwords.  This meant anyone with
network access could read every secret stored in the config.

Add helper functions that identify sensitive keys (those containing
API_KEY, SECRET, or PASSWORD) and replace their values with a masked
form that only shows the last 4 characters (e.g. "***abcd").  The POST
endpoint response is also masked so secrets are never leaked in any
config API response.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API keys exposed in plaintext via /api/config endpoint

1 participant