Skip to content

relax CORS policy for read-only endpoints - #630

Merged
elfkuzco merged 1 commit into
mainfrom
public-endpoints-cors-policy
Nov 4, 2026
Merged

elfkuzco merged 1 commit into
mainfrom
public-endpoints-cors-policy

Conversation

@elfkuzco

@elfkuzco elfkuzco commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

This PR enhances the API to allow public and unauthenticated GET/HEAD endpoints to be read from any origin while keeping endpoints behind a permission or state-changing routes behind the standard CORS policy

Changes

  • add custom middleware to set relaxed CORS policy for public read-only endpoints
  • add decorator (@cors_public) to explicitly mark endpoints as public and read-only
  • update integrators README with section on CORS policy

This closes #611

@elfkuzco
elfkuzco added this pull request to stack #629 November 2, 2026 22:09
@elfkuzco elfkuzco self-assigned this Nov 2, 2026
@elfkuzco
elfkuzco requested a review from benoit74 November 2, 2026 22:09
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.65%. Comparing base (9d6ec0b) to head (53c3cd7).

Files with missing lines Patch % Lines
backend/src/cms_backend/api/main.py 77.77% 1 Missing and 1 partial ⚠️
backend/src/cms_backend/api/middleware/cors.py 97.95% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #630      +/-   ##
==========================================
+ Coverage   81.41%   81.65%   +0.24%     
==========================================
  Files          85       86       +1     
  Lines        6048     6134      +86     
  Branches      771      780       +9     
==========================================
+ Hits         4924     5009      +85     
  Misses        892      892              
- Partials      232      233       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@elfkuzco
elfkuzco force-pushed the public-endpoints-cors-policy branch from 86b125c to 16b3c56 Compare November 3, 2026 08:08
Base automatically changed from roles-documentation to main November 3, 2026 08:33
@elfkuzco
elfkuzco force-pushed the public-endpoints-cors-policy branch from 16b3c56 to 9cac740 Compare November 3, 2026 08:33

@benoit74 benoit74 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.

One minor point, I let you decide and then you can merge on your own.

Comment thread INTEGRATORS_GUIDE.md Resolved
@elfkuzco
elfkuzco force-pushed the public-endpoints-cors-policy branch from 9cac740 to 53c3cd7 Compare November 4, 2026 00:12
@elfkuzco
elfkuzco merged commit 87eacc5 into main Nov 4, 2026
5 checks passed
@elfkuzco
elfkuzco deleted the public-endpoints-cors-policy branch November 4, 2026 00:41
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.

Public read-only endpoints should not block cross-origin calls

2 participants