sveltejs / sveltejs/kit

Allow csp configuration to dynamically read env variables

Open
#10,969 2 comments 4 reactions 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

I have an "adapter-node" app deployed somewhere, I have different environments (dev, qa, prod) and i would like to provide different values to the csp configuration based on the env variables set in each environment at runtime.

Describe the proposed solution

Maybe sveltekit may support "app.html" like syntax to read the env variables at runtime:

csp: {
	directives: {
		'frame-src': ['self', '%sveltekit.env.APP_PUBLIC_TRUSTED_DOMAIN%']
	}
}
Alternatives considered

No response

Importance

would make my life easier

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 tracing adapter-node's CSP configuration and the app.html environment-variable handling. Determine how runtime values should be supplied for each deployment environment, and define tests showing that CSP directives receive those values without requiring a rebuild.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
security, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.