Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CSP and enhance nonce generation #934

Merged
merged 16 commits into from
Jan 13, 2025
Merged

Conversation

ensc
Copy link
Contributor

@ensc ensc commented Jan 6, 2025

  • adds nonce="{{__TRUNK NONCE__}}" placeholders to most/all generated links
  • replaces {{__TRUNK NONCE__}} with a random nonce when serving a request
  • adds Content-Security-Policy header with this random nonce
  • adds configuration options to:
    • disable nonce generation
    • use a custom CSP
    • change used placeholder

ensc added 10 commits January 6, 2025 11:47
Will be used later to conditionally add 'nonce="PLACEHOLDER"' attributes
to various html elements.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
…alue

Do not fill the random when creating the template but use a
placeholder which is expanded by the server.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Do not fill the random when creating the template but use a
placeholder which is expanded by the server.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
… value

Do not fill the random when creating the template but use a
placeholder which is expanded by the server.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Do not fill the random when creating the template but use a
placeholder which is expanded by the server.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
ensc added 6 commits January 11, 2025 13:07
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
other changes which are dealing with CSP and nonce will need access to
configuration items

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
@ctron ctron added this pull request to the merge queue Jan 13, 2025
Merged via the queue into trunk-rs:main with commit 4fd01b4 Jan 13, 2025
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants