Skip to content

fix(remote/azuread): redact OAuth client_secret in config API (CVE-2026-42151)#337

Merged
vporoshok merged 2 commits into
ppfrom
fix/cve-2026-42151-azuread-secret
May 16, 2026
Merged

fix(remote/azuread): redact OAuth client_secret in config API (CVE-2026-42151)#337
vporoshok merged 2 commits into
ppfrom
fix/cve-2026-42151-azuread-secret

Conversation

@vporoshok

Copy link
Copy Markdown
Collaborator

Summary

Backports the upstream Prometheus fix prometheus/prometheus#18586 (GHSA-wg65-39gg-5wfj / CVE-2026-42151) to our fork.

OAuthConfig.ClientSecret in storage/remote/azuread was typed as a plain string, so the value leaked verbatim through the /-/config HTTP API endpoint. Prometheus redacts fields of type config.Secret to <secret> via that type's MarshalYAML / MarshalJSON methods; switching the field to Secret plugs the leak. The string value is explicitly recovered only at the azidentity.NewClientSecretCredential boundary, where a literal string is required.

Changes

  • `storage/remote/azuread/azuread.go`: import `config_util "github.com/prometheus/common/config"`, change `ClientSecret string` → `ClientSecret config_util.Secret`, wrap with `string(...)` at the credential call site.
  • `storage/remote/azuread/azuread_test.go`: typed `dummyClientSecret` as `config_util.Secret` so existing tests still type-check.
  • `CHANGELOG.md`: entry under `v0.8.0` → `Fixes`.

Why Dependabot couldn't reach this

Alerts #183 and #184 pin the advisory to `pp/tools/block_converter/go.mod` and `documentation/examples/remote_storage/go.mod` — those are offline tools / examples that don't load Azure AD config and don't expose `/-/config`. The actual vulnerable code lives inside our Prometheus fork tree, which Dependabot doesn't watch because we are not an external consumer of `github.com/prometheus/prometheus`. They can be dismissed as `not used` once this PR ships.

Test plan

  • `go test -tags stringlabels ./storage/remote/azuread/...` in devcontainer — all tests pass.
  • `prometheus/[email protected]` already used by the main go.mod (`type Secret string` with redacting `MarshalYAML`/`MarshalJSON`) — no module bump needed.

Made with Cursor

…26-42151)

Backport of upstream prometheus/prometheus#18586 (GHSA-wg65-39gg-5wfj).
ClientSecret in OAuthConfig was typed as a plain string, so the value
leaked verbatim through the /-/config HTTP endpoint. Switch the field
to config.Secret so prometheus/common's MarshalYAML/MarshalJSON
implementations redact it to <secret> on serialization; the value is
explicitly converted back to string only at the azidentity boundary.

Co-authored-by: Cursor <[email protected]>
@vporoshok vporoshok self-assigned this May 16, 2026
@vporoshok
vporoshok merged commit 4746a0a into pp May 16, 2026
2 checks passed
@vporoshok
vporoshok deleted the fix/cve-2026-42151-azuread-secret branch May 16, 2026 06:40
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.

1 participant