mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 15:31:38 +02:00
The NIP-05 directory (/.well-known/nostr.json) is public, read-only, unauth'd data that MUST be cross-origin fetchable — any Nostr client on any domain resolves `user@this-instance` by fetching it. It was covered by the single global CORS layer, so it only got `Access-Control-Allow-Origin: *` when CORS_ALLOWED_ORIGINS was empty (the default). An operator who restricts CORS to their own frontend would silently break NIP-05 resolution for every other domain/wallet — federation dies for that instance with no error. Split CORS into two route groups: the public surface (well-known + health + landing) always serves `*`; the /api/v1 surface keeps the operator's configurable policy. The API's CORS behavior is unchanged (it still gets the same `cors` layer); only the public directory is now unconditionally cross-origin. cargo check clean.