Skip to content

app/log: redact credentials and API keys in URLs - #4813

Merged
obol-bulldozer[bot] merged 2 commits into
mainfrom
oisin/redact-url-credentials
Oct 28, 2026
Merged

obol-bulldozer[bot] merged 2 commits into
mainfrom
oisin/redact-url-credentials

Conversation

@OisinKyne

@OisinKyne OisinKyne commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Beacon node, fallback beacon node, execution client and builder URLs can carry credentials: basic auth (https://user:pass@host), and the API keys that hosted providers put in the path (/v2/<key>) or the query (?apikey=<key>). Several places logged them raw, and the logs may be shipped to Loki. The SSE metrics also used the raw beacon node URLs as labels, and charon's metrics are remote-written to Obol.

Redaction happens only where a raw URL reaches a log or a metric, so the logger itself is unchanged. log.RedactURL masks the password and query values. Integer and 0x hex query values (slots, indices, roots) are kept. It also masks either the whole path, or only path segments that look like API keys (20+ characters mixing letters and digits).

  • Startup Parsed config log: flags named *endpoint* or *url* are masked fully, as go-eth2-client does for its own logs. *address* flags keep their path.
  • SSE listener: the redacted address is computed once per beacon node and used in logs and in all app_beacon_node_sse_* metric labels. The raw address is still passed on, as the fetcher uses it to pick the client.
  • Fetcher and scheduler: bn_addr fields are redacted.
  • eth2wrap: the url field from the decomposed url.Error is redacted.
  • eth1wrap: the url.Error in returned errors is redacted before wrapping. Go's HTTP client already strips passwords from it, but not keys in the path or query.
  • Exit commands: beacon_nodes_endpoints is redacted.
  • app_builder_config_url: the label drops the URL's user info. For relays that is the public relay key, which only lengthens the label.

go-eth2-client already masks its own Address(), so the validator API proxy logs were safe.

category: feature
ticket: none

Redact passwords, query values and API-key-like path segments of URLs in
all log messages and fields, and the full path of endpoint and URL flags
in the startup config log. Keep integer and 0x hex query values, such as
slots and roots. Drop the user info from the app_builder_config_url label.
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.80808% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.64%. Comparing base (4e4d996) to head (3eea43d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
app/sse/listener.go 65.51% 10 Missing ⚠️
app/sse/client.go 50.00% 2 Missing ⚠️
core/scheduler/scheduler.go 33.33% 2 Missing ⚠️
app/builderconfig.go 83.33% 1 Missing ⚠️
app/eth1wrap/runner.go 66.66% 1 Missing ⚠️
app/eth2wrap/eth2wrap.go 0.00% 1 Missing ⚠️
cmd/exit_list.go 0.00% 1 Missing ⚠️
core/fetcher/fetcher.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4813      +/-   ##
==========================================
+ Coverage   67.61%   67.64%   +0.03%     
==========================================
  Files         254      255       +1     
  Lines       33609    33659      +50     
==========================================
+ Hits        22725    22770      +45     
- Misses      10883    10888       +5     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Checking every field of every log line costs about 1.8us per line,
mostly from formatting errors. Remove that from the logger and redact
only where raw endpoint URLs reach logs or metrics: the SSE listener's
logs and metric labels, the fetcher and scheduler bn_addr fields,
eth2wrap's url.Error decomposition, eth1wrap errors and the exit
commands. go-eth2-client already masks its own Address().
@sonarqubecloud

Copy link
Copy Markdown

@OisinKyne OisinKyne added the merge when ready Indicates bulldozer bot may merge when all checks pass label Oct 28, 2026
@obol-bulldozer
obol-bulldozer Bot merged commit 20232ec into main Oct 28, 2026
13 checks passed
@obol-bulldozer
obol-bulldozer Bot deleted the oisin/redact-url-credentials branch October 28, 2026 11:52
obol-bulldozer Bot pushed a commit that referenced this pull request Oct 28, 2026
Based on the `v1.11.2` tag.

- app/log: redact credentials and API keys in URLs (#4813). The builder config metric change is dropped, as v1.11 has no builder config. Conflicts in the SSE listener and the fetcher only touched v2-only code.
- app, cmd: redact beacon node URLs in the version checks and `exit fetch`, which #4813 missed (main: `oisin/redact-url-followup`).

category: bug
ticket: none
obol-bulldozer Bot pushed a commit that referenced this pull request Oct 28, 2026
Missed by #4813: the beacon node version checks log the configured addresses, and exit fetch logs the endpoints when the client fails.

category: bug 
ticket: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge when ready Indicates bulldozer bot may merge when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants