Public CORS decorator (PP-5045) - #3680
Conversation
|
Claude finished @tdilauro's task in 5m 43s —— View job Code Review
SummaryThe approach is sound and the rationale is documented unusually well — the wildcard-origin-plus-no-credentials reasoning is correct, and I confirmed Palace has no IP/ambient-credential patron authentication that would undermine it ( DetailsMinor:
|
Greptile SummaryAdds a reusable permissive CORS decorator for future public read-only routes, without applying it to any existing endpoint.
Confidence Score: 4/5The PR appears safe to merge, with only a non-blocking test-organization issue. The new decorator is not yet attached to production routes, its intended CORS behavior is covered by tests, and the only accepted concern is the repository-inconsistent test class organization. Files Needing Attention: tests/manager/api/test_routes.py
|
| Filename | Overview |
|---|---|
| src/palace/manager/api/routes.py | Adds the currently unused public CORS decorator and documents its authentication, stacking, and HTTP-method constraints. |
| tests/manager/api/test_routes.py | Covers the decorator's headers and wrapper composition, but places the tests in a behavior-specific class contrary to the repository convention. |
Reviews (1): Last reviewed commit: "Local AI code review feedback" | Re-trigger Greptile
| assert False == routes.app.url_map.merge_slashes | ||
|
|
||
|
|
||
| class TestAllowsPublicCors: |
There was a problem hiding this comment.
TestAllowsPublicCors organizes these tests around one behavior rather than the module under test, contrary to the repository's module-oriented test-class convention and making related route tests less consistent to locate.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3680 +/- ##
=======================================
Coverage 93.55% 93.55%
=======================================
Files 513 513
Lines 46907 46909 +2
Branches 6405 6405
=======================================
+ Hits 43884 43887 +3
+ Misses 1954 1953 -1
Partials 1069 1069 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Adds an
allows_public_corsroute decorator that sends open CORS headers and handles preflight requests. The decorator comment documents that it must not be stacked withallows_patron_weband must only go on GET/HEAD routes.Access-Control-Allow-Origin: *,GET,HEAD, andOPTIONSmethods.No routes use it yet.
Motivation and Context
Public catalog data is readable by anyone without credentials, so an origin allowlist adds no protection there. What it does do is break browser-based catalog clients (like CPW) when their hosts are not configured, which creates friction for dev instances and new deployments. This decorator is the first step. A follow-up PR will apply it to the public routes.
[Jira PP-5045]
How Has This Been Tested?
Checklist