Skip to content

Conversation

@tusharpandey13
Copy link
Contributor

@tusharpandey13 tusharpandey13 commented Nov 3, 2025

This PR adds the handleProxy handler, a transparent and secure authenticating proxy to handle secure API calls originating from browser.

Changes:

  • auth-client.ts:
    • added handleProxy, handlePreflight
    • added proxyMatcher in handler to enable future use-case support and to enable exhaustive testing of the proxy handler
  • utils/proxy.ts: header filters, url transform, proxy matcher

References

  • RFC 2616
  • RFC 7231
  • RFC 6454
  • RFC 9449
  • WHATWG Fetch Spec

Tests

proxy-handler.test.ts: Added tests for proxy handler covering:

  • Basic Proxy Routing & Session Management
  • HTTP Method Routing
  • URL Path Matching & Transformation
  • HTTP Headers Forwarding
  • Request Body Handling
  • Bearer Token Handling
  • DPoP Token Handling
  • Session Update After Token Refresh
  • Error Scenarios
  • Concurrent Request Handling
  • CORS Handling

proxy.test.ts: Tests for header filters, url transform, proxy matcher

@tusharpandey13 tusharpandey13 requested a review from a team as a code owner November 3, 2025 05:00
@tusharpandey13 tusharpandey13 changed the title feat/proxy handler feat: Proxy handler Nov 3, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 96.57321% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.50%. Comparing base (4a5834f) to head (529ed74).

Files with missing lines Patch % Lines
src/server/auth-client.ts 95.23% 6 Missing ⚠️
src/test/proxy-handler-test-helpers.ts 95.41% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2398      +/-   ##
==========================================
+ Coverage   87.90%   88.50%   +0.59%     
==========================================
  Files          37       39       +2     
  Lines        4127     4436     +309     
  Branches      818      878      +60     
==========================================
+ Hits         3628     3926     +298     
- Misses        496      507      +11     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

4 participants