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

Add nonce-based csp to style #305

Open
wants to merge 1 commit into
base: rc
Choose a base branch
from
Open

Conversation

erayaydin
Copy link

Implemented generateRandom string utility function to create random strings. Updated handleStatus to accept a styleNonce parameter and added CSP headers to include style-src nonce. This decision has been made because of easy testing. Modified renderHtml in handleStatus to include the nonce attribute in the <style> tag. Fixed snapshot tests to accept the new styleNonce property.

Implemented `generateRandom` string utility function to create random
strings. Updated `handleStatus` to accept a `styleNonce` parameter
and added CSP headers to include `style-src` nonce. This decision
has been made because of easy testing. Modified `renderHtml` in
`handleStatus` to include the `nonce` attribute in the `<style>`
tag. Fixed snapshot tests to accept new `styleNonce` property.

Related-Task: INTER-426
@erayaydin erayaydin added the enhancement New feature or request label Jan 19, 2025
@erayaydin erayaydin self-assigned this Jan 19, 2025
Copy link
Contributor

This PR will create a minor release 🚀

2.1.0 (2025-01-19)

Features

  • add nonce-based csp to style (e2b5f6c)

Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
92.58% (-0.79% 🔻)
649/701
🟢 Branches 86.78% 151/174
🟢 Functions
91.79% (-0.69% 🔻)
123/134
🟢 Lines
92.76% (-0.84% 🔻)
615/663
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🔴
... / string.ts
14.29% 100% 0% 14.29%

Test suite run success

170 tests passing in 18 suites.

Report generated by 🧪jest coverage report action from e2b5f6c

Show full coverage report
St File % Stmts % Branch % Funcs % Lines Uncovered Line #s
🟢 All files 92.58 86.78 91.79 92.76
🟢  mgmt-lambda 98.93 93.33 100 98.93
🟢   DefaultSettings.ts 100 100 100 100
🟢   app.ts 97.91 95 100 97.91 26
🟢   auth.ts 100 100 100 100
🟢   exceptions.ts 100 66.66 100 100 20
🟢   routing.ts 100 100 100 100
🟢  mgmt-lambda/handlers 87.22 72.5 93.33 87.15
🟢   errorHandlers.ts 100 71.42 100 100 22,41
🟡   statusHandler.ts 80 50 100 80 76-80,84-89
🟢   updateHandler.ts 87.21 75.86 87.5 87.12 50-51,67-68,139-142,214,219-228,290-291,319
🟢  mgmt-lambda/utils 81.25 88.88 66.66 100
🟢   cloudfrontUtils.ts 100 88.88 100 100 6
🔴   delay.ts 40 100 0 100
🟢  proxy/handlers 87.91 86.95 90.32 88.63
🟢   handleAgentDowloading.ts 96.29 66.66 100 96.15 31
🟡   handleResult.ts 76.74 100 76.92 78.04 90-105
🟢   handleStatus.ts 100 100 100 100
🟡  proxy/test 77.77 100 50 71.42
🟡   aws.ts 77.77 100 50 71.42 4-5
🟢  proxy/test/utils/customer-variables 100 100 100 100
🟢   in-memory-customer-variables.ts 100 100 100 100
🟢  proxy/utils 94.57 85.71 94.28 94.11
🟢   buffer.ts 100 100 100 100
🟢   cache-control.ts 100 100 100 100
🟢   cookie.ts 100 100 100 100
🟢   headers.ts 100 100 100 100
🔴   is-blob.ts 0 0 0 0 6-7
🟢   log.ts 85.71 33.33 100 83.33 11
🟢   request.ts 100 100 100 100
🟢   routing.ts 100 100 100 100
🔴   string.ts 14.28 100 0 14.28 2-8
🟢   traffic.ts 100 100 100 100
🟢  proxy/utils/customer-variables 100 100 100 100
🟢   customer-variables.ts 100 100 100 100
🟢   defaults.ts 100 100 100 100
🟢   header-customer-variables.ts 100 100 100 100
🟢   maybe-obfuscate-variable.ts 100 100 100 100
🟢   selectors.ts 100 100 100 100
🟢   types.ts 100 100 100 100
🟢  proxy/utils/customer-variables/secrets-manager 95.58 100 100 95.52
🟢   normalize-secret.ts 100 100 100 100
🟢   retrieve-secret.ts 100 100 100 100
🟢   secrets-manager-variables.ts 86.95 100 100 86.95 28,50-55
🟢   validate-secret.ts 100 100 100 100

Copy link
Contributor

@JuroUhlar JuroUhlar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but let the more experienced folks take a look before merging

@erayaydin erayaydin marked this pull request as ready for review January 20, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants