Skip to content

Telemetry: wait for the AWS WAF token before each export - #4817

Merged
reakaleek merged 4 commits into
mainfrom
feat/otel-waf-token
Nov 12, 2026
Merged

reakaleek merged 4 commits into
mainfrom
feat/otel-waf-token

Conversation

@reakaleek

Copy link
Copy Markdown
Member

Why

  • The browser telemetry endpoints /docs/_api/v1/o/{t,l,m} accept unauthenticated writes and are being scanned.
  • A WAF token challenge on these paths raises the cost for clients that don't run the page JavaScript. The browser must send the aws-waf-token cookie first, or its exports get a 202 challenge that the exporter counts as success.

Part of elastic/docs-eng-team#1192

What

  • When waf_integration_url is set, each OTLP export waits for the AWS WAF token. This is the same switch page feedback uses. Without the URL, nothing changes.
  • If no token arrives within 5 seconds, exports go out without one. Losing some events is acceptable for telemetry.
  • Page feedback and telemetry share one WAF SDK loader (Assets/waf.ts), so the script loads once per page.

Notes

  • EDOT still starts at page load. Only the exports wait, through an async headers function. Web components wait for telemetry setup, so holding the SDK start would delay them by up to 5 seconds.
  • EDOT types exportConfig.headers as an object, so the function needs a cast. The OTLP exporters it uses (0.221) accept a function and await it before each export. An EDOT upgrade that copies headers would silently drop the wait. A follow-up EDOT change can widen the type.
  • The WAF rule comes later in docs-infra: add /docs/_api/v1/o/ to api_token_required_path_prefixes once this is live. Edge and demo already have waf_integration_url. Staging and prod need it, and api_token_domains, first.

🤖 Generated with Claude Code

@reakaleek
reakaleek requested a review from a team as a code owner November 11, 2026 12:27
@reakaleek
reakaleek requested a review from Mpdreamz November 11, 2026 12:27
@github-actions

Copy link
Copy Markdown
Contributor

reakaleek and others added 2 commits November 12, 2026 15:09
…ut (per review by @infra-vault-gh-plugin-prod)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…review by @infra-vault-gh-plugin-prod)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r review by @infra-vault-gh-plugin-prod)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@reakaleek
reakaleek merged commit 5b4504d into main Nov 12, 2026
43 checks passed
@reakaleek
reakaleek deleted the feat/otel-waf-token branch November 12, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant