Skip to content

docs: improvements on securing Edge Functions guide - #41727

Merged
kallebysantos merged 5 commits into
supabase:masterfrom
kallebysantos:docs-improve-jwt-migration-guide
Jan 7, 2026
Merged

kallebysantos merged 5 commits into
supabase:masterfrom
kallebysantos:docs-improve-jwt-migration-guide

Conversation

@kallebysantos

@kallebysantos kallebysantos commented Jan 5, 2026 •

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

docs update

Additional context

  • using $CodeSample component to dynamic load jwt example

Summary by CodeRabbit

  • Documentation

    • Replaced the "Verifying JWT" section with an "Integrating with Supabase Auth" guide, removed inline verification examples, added CodeSample references to external templates and a custom JWT validation example, and included a Supabase Auth edge-function demo and tips.
  • Chores

    • Updated example edge-function samples to use the new JWT library references.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Jan 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
design-system Ready Ready Preview, Comment Jan 7, 2026 0:09am
docs Ready Ready Preview, Comment Jan 7, 2026 0:09am
studio-self-hosted Ready Ready Preview, Comment Jan 7, 2026 0:09am
studio-staging Ready Ready Preview, Comment Jan 7, 2026 0:09am
ui-library Ready Ready Preview, Comment Jan 7, 2026 0:09am
zone-www-dot-com Ready Ready Preview, Comment Jan 7, 2026 0:09am
2 Skipped Deployments
Project Deployment Review Updated (UTC)
cms Ignored Ignored Jan 7, 2026 0:09am
studio Ignored Ignored Jan 7, 2026 0:09am

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for contributing to Supabase! ❤️ Our team will review your PR.

A few tips for a smoother review process:

  • If you have a local version of the repo, run pnpm run format to make sure formatting checks pass.
  • Once we've reviewed your PR, please don't trivially merge master (don't click Update branch if there are no merge conflicts to be fixed). This invalidates any pre-merge checks we've run.

@vercel

vercel Bot commented Jan 5, 2026

Copy link
Copy Markdown

@kallebysantos is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jan 5, 2026
@kallebysantos
kallebysantos requested a review from laktek January 5, 2026 23:38
@coderabbitai

coderabbitai Bot commented Jan 5, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Replaces the "Verifying JWT" section in the Edge Functions auth guide with an "Integrating with Supabase Auth" section that references external CodeSample templates; updates example edge-function JWT modules to import jose via jsr:@panva/jose@6 with no other logic changes.

Changes

Cohort / File(s) Summary
Auth documentation
apps/docs/content/guides/functions/auth.mdx
Replaced inline "Verifying JWT" content with "Integrating with Supabase Auth"; removed in-page curl and JWT verification code blocks; added CodeSample references to external templates (default-jwt, custom-jwt-validation) and a tips/admonition section; minor heading and flow adjustments.
Edge function JWT examples
examples/edge-functions/supabase/functions/_shared/jwt/default.ts, examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts, examples/edge-functions/supabase/functions/_shared/jwt/clerk.ts
Swapped jose import source from the Deno URL (https://deno.land/x/[email protected]/...) to the module specifier jsr:@panva/jose@6; no other code, control flow, or error-handling changes.

Possibly related PRs

Suggested reviewers

  • laktek
  • hf
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete and lacks critical information required by the template, including: no confirmation of reading CONTRIBUTING.md, missing current behavior/issue references, and insufficient detail about new behavior and changes. Complete the template by confirming CONTRIBUTING.md was read, describing the current behavior and linked issues, providing details about the new behavior, and explaining all changes including the import path updates in the TypeScript files.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: documentation improvements to the Edge Functions securing guide, which includes restructuring the JWT verification section and migrating to CodeSample components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

supa-mdx-lint results

apps/docs/content/guides/functions/auth.mdx

Error

81 | <Admonition type="tip">
82 |   The following example uses [`jose`](https://www.npmjs.com/package/jose/v/4.10.0) library to verify received JWTs.
83 | </Admonition>
84 | 

[Rule005AdmonitionNewlines] Admonition must have empty lines between tags and content

Recommendations

  1. Insert the following text at row 82, column 1:
  2. Insert the following text at row 83, column 1:

Summary

  • 🤖 1 file linted
  • 🚨 1 error
  • 🔔 0 warnings
    🕚 Done in 0.1 seconds

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Fix all issues with AI Agents 🤖
In @apps/docs/content/guides/functions/auth.mdx:
- Line 93: Update the incorrect meta attribute value: replace
meta="name=hello/index.ts" with meta="name=custom-jwt-validation/index.ts" so
the meta matches the referenced file path (look for the meta attribute in the
frontmatter block containing the example name).
- Around line 85-95: The second CodeSample component has a mismatched meta
attribute: change meta="name=hello/index.ts" to
meta="name=custom-jwt-validation/index.ts" so the meta matches the provided path
"/edge-functions/supabase/functions/custom-jwt-validation/index.ts" (update the
meta on the CodeSample component that references
custom-jwt-validation/index.ts).

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

1-1: Fix Prettier formatting to unblock CI.

The Prettier formatting check failed. Run prettier --write on this file to fix the formatting issues.

#!/bin/bash
# Run Prettier to fix formatting
prettier --write apps/docs/content/guides/functions/auth.mdx
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1bcecb1 and 4f966dc.

📒 Files selected for processing (1)
  • apps/docs/content/guides/functions/auth.mdx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
🪛 GitHub Actions: Check Code with Prettier
apps/docs/content/guides/functions/auth.mdx

[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues in the file.

🪛 LanguageTool
apps/docs/content/guides/functions/auth.mdx

[style] ~77-~77: Consider using a more concise synonym.
Context: ...se/functions/custom-jwt-validation) and a variety of [auth function templates](https://githu...

(A_VARIETY_OF)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: typecheck
🔇 Additional comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

33-71: LGTM!

The restructured "Integrating with Supabase Auth" section clearly demonstrates how to use the Supabase client to verify JWTs via getClaims(). The example is concise and follows best practices.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @apps/docs/content/guides/functions/auth.mdx:
- Line 83: Update the referenced jose version in the docs text and link from
v/4.10.0 to a patched release (preferably v/6.1.3; if staying within v4, use at
least v/4.15.9) so the example points to a version that fixes CVE-2024-28176 and
CVE-2024-28180; modify the package/version in the example import/link and any
accompanying install command or URL that currently mentions v/4.10.0 to the
chosen safe version.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

1-97: Fix Prettier formatting to pass CI checks.

The pipeline indicates this file has formatting issues that need to be resolved.

Run the following command to fix the formatting:

prettier --write apps/docs/content/guides/functions/auth.mdx
🧹 Nitpick comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

77-77: Consider more concise wording.

The phrase "a variety of" could be shortened to "various" for a more concise style.

🔎 Proposed fix
-You can see [a custom JWT verification example on GitHub](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/custom-jwt-validation) and a variety of [auth function templates](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/_shared/jwt) also on GitHub.
+You can see [a custom JWT verification example on GitHub](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/custom-jwt-validation) and various [auth function templates](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/_shared/jwt) also on GitHub.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f966dc and 0d20517.

📒 Files selected for processing (1)
  • apps/docs/content/guides/functions/auth.mdx
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: In Supabase Edge Functions documentation, the `meta="name=..."` attribute in CodeSample components may intentionally use generic example names (like "hello/index.ts") rather than matching the actual file path being referenced, to help users understand how to adapt templates to their own use cases.
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
📚 Learning: 2026-01-05T23:42:52.357Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: When reviewing MDX documentation that uses CodeSample components in Supabase docs, it's acceptable for CodeSample meta attributes to display generic example file names (e.g., hello/index.ts) to illustrate templating. Do not flag these as file-path mismatches unless the docs claim an exact reference to a real file. If you encounter such code samples, ensure the surrounding text clarifies that the names are placeholders to be adapted by users, and suggest adding a note explaining how to map the template to a real project path.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2025-12-11T02:39:45.951Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/docs-graphql.mdc:0-0
Timestamp: 2025-12-11T02:39:45.951Z
Learning: Applies to apps/docs/app/api/graphql/tests/**/*.test.ts : Test files for GraphQL queries should be located at `apps/docs/app/api/graphql/tests/{queryName}.test.ts` and include tests for: (1) requesting all fields including nested fields with assertion for no errors and proper field returns, and (2) error triggering with assertion for proper GraphQL error response

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
🪛 GitHub Actions: Check Code with Prettier
apps/docs/content/guides/functions/auth.mdx

[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues in this file.

🪛 LanguageTool
apps/docs/content/guides/functions/auth.mdx

[style] ~77-~77: Consider using a more concise synonym.
Context: ...se/functions/custom-jwt-validation) and a variety of [auth function templates](https://githu...

(A_VARIETY_OF)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: typecheck
🔇 Additional comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

33-35: LGTM!

The section reorganization improves clarity by explicitly mentioning Supabase Auth integration in the header.

)
}
}
The following example uses [`jose`](https://www.npmjs.com/package/jose/v/4.10.0) library to verify received JWTs.

@coderabbitai coderabbitai Bot Jan 5, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

jose npm latest version security advisories 2025

💡 Result:

Summary (as of 2026-01-05)

  • Latest npm release: jose — version 6.1.3 (latest published branch). [1]

Known/security advisories and notable CVEs affecting jose (and related go-jose variants)

  • CVE-2024-28176 — resource exhaustion via crafted JWE (decompression / compressed plaintext); patched (upgrade to fixed 4.15.9+ / newer patched releases; v5.x removed compressed-payload support). [2][3]
  • CVE-2024-28180 — improper handling of highly compressed data (decompression amplification); patched in 4.0.1, 3.0.3 and 2.6.3. [4]
  • GHSA-c6gw-w398-hv78 / CVE-2025-27144 (reported Feb 2025) — DoS in go-jose when parsing compact JWS/JWE (excessive memory from splitting tokens); patched in go-jose v4.0.5 / v3.0.4. Note: this advisory targets go-jose (Go implementation), not the Node.js npm package, but is relevant if you use the Go library. [5]
  • CVE-2025-45767 — reported in vendor bulletin affecting jose v6.0.10 (weak encryption claim; vendor/third-party guidance and remediation vary); check vendor advisory and upgrade guidance. [6]

Recommendations

  • Upgrade to the current fixed release (6.1.3) and test. [1]
  • Audit usages of JWE decompression and validate/decompress payloads server-side before passing to jose.
  • Monitor GitHub Advisories / npm security advisories for new alerts and backport/patch as needed.

Sources

  1. Snyk package summary / latest version info for jose (npm) — shows latest 6.1.3. [1]
  2. Vuln advisories / Snyk for CVE-2024-28176 (resource exhaustion via JWE decompression). [2][3]
  3. CVE-2024-28180 details (improper handling of highly compressed data) — CVE database entry. [4]
  4. GitHub Advisory GHSA-c6gw-w398-hv78 (DoS in go-jose parsing; patched versions). [5]
  5. IBM security bulletin for CVE-2025-45767 (weak encryption claim affecting jose v6.0.10). [6]

If you want, I can:

  • fetch the official npm package page and the jose GitHub releases page and paste exact release dates and changelog lines; or
  • run a repo scan of your project to see if your installed version is vulnerable.

Update jose library version to address security vulnerabilities.

The documentation references jose v4.10.0, which contains known security vulnerabilities (CVE-2024-28176, CVE-2024-28180). Update the reference to v6.1.3 (latest stable) or at minimum v4.15.9 to patch CVE-2024-28176 (resource exhaustion via JWE decompression).

🤖 Prompt for AI Agents
In @apps/docs/content/guides/functions/auth.mdx around line 83, Update the
referenced jose version in the docs text and link from v/4.10.0 to a patched
release (preferably v/6.1.3; if staying within v4, use at least v/4.15.9) so the
example points to a version that fixes CVE-2024-28176 and CVE-2024-28180; modify
the package/version in the example import/link and any accompanying install
command or URL that currently mentions v/4.10.0 to the chosen safe version.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kallebysantos should we address this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this version is 3y ago.
I'd just copy it from the docker main/index.ts, maybe we should update the new template to use a latest version.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, lets update to the latest on both places.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the template examples

latest on both places.

Should I also change the main/index.ts file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled auto merge, I'd say go ahead and do this too? Then good to go

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets keep the main/index.ts to its own dedicated PR, so that I'll update the self-host docker template to use latest jose as well the new auth patterns.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @apps/docs/content/guides/functions/auth.mdx:
- Line 83: The docs reference jose v4.10.0 while the code examples use jose v6;
update the reference in auth.mdx to point to the jose v6 package/docs and change
the inline version text from v4.10.0 to v6 so it matches the import and usage in
default.ts (the JWT verification examples). Ensure any anchor/link to the npm
page uses the /v/6 path and that all mentions in the auth.mdx example text
reflect v6.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d20517 and fa10b9e.

📒 Files selected for processing (4)
  • apps/docs/content/guides/functions/auth.mdx
  • examples/edge-functions/supabase/functions/_shared/jwt/clerk.ts
  • examples/edge-functions/supabase/functions/_shared/jwt/default.ts
  • examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: In Supabase Edge Functions documentation, the `meta="name=..."` attribute in CodeSample components may intentionally use generic example names (like "hello/index.ts") rather than matching the actual file path being referenced, to help users understand how to adapt templates to their own use cases.
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: apps/docs/content/guides/functions/auth.mdx:105-110
Timestamp: 2026-01-05T12:21:45.493Z
Learning: In Supabase Edge Functions, the `SUPABASE_URL` environment variable is automatically injected by the platform at runtime and is guaranteed to be available.
Learnt from: laktek
Repo: supabase/supabase PR: 41745
File: apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout.tsx:171-190
Timestamp: 2026-01-06T18:30:25.339Z
Learning: In the Supabase edge functions system, paths with embedded "../" segments are denormalized on the backend, so frontend ZIP generation in EdgeFunctionDetailsLayout.tsx doesn't need additional path normalization beyond stripping leading "../" segments.
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.

Applied to files:

  • examples/edge-functions/supabase/functions/_shared/jwt/clerk.ts
  • examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts
  • examples/edge-functions/supabase/functions/_shared/jwt/default.ts
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, JWT_SECRET is automatically injected by the platform and is guaranteed to be present in production. Treat process.env.JWT_SECRET as defined in production and avoid adding code paths that assume it may be undefined. For development, consider a safe fallback or explicit validation only in non-production environments.

Applied to files:

  • examples/edge-functions/supabase/functions/_shared/jwt/clerk.ts
  • examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts
  • examples/edge-functions/supabase/functions/_shared/jwt/default.ts
📚 Learning: 2026-01-05T23:42:52.357Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: When reviewing MDX documentation that uses CodeSample components in Supabase docs, it's acceptable for CodeSample meta attributes to display generic example file names (e.g., hello/index.ts) to illustrate templating. Do not flag these as file-path mismatches unless the docs claim an exact reference to a real file. If you encounter such code samples, ensure the surrounding text clarifies that the names are placeholders to be adapted by users, and suggest adding a note explaining how to map the template to a real project path.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2025-12-11T02:39:45.951Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/docs-graphql.mdc:0-0
Timestamp: 2025-12-11T02:39:45.951Z
Learning: Applies to apps/docs/app/api/graphql/tests/**/*.test.ts : Test files for GraphQL queries should be located at `apps/docs/app/api/graphql/tests/{queryName}.test.ts` and include tests for: (1) requesting all fields including nested fields with assertion for no errors and proper field returns, and (2) error triggering with assertion for proper GraphQL error response

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
🪛 GitHub Actions: Check Code with Prettier
apps/docs/content/guides/functions/auth.mdx

[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues.

🪛 LanguageTool
apps/docs/content/guides/functions/auth.mdx

[style] ~77-~77: Consider using a more concise synonym.
Context: ...se/functions/custom-jwt-validation) and a variety of [auth function templates](https://githu...

(A_VARIETY_OF)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: typecheck
🔇 Additional comments (5)
examples/edge-functions/supabase/functions/_shared/jwt/clerk.ts (1)

3-3: LGTM with verification pending.

The jose library update from v4.14.4 to v6 aligns with the PR objective to use the latest jose version. The usage patterns for createRemoteJWKSet and jwtVerify should be verified for compatibility as requested in the legacy-jwt.ts review.

examples/edge-functions/supabase/functions/_shared/jwt/default.ts (1)

3-3: LGTM with verification pending.

The jose library update is consistent across all JWT utility files. Verification of v6 API compatibility is being handled for the legacy-jwt.ts file and applies here as well.

apps/docs/content/guides/functions/auth.mdx (2)

33-71: Clear documentation improvement.

The new "Integrating with Supabase Auth" section provides a practical example using supabase.auth.getClaims() for token verification. The example is clear and demonstrates proper error handling.


87-97: LGTM - CodeSample components correctly reference template files.

The CodeSample components properly reference the updated JWT verification templates. The generic meta="name=hello/index.ts" is intentional to help users adapt the template to their own function names.

Based on learnings, the meta attribute pattern is correct for showing users how to implement templates in their own edge functions.

examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts (1)

3-3: No action required. The jose v6 update is compatible with the existing usage pattern.

The code passes a Uint8Array (created via TextEncoder().encode(JWT_SECRET)) to jwtVerify(), which is explicitly the preferred key format for jose v6. The breaking changes from v4 to v6 do not impact this implementation, as it already aligns with v6's expectations for key input types.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

1-97: Fix Prettier formatting violations to unblock CI.

The GitHub Actions pipeline reports a Prettier formatting check failure. Run prettier --write apps/docs/content/guides/functions/auth.mdx locally to fix the formatting issues before merging.

🧹 Nitpick comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

83-83: Consider specifying the jose version for clarity.

The documentation references the jose library without specifying a version, while the code examples use jsr:@panva/jose@6. Consider adding version information in the text or link to help readers understand which version is being used.

🔎 Suggested enhancement
-The following example uses [`jose`](https://jsr.io/@panva/jose) library to verify received JWTs.
+The following example uses the [`jose`](https://jsr.io/@panva/jose) library (v6) to verify received JWTs.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa10b9e and 3a312ca.

📒 Files selected for processing (1)
  • apps/docs/content/guides/functions/auth.mdx
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: In Supabase Edge Functions documentation, the `meta="name=..."` attribute in CodeSample components may intentionally use generic example names (like "hello/index.ts") rather than matching the actual file path being referenced, to help users understand how to adapt templates to their own use cases.
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: apps/docs/content/guides/functions/auth.mdx:105-110
Timestamp: 2026-01-05T12:21:45.493Z
Learning: In Supabase Edge Functions, the `SUPABASE_URL` environment variable is automatically injected by the platform at runtime and is guaranteed to be available.
Learnt from: laktek
Repo: supabase/supabase PR: 41745
File: apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout.tsx:171-190
Timestamp: 2026-01-06T18:30:25.339Z
Learning: In the Supabase edge functions system, paths with embedded "../" segments are denormalized on the backend, so frontend ZIP generation in EdgeFunctionDetailsLayout.tsx doesn't need additional path normalization beyond stripping leading "../" segments.
📚 Learning: 2026-01-05T23:42:52.357Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: When reviewing MDX documentation that uses CodeSample components in Supabase docs, it's acceptable for CodeSample meta attributes to display generic example file names (e.g., hello/index.ts) to illustrate templating. Do not flag these as file-path mismatches unless the docs claim an exact reference to a real file. If you encounter such code samples, ensure the surrounding text clarifies that the names are placeholders to be adapted by users, and suggest adding a note explaining how to map the template to a real project path.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2025-12-11T02:39:45.951Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/docs-graphql.mdc:0-0
Timestamp: 2025-12-11T02:39:45.951Z
Learning: Applies to apps/docs/app/api/graphql/tests/**/*.test.ts : Test files for GraphQL queries should be located at `apps/docs/app/api/graphql/tests/{queryName}.test.ts` and include tests for: (1) requesting all fields including nested fields with assertion for no errors and proper field returns, and (2) error triggering with assertion for proper GraphQL error response

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
🪛 GitHub Actions: Check Code with Prettier
apps/docs/content/guides/functions/auth.mdx

[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues in this file.

🪛 LanguageTool
apps/docs/content/guides/functions/auth.mdx

[style] ~77-~77: Consider using a more concise synonym.
Context: ...se/functions/custom-jwt-validation) and a variety of [auth function templates](https://githu...

(A_VARIETY_OF)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: typecheck

@kallebysantos

Copy link
Copy Markdown
Member Author

Hey guys, prettier is complaining about format.
But the "correct" style after pnpm run format leads to a broken link due by \_shared

Details image

@ChrisChinchilla

Copy link
Copy Markdown
Contributor

@kallebysantos Let me see, but it also gets hard for me to work with forks, an annoying feature of GitHub. :(

@ChrisChinchilla
ChrisChinchilla enabled auto-merge (squash) January 7, 2026 12:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/docs/content/guides/functions/auth.mdx (1)

83-83: Consider mentioning jose v6 for consistency.

The link references the jose library but doesn't specify the version, while the code examples specifically use jsr:@panva/jose@6. Consider mentioning "v6" in the text to align with the actual imports and help users understand which version to use.

📝 Optional documentation enhancement
-The following example uses [`jose`](https://jsr.io/@panva/jose) library to verify received JWTs.
+The following example uses [`jose`](https://jsr.io/@panva/jose) library (v6) to verify received JWTs.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a312ca and da1c7d2.

📒 Files selected for processing (1)
  • apps/docs/content/guides/functions/auth.mdx
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: In Supabase Edge Functions documentation, the `meta="name=..."` attribute in CodeSample components may intentionally use generic example names (like "hello/index.ts") rather than matching the actual file path being referenced, to help users understand how to adapt templates to their own use cases.
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: apps/docs/content/guides/functions/auth.mdx:105-110
Timestamp: 2026-01-05T12:21:45.493Z
Learning: In Supabase Edge Functions, the `SUPABASE_URL` environment variable is automatically injected by the platform at runtime and is guaranteed to be available.
Learnt from: laktek
Repo: supabase/supabase PR: 41745
File: apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionDetailsLayout.tsx:171-190
Timestamp: 2026-01-06T18:30:25.339Z
Learning: In the Supabase edge functions system, paths with embedded "../" segments are denormalized on the backend, so frontend ZIP generation in EdgeFunctionDetailsLayout.tsx doesn't need additional path normalization beyond stripping leading "../" segments.
📚 Learning: 2026-01-05T23:42:52.357Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41727
File: apps/docs/content/guides/functions/auth.mdx:93-93
Timestamp: 2026-01-05T23:42:52.357Z
Learning: When reviewing MDX documentation that uses CodeSample components in Supabase docs, it's acceptable for CodeSample meta attributes to display generic example file names (e.g., hello/index.ts) to illustrate templating. Do not flag these as file-path mismatches unless the docs claim an exact reference to a real file. If you encounter such code samples, ensure the surrounding text clarifies that the names are placeholders to be adapted by users, and suggest adding a note explaining how to map the template to a real project path.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2025-12-11T02:39:45.951Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/docs-graphql.mdc:0-0
Timestamp: 2025-12-11T02:39:45.951Z
Learning: Applies to apps/docs/app/api/graphql/tests/**/*.test.ts : Test files for GraphQL queries should be located at `apps/docs/app/api/graphql/tests/{queryName}.test.ts` and include tests for: (1) requesting all fields including nested fields with assertion for no errors and proper field returns, and (2) error triggering with assertion for proper GraphQL error response

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
📚 Learning: 2026-01-05T12:21:37.661Z
Learnt from: kallebysantos
Repo: supabase/supabase PR: 41444
File: examples/edge-functions/supabase/functions/_shared/jwt/legacy-jwt.ts:6-7
Timestamp: 2026-01-05T12:21:37.661Z
Learning: In Supabase Edge Functions, the JWT_SECRET environment variable is automatically injected by the Supabase platform and is guaranteed to be present in production environments.

Applied to files:

  • apps/docs/content/guides/functions/auth.mdx
🪛 LanguageTool
apps/docs/content/guides/functions/auth.mdx

[style] ~77-~77: Consider using a more concise synonym.
Context: ...se/functions/custom-jwt-validation) and a variety of [auth function templates](https://githu...

(A_VARIETY_OF)

🔇 Additional comments (5)
apps/docs/content/guides/functions/auth.mdx (5)

33-36: LGTM! Clear section heading and introduction.

The new section heading and introductory text clearly communicate the recommended authentication approach.


48-71: LGTM! Solid authentication example.

The code example correctly demonstrates JWT validation using Supabase Auth with proper error handling and appropriate HTTP response codes.


73-79: LGTM! Clear instructions and helpful resources.

The section provides clear guidance with direct links to template examples on GitHub.


86-91: Good fix for the Prettier formatting issue!

The prettier-ignore comment correctly addresses the reported Prettier issue that was causing broken links with \_shared. This prevents Prettier from modifying the CodeSample component attributes.


93-97: LGTM! Template reference follows the documented pattern.

The CodeSample correctly references the custom JWT validation example. The generic meta="name=hello/index.ts" intentionally demonstrates how users would adapt this template to their own function names.

Based on learnings, this is the established pattern for template documentation.

@kallebysantos
kallebysantos merged commit 037e5f9 into supabase:master Jan 7, 2026
@github-actions

github-actions Bot commented Jan 7, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1767796101)

Score Average Improvements Regressions
Completeness 100% (+0pp) - -
Conciseness 0% (+0pp) - -
Goal Completion 90% (+0pp) - -
Tool Usage 60% (-20pp) - 1 🔴
SQL Validity 100% (+0pp) - -
Time_to_first_token 0.12tok (-0.08tok) 4 🟢 1 🔴
Llm_calls 8 (+0.2) 2 🟢 1 🔴
Tool_calls 4.4 (+0) 2 🟢 2 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 56622tok (+3216.4tok) 3 🟢 2 🔴
Prompt_cached_tokens 42086.4tok (-665.6tok) 2 🟢 3 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 6584.8tok (+922.8tok) 1 🟢 4 🔴
Completion_reasoning_tokens 4889.6tok (+896tok) 1 🟢 4 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 63206.8tok (+4139.2tok) 1 🟢 4 🔴
Estimated_cost 0.02$ (+0$) 1 🟢 4 🔴
Duration 70.48s (+9.57s) 1 🟢 4 🔴
Llm_duration 140.35s (+18.97s) 1 🟢 4 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants