sveltejs / sveltejs/kit

Add csp to all responses

Open
#10,023 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

It seems that now CSP headers are added only to html responses.
However, probably some CSP should also be added to other responses.

https://stackoverflow.com/questions/68886438/why-should-we-include-csp-headers-in-the-http-response-for-an-api
https://cheatsheetseries.owasp.org/cheatsheets/REST_Security_Cheat_Sheet.html#security-headers

Describe the proposed solution

Kit can add frame-ancestors "none" on its own if CSP is enabled.
Or you can write about it in the documentation so that the user can add it himself.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing CSP handling for HTML responses and the response path used by other response types. Determine whether the intended outcome is automatic frame-ancestors "none" headers or documentation for users to configure them, then verify that the chosen behavior applies consistently to non-HTML responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.