Skip to content

[WEB-10189] fix: derive CORS origins when none are configured - #10318

Merged
sriramveeraghanta merged 1 commit into
previewfrom
fix/web-10189-cors-origin-fallback
Nov 16, 2026
Merged

sriramveeraghanta merged 1 commit into
previewfrom
fix/web-10189-cors-origin-fallback

Conversation

@pablohashescobar

Copy link
Copy Markdown
Member

Description

When CORS_ALLOWED_ORIGINS was unset or empty, the settings fell back to CORS_ALLOW_ALL_ORIGINS = True while CORS_ALLOW_CREDENTIALS stayed on. The shipped env templates set the variable, so this affects hand-rolled deployments.

A small helper, _cors_settings, now decides the three settings:

  • A configured list is used as is.
  • With no list, the allowed origins are those of the instance's own base URLs that are set (WEB_URL, APP_BASE_URL, ADMIN_BASE_URL, SPACE_BASE_URL, LIVE_BASE_URL), the same set the session origin check already trusts.
  • With neither, every origin is allowed, without credentials.

CSRF_TRUSTED_ORIGINS is unchanged.

Behavior change: a deployment with CORS_ALLOWED_ORIGINS unset and a frontend on an origin that is not one of its configured base URLs loses credentialed CORS until it sets CORS_ALLOWED_ORIGINS or the matching base URL. This needs a release note.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

  • New plane/tests/unit/settings/test_cors_origins.py: explicit list wins; empty list plus base URLs gives those origins; nothing configured gives allow-all without credentials. 4 passed.
  • Suggested: start the API with CORS_ALLOWED_ORIGINS empty and WEB_URL set, and confirm the web origin gets credentialed CORS headers while another origin gets none.

References

  • WEB-10189

Created with Claude Code

When CORS_ALLOWED_ORIGINS is not set, the allowed origins are now derived
from the instance's own base URLs. If none of those is configured either,
all origins are still allowed, but without credentials.
Copilot AI balanced review requested due to automatic review settings November 15, 2026 23:14
@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ab06c13-b950-4c1b-9be7-a38028232deb
Commits

Reviewing files that changed from the base of the PR and between 290383d and a57f7eb.

Files selected for processing: 2

  • apps/api/plane/settings/common.py
  • apps/api/plane/tests/unit/settings/test_cors_origins.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@makeplane

makeplane Bot commented Nov 15, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@pablohashescobar pablohashescobar changed the title [WEB-10189] fix(security): derive CORS origins when none are configured [WEB-10189] fix: derive CORS origins when none are configured Nov 16, 2026

@sriramveeraghanta sriramveeraghanta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. The only setups that change are ones with neither CORS_ALLOWED_ORIGINS nor base URLs, and those already failed CSRF on writes. Non-blocking: a base URL with an explicit default port (https://x:443) won't match the browser origin. The session origin check has the same quirk.

@sriramveeraghanta
sriramveeraghanta merged commit f036cbe into preview Nov 16, 2026
19 of 20 checks passed
@sriramveeraghanta
sriramveeraghanta deleted the fix/web-10189-cors-origin-fallback branch November 16, 2026 20:24
sriramveeraghanta pushed a commit that referenced this pull request Nov 16, 2026
When CORS_ALLOWED_ORIGINS is not set, the allowed origins are now derived
from the instance's own base URLs. If none of those is configured either,
all origins are still allowed, but without credentials.
Pawel-Kranzberg pushed a commit to klazwi/pi-plane that referenced this pull request Nov 18, 2026
…ane#10318)

When CORS_ALLOWED_ORIGINS is not set, the allowed origins are now derived
from the instance's own base URLs. If none of those is configured either,
all origins are still allowed, but without credentials.

(cherry picked from commit cb9071f)
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.

3 participants