-
Notifications
You must be signed in to change notification settings - Fork 531
Closed
Closed
Copy link
Labels
Type: Buga defecta defect
Milestone
Description
What steps does it take to reproduce the issue?
- Set JVM
dataverse.cors.originto multiple origins (comma/space separated), e.g.https://libis.github.io, https://gdcc.github.io. - From a browser (or curl with an
Originheader), call any Dataverse API endpoint (preflightOPTIONSand the actual request) withOriginset to one of the allowed sites. - Observe response headers and browser console/network.
When does this issue occur?
- On cross-origin API calls when
dataverse.cors.origincontains multiple origins. - Also surfaces when CORS-related config values include surrounding quotes.
- Wildcard
*combined with credentialed requests (cookies/Authorization) is rejected by browsers.
Which page(s) does it occurs on?
- Any API endpoint accessed cross-origin, e.g.
/api/files/*,/api/access/*,/api/externalTools.
What happens?
Access-Control-Allow-Originis sent as a literal comma-separated list (e.g.,https://a.example, https://b.example) which browsers reject ("header contains multiple values").- CORS header values sometimes include quotes (e.g.,
"Accept, Content-Type,…"), causing preflight failures. Vary: Originis not set when echoing an origin, allowing caches to serve the wrong ACAO across different origins.
To whom does it occur (all users, curators, superusers)?
- Any browser-based clients calling the API from allowed third‑party origins (e.g., previewers/marketplace).
What did you expect to happen?
- Server echoes the single request
Originonly when it matches the allowed list. Vary: Originis present when echoing a specific origin.- Configured CSV values are sanitized (no quotes, normalized lists).
- Wildcard
*is used only when explicitly configured and with awareness that credentialed requests will fail per browser rules.
Which version of Dataverse are you using?
- 6.7.1 (Payara 6)
Any related open or closed issues to this bug report?
- Feature Request: #11365 (Allow
/api/externalToolsto be CORS enabled) — related CORS context but different scope (endpoint access vs. header correctness).
Screenshots:
- Browser console typically shows: “has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header contains multiple values”.
- Network tab shows ACAO with the comma-separated list or quoted values.
Are you thinking about creating a pull request for this issue?
- Yes. Plan:
- Echo the single request
Originwhen present indataverse.cors.origin(supports multiple origins). - Add
Vary: Originwhen echoing. - Sanitize methods/allow/expose header lists (strip quotes, normalize).
- Remove reliance on deprecated
:AllowCorsDB fallback. - Add unit tests for wildcard, multi-origin echo, disallowed origin, and sanitization.
- Echo the single request
vera
Metadata
Metadata
Assignees
Labels
Type: Buga defecta defect