Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/shared/http/plugins/security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ export default fp(async function securityPlugin(app: FastifyInstance) {
objectSrc: ["'none'"],
},
},
// Helmet's default is `same-origin`, which is enforced by browsers
// independently of CORS: it blocks allow-listed cross-origin clients
// from loading this API's responses at all via a no-CORS-mode request
// (e.g. displaying an uploaded evidence image with `<img src=...>`).
// Since CORS_ORIGIN already allow-lists the cooperating client origins,
// relax CORP to let those resources load — `same-origin` would silently
// break them regardless of the CORS configuration.
crossOriginResourcePolicy: { policy: 'cross-origin' },
});

await app.register(cors, {
Expand Down
Loading