You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose adding a feature to SvelteKit that allows users to easily implement Content Security Policies (CSP) directly within the SvelteKit configuration file (svelte.config.js). Currently, setting up a CSP requires manual configuration or external scripts. However, integrating CSP options into SvelteKit's configuration can simplify the process, making web applications more secure by default.
Suggested Implementation:
// In svelte.config.jsconstconfig={kit: {// Existing configurations...csp: {mode: 'hash',// options: 'auto', 'hash', 'nonce'directives: {'default-src': ['self'],'script-src': ['self','https://trusted-source.com'],// Other directives...}}}};
This feature would allow developers to define CSP directives that align with their application's needs. The mode property can offer flexibility in how CSPs are handled (e.g., using 'hash' for inline scripts/styles).
Example Implementation: I found a GitHub repository that implements CSP directives for SvelteKit, which could serve as a reference for this feature: sveltekit-content-security-policy.
The text was updated successfully, but these errors were encountered:
maehr
changed the title
Feature Request: Implement CSP Policy Options in SvelteKit Configuration
20240130: Feature Request: Implement CSP Policy Options in SvelteKit Configuration
Jan 31, 2024
maehr
changed the title
20240130: Feature Request: Implement CSP Policy Options in SvelteKit Configuration
20240130 Feature Request: Implement CSP Policy Options in SvelteKit Configuration
Feb 6, 2024
Description
I propose adding a feature to SvelteKit that allows users to easily implement Content Security Policies (CSP) directly within the SvelteKit configuration file (
svelte.config.js
). Currently, setting up a CSP requires manual configuration or external scripts. However, integrating CSP options into SvelteKit's configuration can simplify the process, making web applications more secure by default.Suggested Implementation:
This feature would allow developers to define CSP directives that align with their application's needs. The
mode
property can offer flexibility in how CSPs are handled (e.g., using 'hash' for inline scripts/styles).Category
References
The text was updated successfully, but these errors were encountered: