Skip to content

Harden URL handling in exported telemetry - #1477

Merged
RhysSullivan merged 10 commits into
mainfrom
oauth-telemetry-scrub
Aug 28, 2026
Merged

Harden URL handling in exported telemetry#1477
RhysSullivan merged 10 commits into
mainfrom
oauth-telemetry-scrub

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Change

Exported telemetry can carry request URLs verbatim. Query values, userinfo, and fragments are not safe in a trace store: OAuth callbacks receive ?code=…&state=…, query-auth API keys ride under arbitrary parameter names, and fragments carry implicit-grant tokens. Because parameter names are operator-chosen free text, no allowlist of safe names can exist — every query value is dropped, along with userinfo and fragments. Scheme, host, and url.path survive so traces stay debuggable.

The redaction rules live in one shared module (telemetry-url-redaction in @executor-js/sdk). Every exporter path consumes it:

  • Cloud span processor (apps/cloud/src/observability/redact-span-urls.ts) wraps the export chain — the one point every isolate span passes through. It scrubs four channels: attributes, exception events, span links, and the status message. This is the only path that also carries diagnostics: the stripped parameter names (never values) are reported as url.query.stripped_keys.
  • Serialization seam (self-host server and browser client, via UrlRedactingOtlpSerializationJson) scrubs the OTLP trace and log payloads as they serialize. Log records need it too: the OTLP logger exports pretty-printed failure causes and log annotations, both of which can embed raw URLs. Removal only — this seam adds no reporting metadata.
  • Browser-traces forwarder (cloud worker) scrubs the decoded browser batch before forwarding. The page is not a trust boundary, so the walk is generic: every string passes the scrub, and the URL-aware handling of a url.full/url.query KeyValue runs on top of the generic walk, never instead of it. Removal only.

URLs also escape the attribute bag through error messages, so the scrub has a free-text form applied to every exported string.

Verification

format:check, lint, typecheck, and the scoped suites (sdk, cloud observability, host-selfhost, react) pass.

Each redaction gap has a canary test that was proven red before its fix: a logged failure cause carrying a credential-bearing URL through the self-host export layer, a span link whose attributes carry secret URLs through the cloud processor, and a crafted KeyValue with URL-bearing sibling fields through the browser-traces path. All test data is synthetic.

Strip OAuth authorization codes and CSRF state from exported span URL
attributes, and sanitize user-supplied MCP endpoints before stamping them.
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud b8c5d08 Aug 28 2026, 09:01 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing b8c5d08 Commit Preview URL

Branch Preview URL
Aug 28 2026, 09:00 PM

@RhysSullivan RhysSullivan changed the title Scrub credentials from span attributes Scrub callbacks from span attributes Jul 28, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1477

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1477

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1477

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1477

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1477

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1477

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1477

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1477

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1477

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1477

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1477

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1477

executor

npm i https://pkg.pr.new/executor@1477

commit: b8c5d08

@RhysSullivan RhysSullivan changed the title Scrub callbacks from span attributes Harden URL handling in span attributes Jul 28, 2026
@RhysSullivan RhysSullivan changed the title Harden URL handling in span attributes Harden URL handling in exported telemetry Aug 28, 2026
@RhysSullivan
RhysSullivan marked this pull request as ready for review August 28, 2026 21:04
@RhysSullivan
RhysSullivan merged commit c0c7a0d into main Aug 28, 2026
44 checks passed
@RhysSullivan RhysSullivan mentioned this pull request Aug 28, 2026
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