Skip to content

ENG3-217 - Restrict REST CORS to an explicit Central portal allowlist - #5

Open
timelsass wants to merge 1 commit into
masterfrom
ENG3-217
Open

ENG3-217 - Restrict REST CORS to an explicit Central portal allowlist#5
timelsass wants to merge 1 commit into
masterfrom
ENG3-217

Conversation

@timelsass

Copy link
Copy Markdown
Member

Fixes ENG3-217. JIRA: https://imh-internal.atlassian.net/browse/ENG3-217

Central Connect no longer sends Access-Control-Allow-Origin: * on REST or HEAD discovery. In-scope bgc/v1 and REST index responses emit CORS only for an exact HTTPS Central portal allowlist (config/branding URLs, https://v2.central.inmotionhosting.com, and the central_connect_allowed_cors_origins filter). Arbitrary, null, http, and IP-literal Origins get no ACAO. Access-Control-Allow-Credentials is never sent.

WordPress core CORS is left in place for other namespaces; in-scope routes scrub those headers at PHP_INT_MAX before applying this policy.

Test plan

  • php tests/run.php from the repo root (28 cases)
  • From an allowlisted Central portal origin, confirm bgc/v1 still returns ACAO for that origin and no credentials
  • From a non-portal origin, confirm no ACAO / no credentials on bgc/v1

Replace Access-Control-Allow-Origin: * with HTTPS origin matching so
bgc/v1 no longer reflects arbitrary or null Origins or send credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant