Skip to content

fix(supabase): add trace context headers to canonical CORS allow-list - #2603

Merged
mandarini merged 1 commit into
masterfrom
fix/cors-trace-headers
Aug 11, 2026
Merged

mandarini merged 1 commit into
masterfrom
fix/cors-trace-headers

Conversation

@mandarini

@mandarini mandarini commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

The canonical CORS allow-list exported by @supabase/supabase-js/cors predates trace propagation, so browser calls to Edge Functions that use corsHeaders fail the CORS preflight when tracePropagation is enabled (traceparent is not a safelisted request header, and the function's own allow-list answers the preflight). This adds the three W3C trace context headers (traceparent, tracestate, baggage) to the list, which also fixes the default CORS handling in @supabase/server, since withSupabase imports this exact list. The unit test now pins the full header list, so the next header the SDK starts sending cannot slip through without being added here.

Note on scope: this changes only the response-side allow-list (what a browser is permitted to send), not what the SDK sends. Trace headers are sent exclusively by clients that explicitly opt in via tracePropagation: true (disabled by default) — clients that have not opted in send exactly the same headers as before, so this cannot repeat the class of breakage where a newly sent default header failed preflights against existing allow-lists.

@github-actions github-actions Bot added the supabase-js Related to the supabase-js library. label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2cb1560b-d5dc-4474-911f-730ab68ebfff

📥 Commits

Reviewing files that changed from the base of the PR and between 586dee3 and 166332a.

📒 Files selected for processing (2)
  • packages/core/supabase-js/src/cors.ts
  • packages/core/supabase-js/test/unit/cors.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for trace context headers: traceparent, tracestate, and baggage.
  • Documentation

    • Clarified the required synchronization process for SDK and CORS headers.
    • Documented the purpose of the new tracing headers.
  • Tests

    • Added coverage to verify the complete, sorted CORS header allowlist and trace context headers.

Walkthrough

The CORS module now documents manual synchronization between SDK headers and the CORS allowlist. traceparent, tracestate, and baggage were added to SUPABASE_HEADERS. The unit test now compares the exact sorted header list and verifies the trace context headers explicitly.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2603

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2603

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2603

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2603

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2603

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2603

commit: 166332a

@mandarini
mandarini marked this pull request as ready for review August 10, 2026 14:13
@mandarini
mandarini requested a review from a team as a code owner August 10, 2026 14:13
@mandarini mandarini self-assigned this Aug 10, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 77.684%. remained the same — fix/cors-trace-headers into master

@mandarini
mandarini merged commit 9f0358c into master Aug 11, 2026
32 of 33 checks passed
@mandarini
mandarini deleted the fix/cors-trace-headers branch August 11, 2026 06:27
mandarini pushed a commit to supabase/ssr that referenced this pull request Aug 11, 2026
This PR updates `@supabase/supabase-js` to v2.112.3.

**Source**: manual

---

## Release Notes

## v2.112.3

## 2.112.3 (2026-08-11)

### 🩹 Fixes

- **supabase:** add trace context headers to canonical CORS allow-list
([#2603](supabase/supabase-js#2603))
- **supabase:** improve trace propagation sampling and diagnostics
([#2604](supabase/supabase-js#2604))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
## v2.112.2

## 2.112.2 (2026-08-06)

### 🩹 Fixes

- **realtime:** prevent duplicate on bindings
([#2594](supabase/supabase-js#2594))
- **realtime:** clear stale join payload on sign-out
([#2597](supabase/supabase-js#2597))

### ❤️ Thank You

- Filipe Cabaço @filipecabaco
- Vaibhav @7ttp
## v2.112.1

## 2.112.1 (2026-08-05)

### 🩹 Fixes

- **auth:** preserve 5xx error message
([#2587](supabase/supabase-js#2587))
- **realtime:** ensure setAuth doesn't disable token refresh
([#2592](supabase/supabase-js#2592))

### ❤️ Thank You

- Eduardo Gurgel
- Vaibhav @7ttp
## v2.112.0

## 2.112.0 (2026-08-03)

### 🚀 Features

- **supabase:** move OpenTelemetry tracing to opt-in /tracing subpath
([#2583](supabase/supabase-js#2583))

### 🩹 Fixes

- **auth:** accept uppercase UUIDs in validateUUID
([#2467](supabase/supabase-js#2467))
- **postgrest:** honour throwOnError when maybeSingle finds multiple
rows ([#2580](supabase/supabase-js#2580))
- **storage:** resolve createSignedUrls return type mismatch
([#2474](supabase/supabase-js#2474))
- **storage:** expose service error code on StorageApiError
([#2537](supabase/supabase-js#2537))
- **supabase:** forward db retry option
([#2571](supabase/supabase-js#2571))

### ❤️ Thank You

- Anubhav Anand @i-anubhav-anand
- Gourab Singha @gourabsingha1
- Juhef @juheff
- Katerina Skroumpelou @mandarini
- Thribhuvan
- Vaibhav @7ttp
- Zuhef Ahmed @Zuhef

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/supabase that referenced this pull request Aug 11, 2026
This PR updates @supabase/*-js libraries to version 2.112.3.

**Source**: manual

**Changes**:
- Updated @supabase/supabase-js to 2.112.3
- Updated @supabase/auth-js to 2.112.3
- Updated @supabase/realtime-js to 2.112.3
- Updated @supabase/postgest-js to 2.112.3
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.112.3

## 2.112.3 (2026-08-11)

### 🩹 Fixes

- **supabase:** add trace context headers to canonical CORS allow-list
([#2603](supabase/supabase-js#2603))
- **supabase:** improve trace propagation sampling and diagnostics
([#2604](supabase/supabase-js#2604))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
## v2.112.2

## 2.112.2 (2026-08-06)

### 🩹 Fixes

- **realtime:** prevent duplicate on bindings
([#2594](supabase/supabase-js#2594))
- **realtime:** clear stale join payload on sign-out
([#2597](supabase/supabase-js#2597))

### ❤️ Thank You

- Filipe Cabaço @filipecabaco
- Vaibhav @7ttp
## v2.112.1

## 2.112.1 (2026-08-05)

### 🩹 Fixes

- **auth:** preserve 5xx error message
([#2587](supabase/supabase-js#2587))
- **realtime:** ensure setAuth doesn't disable token refresh
([#2592](supabase/supabase-js#2592))

### ❤️ Thank You

- Eduardo Gurgel
- Vaibhav @7ttp
## v2.112.0

## 2.112.0 (2026-08-03)

### 🚀 Features

- **supabase:** move OpenTelemetry tracing to opt-in /tracing subpath
([#2583](supabase/supabase-js#2583))

### 🩹 Fixes

- **auth:** accept uppercase UUIDs in validateUUID
([#2467](supabase/supabase-js#2467))
- **postgrest:** honour throwOnError when maybeSingle finds multiple
rows ([#2580](supabase/supabase-js#2580))
- **storage:** resolve createSignedUrls return type mismatch
([#2474](supabase/supabase-js#2474))
- **storage:** expose service error code on StorageApiError
([#2537](supabase/supabase-js#2537))
- **supabase:** forward db retry option
([#2571](supabase/supabase-js#2571))

### ❤️ Thank You

- Anubhav Anand @i-anubhav-anand
- Gourab Singha @gourabsingha1
- Juhef @juheff
- Katerina Skroumpelou @mandarini
- Thribhuvan
- Vaibhav @7ttp
- Zuhef Ahmed @Zuhef
## v2.111.0

## 2.111.0 (2026-07-28)

### 🚀 Features

- **auth:** store PKCE verifiers in per-flow slots to survive
overlapping flows
([#2569](supabase/supabase-js#2569))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini added a commit to supabase/supabase that referenced this pull request Aug 11, 2026
Updates the client-side tracing and Edge Function CORS docs for changes
shipping in `@supabase/supabase-js` v2.112.3 (supabase/supabase-js#2603,
supabase/supabase-js#2604). The tracing guide gains a vendor
compatibility table (plain OpenTelemetry works as is, Sentry needs
`propagateTraceparent: true`, Datadog RUM needs `allowedTracingUrls`),
the new `respectSamplingDecision` semantics (non-sampled requests now
carry `traceparent` only, so logs stay correlatable), a troubleshooting
entry for the SDK's new propagator warning, and a note that browser
calls to Edge Functions need the trace headers in the function's CORS
allow-list. The CORS guide now states explicitly that trace headers are
sent only when trace propagation is opted in (never by default), adds a
table of when each SDK header is actually sent, and the hardcoded
`corsHeaders` examples are updated to the full header list. Should merge
after the v2.112.3 release is published, since it documents that
version's behavior.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Expanded CORS guidance with trace-propagation requirements and SDK
version considerations.
* Added browser and Edge Function setup guidance for client-side
tracing.
* Documented updated sampling behavior, advanced configuration, vendor
setup examples, and troubleshooting.

* **Bug Fixes**
* Updated CORS configurations to allow retry and tracing headers
required for supported requests.
* Improved compatibility for browser requests that transmit distributed
tracing context.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
sickn33 added a commit to sickn33/agentic-awesome-skills that referenced this pull request Sep 2, 2026
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)

<h3>Snyk has created this PR to upgrade @supabase/supabase-js from 2.112.2 to 2.112.3.</h3>

:information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.

<hr/>

- The recommended version is **2 versions** ahead of your current version.

- The recommended version was released **22 days ago**.

#### Breaking Change Risk

![Merge Risk: Low](https://img.shields.io/badge/Merge%20Risk%3A%20Low-006400?style=for-the-badge)

> **Notice:** This assessment is enhanced by AI.

<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>@supabase/supabase-js</b></summary>
    <ul>
      <li>
        <b>2.112.3</b> - <a href="https://redirect.github.com/supabase/supabase-js/releases/tag/v2.112.3">2026-08-11</a></br><h2>2.112.3 (2026-08-11)</h2>
<h3>🩹 Fixes</h3>
<ul>
<li><strong>supabase:</strong> add trace context headers to canonical CORS allow-list (<a href="https://redirect.github.com/supabase/supabase-js/pull/2603" data-hovercard-type="pull_request" data-hovercard-url="/supabase/supabase-js/pull/2603/hovercard">#2603</a>)</li>
<li><strong>supabase:</strong> improve trace propagation sampling and diagnostics (<a href="https://redirect.github.com/supabase/supabase-js/pull/2604" data-hovercard-type="pull_request" data-hovercard-url="/supabase/supabase-js/pull/2604/hovercard">#2604</a>)</li>
</ul>
<h3>❤️ Thank You</h3>
<ul>
<li>Katerina Skroumpelou <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mandarini/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/mandarini">@ mandarini</a></li>
</ul>
      </li>
      <li>
        <b>2.112.3-canary.0</b> - <a href="https://redirect.github.com/supabase/supabase-js/releases/tag/v2.112.3-canary.0">2026-08-11</a></br><h2>2.112.3-canary.0 (2026-08-11)</h2>
<h3>🩹 Fixes</h3>
<ul>
<li><strong>supabase:</strong> add trace context headers to canonical CORS allow-list (<a href="https://redirect.github.com/supabase/supabase-js/pull/2603" data-hovercard-type="pull_request" data-hovercard-url="/supabase/supabase-js/pull/2603/hovercard">#2603</a>)</li>
<li><strong>supabase:</strong> improve trace propagation sampling and diagnostics (<a href="https://redirect.github.com/supabase/supabase-js/pull/2604" data-hovercard-type="pull_request" data-hovercard-url="/supabase/supabase-js/pull/2604/hovercard">#2604</a>)</li>
</ul>
<h3>❤️ Thank You</h3>
<ul>
<li>Katerina Skroumpelou <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mandarini/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/mandarini">@ mandarini</a></li>
</ul>
      </li>
      <li>
        <b>2.112.2</b> - <a href="https://redirect.github.com/supabase/supabase-js/releases/tag/v2.112.2">2026-08-06</a></br><h2>2.112.2 (2026-08-06)</h2>
<h3>🩹 Fixes</h3>
<ul>
<li><strong>realtime:</strong> prevent duplicate on bindings (<a href="https://redirect.github.com/supabase/supabase-js/pull/2594" data-hovercard-type="pull_request" data-hovercard-url="/supabase/supabase-js/pull/2594/hovercard">#2594</a>)</li>
<li><strong>realtime:</strong> clear stale join payload on sign-out (<a href="https://redirect.github.com/supabase/supabase-js/pull/2597" data-hovercard-type="pull_request" data-hovercard-url="/supabase/supabase-js/pull/2597/hovercard">#2597</a>)</li>
</ul>
<h3>❤️ Thank You</h3>
<ul>
<li>Filipe Cabaço <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/filipecabaco/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/filipecabaco">@ filipecabaco</a></li>
<li>Vaibhav <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/7ttp/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/7ttp">@ 7ttp</a></li>
</ul>
      </li>
    </ul>
    from <a href="https://redirect.github.com/supabase/supabase-js/releases">@supabase/supabase-js GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with your project.
> - This PR was automatically created by Snyk using the credentials of a real user.

---

**Note:** _You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6ImZha2Uta2V5IiwiYW5vbnltb3VzSWQiOiI4NjBiMmEwOS0zZGYzLTRiYzEtOGY1NC05NjI1Yzc2NzE2MTAiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6Ijg2MGIyYTA5LTNkZjMtNGJjMS04ZjU0LTk2MjVjNzY3MTYxMCJ9fQ==" width="0" height="0"/>

> - 🧐 [View latest project report](https://app.eu.snyk.io/org/antigravity-awesome-skills-default/project/e1f199d3-0a16-4ac7-a9a1-528e774fc41f?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR settings](https://app.eu.snyk.io/org/antigravity-awesome-skills-default/project/e1f199d3-0a16-4ac7-a9a1-528e774fc41f/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.eu.snyk.io/org/antigravity-awesome-skills-default/project/e1f199d3-0a16-4ac7-a9a1-528e774fc41f/settings/integration?pkg&#x3D;@supabase/supabase-js&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: # 'snyk:metadata:{"breakingChangeRiskLevel":"low","FF_showPullRequestBreakingChanges":true,"FF_showPullRequestBreakingChangesWebSearch":false,"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"@supabase/supabase-js","from":"2.112.2","to":"2.112.3"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"860b2a09-3df3-4bc1-8f54-9625c7671610","prPublicId":"860b2a09-3df3-4bc1-8f54-9625c7671610","packageManager":"npm","priorityScoreList":[],"projectPublicId":"e1f199d3-0a16-4ac7-a9a1-528e774fc41f","projectUrl":"https://app.eu.snyk.io/org/antigravity-awesome-skills-default/project/e1f199d3-0a16-4ac7-a9a1-528e774fc41f?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":2,"publishedDate":"2026-08-11T07:30:00.532Z"},"vulns":[]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

supabase-js Related to the supabase-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants