Skip to content

Conversation

@LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Jan 16, 2026

Description

A previous PR introduced a fetch call to image CDNs in order to download an image returned from our /organization-creation-defaults endpoint:

This fetch call fails if the connect-src directive doesn't contain the image CDN hosts, resulting in a CSP violation.

This PR adds those URLs to the connect-src directive to allow the fetch to succeed. img.clerk.com is already whitelisted in the img-src directive, meaning browsers already trust this host for loading images via <img> tags. We're simply extending this trust to fetch requests.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Bug Fixes
    • Updated Content Security Policy to allow images from additional trusted CDN sources so images load and display correctly across the application.

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

@LauraBeatris LauraBeatris self-assigned this Jan 16, 2026
@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2026

🦋 Changeset detected

Latest commit: c17449f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 16, 2026

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

Project Deployment Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 16, 2026 1:45pm

Review with Vercel Agent

@LauraBeatris LauraBeatris requested a review from a team January 16, 2026 13:36
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

Two image CDN hosts (https://img.clerk.com and https://images.clerkstage.dev) were added to the Content Security Policy connect-src directive. A changeset file documenting a patch version bump was added. Tests were updated to reflect the additional allowed connect-src origins.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: adding image CDNs to the connect-src CSP directive. It is concise, specific, and directly reflects the primary objective of the changeset.
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.



📜 Recent review details

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ad0c52c and c17449f.

📒 Files selected for processing (3)
  • .changeset/orange-feet-see.md
  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
  • packages/nextjs/src/server/content-security-policy.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/orange-feet-see.md
  • packages/nextjs/src/server/content-security-policy.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

All code must pass ESLint checks with the project's configuration

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Follow established naming conventions (PascalCase for components, camelCase for variables)

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
packages/**/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{test,spec}.{ts,tsx,js,jsx}: Unit tests are required for all new functionality
Verify proper error handling and edge cases
Include tests for all new features

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.ts?(x)

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.{test,spec,e2e}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use real Clerk instances for integration tests

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details in classes
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like <T extends { id: string }>
Use utility types like Omit, Partial, and Pick for data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Use const assertions with as const for literal types
Use satisfies operator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use React Testing Library for component testing

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use ESLint with custom configurations tailored for different package types

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use Prettier for code formatting across all packages

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
**/*

⚙️ CodeRabbit configuration file

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.

Files:

  • packages/nextjs/src/server/__tests__/content-security-policy.test.ts
⏰ 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). (28)
  • GitHub Check: Static analysis
  • GitHub Check: Unit Tests (**)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (shared, clerk-js, RQ)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (machine, chrome, RQ)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
  • GitHub Check: Integration Tests (billing, chrome, RQ)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: semgrep-cloud-platform/scan

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 16, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7610

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7610

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7610

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7610

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7610

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7610

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7610

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7610

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7610

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7610

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7610

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7610

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7610

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7610

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7610

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7610

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7610

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7610

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7610

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7610

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7610

commit: c17449f

@LauraBeatris LauraBeatris force-pushed the laura/add-image-cdns-to-connect-src branch from 2d3ddcf to cd1674a Compare January 16, 2026 13:42
@LauraBeatris LauraBeatris force-pushed the laura/add-image-cdns-to-connect-src branch from cd1674a to c17449f Compare January 16, 2026 13:44
@LauraBeatris LauraBeatris merged commit 927d28a into main Jan 16, 2026
44 checks passed
@LauraBeatris LauraBeatris deleted the laura/add-image-cdns-to-connect-src branch January 16, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants