• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-py / 42004898218 / 28
99%
main: 99%

Build:
DEFAULT BRANCH: main
Ran 05 Nov 2026 09:48AM UTC
Files 24
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

05 Nov 2026 09:44AM UTC coverage: 97.51%. Remained the same
42004898218.28

push

github

web-flow
fix(utils): drop credential headers on cross origin redirects (#1994)

## What this changes

The `supabase_utils` httpx and aiohttp adapters now remove the `apikey`
and `Authorization` headers once a redirect leaves the origin (scheme,
host and port) of the original request, and keep them off every later
hop, even one that comes back to the original origin. Redirects that
stay on the original origin, or upgrade from `http` to `https` on the
same host (the same exception httpx makes for `Authorization`), keep
both headers. Whether redirects are followed at all is still up to the
client's own configuration.

## The problem

httpx and aiohttp only strip `Authorization` when a redirect leaves the
origin. The `apikey` header is forwarded unchanged. On a server this is
often the `service_role` key, so an Edge Function (or any endpoint) that
redirects to an outside host leaks it. The default clients from
`supabase.httpx` follow redirects, and aiohttp follows them by default.

v2 fixed this for functions in #1885, but the fix never reached v3. In
v3 every package only receives a session, so the fix lives in the shared
adapters and covers every package and both HTTP libraries.

## The fix

- `supabase_utils.http.redirects`: one origin rule (`keeps_credentials`)
and the list of credential headers, shared by both adapters.
- httpx: the adapter sends with `follow_redirects=False` and follows
`response.next_request` itself when `client.follow_redirects` is set.
httpx still builds every redirect request (method changes, cookies,
`Host`), and `max_redirects` and `TooManyRedirects` behave as before.
Before each cross origin hop, the credential headers are removed. Hops
are sent with `auth=None`, so the client's `auth` is applied once to the
first request, as httpx does natively, and is not added back to a cross
origin hop.
- aiohttp: the adapter adds a per request client middleware, which
aiohttp runs on every redirect hop, that removes the credential headers
from th... (continued)

2036 of 2088 relevant lines covered (97.51%)

0.98 hits per line

Source Files on job postgrest-py3.11-highest - 42004898218.28
  • Tree
  • List 24
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 42004898218
  • 72bf7606 on github
  • Prev Job for on main (#42004781188.22)
  • Next Job for on main (#42005876479.2)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc