Repository navigation
cors: expose WWW-Authenticate, Last-Modified, Accept-Query to cross-origin clients - #629
Conversation
…s-origin clients A browser client on another origin could not read the 401 challenge (as_uri / resource_metadata for LWS, the Solid-OIDC challenge alike): WWW-Authenticate is not CORS-safelisted and was missing from Access-Control-Expose-Headers. Seen from linkedwebstorage.com/todo/ talking to a local lwsd. Last-Modified (date validators) and Accept-Query (lws10-index) added for the same reason; the cors-proxy already exposed WWW-Authenticate.
There was a problem hiding this comment.
🟢 Approval recommended
It is a single-line, correctly formatted additive change whose exposed headers are either already emitted by the server or harmless when absent, matching the established cors-proxy list.
0 open findings
What changed in this PR
This PR widens the default CORS Access-Control-Expose-Headers list in src/ldp/headers.js so that cross-origin browser clients can read response headers that are otherwise not CORS-safelisted. The key motivation is WWW-Authenticate: without exposing it, a cross-origin Solid-OIDC client cannot read the 401 challenge and discover the authorization server. It also adds Last-Modified (date validators) and Accept-Query (for upcoming LWS index work), bringing the pod-wide list in line with the existing cors-proxy list.
Changes:
- Add
WWW-Authenticateto the exposed headers so cross-origin clients can read the 401 auth challenge. - Add
Last-ModifiedandAccept-Queryto the exposed headers, inserted to preserve the existing alphabetical ordering.
| File | Description |
|---|---|
| src/ldp/headers.js | Extends getCorsHeaders Access-Control-Expose-Headers with WWW-Authenticate, Last-Modified, and Accept-Query. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Since 0.0.220: - --git defers to plugin-owned prefixes (#616, #630): core's git preHandler returns early for a URL below an app path, so a plugin serving git smart-HTTP under its mount (the forge at /forge/<owner>/<name>.git) is no longer shadowed by core's 401. Pod git outside plugin prefixes is unchanged. - CORS exposes WWW-Authenticate, Last-Modified and Accept-Query to cross-origin clients (#629). - @fastify/websocket registered once at the root (#545, #620). - Hardening: atomic quota reservation and idempotent deposit credit (#619).
A browser client on another origin cannot read a 401's
WWW-Authenticateunless it is listed inAccess-Control-Expose-Headers— it is not CORS-safelisted. The default list insrc/ldp/headers.jslacked it (the cors-proxy's list has it), so cross-origin discovery of the authorization server stops at the 401. Found with https://linkedwebstorage.com/todo/ against a local lwsd; the same applies to any cross-origin Solid-OIDC client reading the challenge.Adds
WWW-Authenticate, plusLast-Modified(date validators) andAccept-Query(lws10-index). One line in the header string; no behaviour change otherwise.Related: #621, #625.