Skip to content

fix: redact provider-prefixed secret fields in API responses - #66

Merged
Siumauricio merged 2 commits into
Dokploy:mainfrom
codebeetl:fix/provider-prefixed-secret-redaction
Aug 7, 2026
Merged

fix: redact provider-prefixed secret fields in API responses#66
Siumauricio merged 2 commits into
Dokploy:mainfrom
codebeetl:fix/provider-prefixed-secret-redaction

Conversation

@codebeetl

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to feat: opt-in redaction of secret-bearing fields in API responses #38 (opt-in redaction). Related to compose.one (and likely other read endpoints) return env vars in plaintext, leaking secrets into LLM context #41.
  • redactSensitive() matched field names by exact equality only. Dokploy's actual API responses prefix git-provider credential fields with the provider name (githubClientSecret, githubPrivateKey, githubWebhookSecret, and the gitlab/bitbucket/gitea equivalents), so none of them match the bare names in DEFAULT_REDACTED_FIELDS (clientSecret, privateKey, secret).
  • Result: even with DOKPLOY_REDACT_ENV=true, compose.one (and any other endpoint returning a connected git provider) still returns the provider's client secret, private key, and webhook secret in plaintext.
  • Fix: match a field name if it equals or ends with one of the configured redacted field names, so provider-prefixed variants are caught without needing to enumerate every provider explicitly. DOKPLOY_REDACT_ENV's default is untouched (still opt-in, off by default) to avoid changing behavior for existing deployments.

Test plan

  • pnpm type-check
  • pnpm test (25/25 passing)
  • Verified against a live compose.one response containing a real GitHub App githubPrivateKey/githubClientSecret/githubWebhookSecret — confirmed unredacted before this change, redacted after

Adds a test suite for redactSensitive covering the provider-prefixed
fields from Dokploy#65 (githubPrivateKey, githubClientSecret,
githubWebhookSecret), nesting, arrays, case-insensitivity, null
passthrough, circular structures, and prototype-pollution keys. Also
hoists the lowered suffix list out of the per-key loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Siumauricio

Copy link
Copy Markdown
Contributor

Pushed a maintainer commit on top, @codebeetl — the fix itself is unchanged: it adds a test suite for redactSensitive covering the provider-prefixed fields from #65 (githubPrivateKey, githubClientSecret, githubWebhookSecret), nesting, arrays, case-insensitivity, null passthrough, circular structures, and prototype-pollution keys, and hoists the lowered suffix list out of the per-key loop. All tests pass. Thanks for the fix — good catch on the exact-match gap.

Complementary: #69 flips DOKPLOY_REDACT_ENV to default-on, which together with this PR fully addresses the MCP side of #65.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants