Skip to content

feat: adds observability with Worker logging and Sentry#26

Merged
wgordon17 merged 10 commits intogordon-code:mainfrom
wgordon17:feat/observability
Mar 28, 2026
Merged

feat: adds observability with Worker logging and Sentry#26
wgordon17 merged 10 commits intogordon-code:mainfrom
wgordon17:feat/observability

Conversation

@wgordon17
Copy link
Copy Markdown
Member

Summary

  • Adds structured JSON logging to all Worker API endpoints (13 events covering token exchange lifecycle, CORS mismatch detection, and routing)
  • Adds Sentry error tracking client (@sentry/solid) with strict privacy hardening — no PII, no replay, no traces, URL scrubbing via beforeSend/beforeBreadcrumb
  • Adds Sentry tunnel proxy (/api/error-reporting) through the Worker for same-origin delivery (zero CSP changes, ad-blocker bypass) with DSN validation to prevent open-proxy abuse

- Fixes CI failure: removes test:waf script referencing gitignored hack/ dir
- Fixes Content-Length bypass: enforces body.length after read, not header
- Fixes parseSentryDsn path extraction: uses split/pop instead of replace
- Fixes query_string scrubbing: uses scrubUrl instead of blanket redaction
- Caches parsed DSN per isolate to avoid repeated URL parsing
- Replaces securityHeaders() function with SECURITY_HEADERS constant
- Moves token_exchange_started log after method check for accuracy
- Simplifies token_exchange_missing_code log payload to 2 fields
- Removes allowed_origin from api_request log (env var leak pattern)
- Exports scrubUrl/beforeSendHandler/beforeBreadcrumbHandler for testing
- Adds 26 new tests: sentry.ts unit tests, 413 enforcement, tunnel log
  assertions, OPTIONS tunnel, CORS mismatch for tunnel path
@wgordon17 wgordon17 merged commit a879a1e into gordon-code:main Mar 28, 2026
1 check passed
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