Skip to content

fix(cli): redact API keys#5891

Open
7ttp wants to merge 1 commit into
supabase:developfrom
7ttp:fix/redact-apikey-traces
Open

fix(cli): redact API keys#5891
7ttp wants to merge 1 commit into
supabase:developfrom
7ttp:fix/redact-apikey-traces

Conversation

@7ttp

@7ttp 7ttp commented Jul 16, 2026

Copy link
Copy Markdown
Member

TL;DR

fixes project keys being written to CLI traces, matching the Go cli's behavior...

Problem

The Go-cli use to send keys through the apikey header:

func withAuthToken(token string) FetcherOption {
if strings.HasPrefix(token, "sb_") {
header := func(req *http.Request) {
req.Header.Add("apikey", token)
}
return WithRequestEditor(header)
}
header := func(req *http.Request) {
req.Header.Add("apikey", token)
req.Header.Add("Authorization", "Bearer "+token)
}
return WithRequestEditor(header)

Its debug transport only logs the request method and URL:

func (t *debugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
t.logger.Printf("%s: %s\n", req.Method, req.URL)
return t.RoundTripper.RoundTrip(req)

Effect tracing captures request headers, but apikey is not included in its default redaction list...
this allowed values to be written to local traces...

sol

exclude apikey header attributes at the tracing boundary....
requests and all other telemetry remain unchanged, while NDJSON and debug output no longer contain project keys....

ref:

@7ttp
7ttp requested a review from a team as a code owner July 16, 2026 19:57
@7ttp 7ttp self-assigned this Jul 16, 2026
@7ttp

7ttp commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 83b5d25ded

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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