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

[VULN-598] [2WI-027] Weakened CSP #1007

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.local.test
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ NODE_ENV=test
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
VUE_APP_CSP=https://staging.lps.tekscapital.com
1 change: 1 addition & 0 deletions .github/workflows/deploy_MainNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
VUE_APP_CSP=https://lps.tekscapital.com
npm run-script build

- name: Configure AWS credentials
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_TestNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
VUE_APP_CSP=https://staging.lps.tekscapital.com
npm run-script build

- name: Configure AWS credentials
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_staging_MainNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
VUE_APP_CSP=https://lps.tekscapital.com
npm run-script build

- name: Configure AWS credentials
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_staging_TestNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=20
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
VUE_APP_CSP=https://staging.lps.tekscapital.com
npm run-script build

- name: Configure AWS credentials
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
script-src 'self' 'nonce-${vuetifyNonce}' 'unsafe-eval';
script-src-elem 'self' 'unsafe-inline' https://script.hotjar.com https://www.clarity.ms/s/* https://static.hotjar.com https://*.hotjar.com https://*.hotjar.io https://api.coingecko.com/ https://*.clarity.ms https://www.clarity.ms/ https://www.gstatic.com/ https://www.google.com/recaptcha/;
img-src data: https:;
connect-src 'self' 'unsafe-inline' https://www.clarity.ms/s/0.7.16/clarity.js wss://* https://*.hotjar.com https://*.hotjar.io https://www.clarity.ms/s/* wss://*.hotjar.com ${envVariables.vueAppApiBaseUrl} ${envVariables.vueAppRskNodeHost} https://lps.tekscapital.com https://testnet.lps.tekscapital.com https://staging.lps.tekscapital.com https://api.coingecko.com/* https://*.clarity.ms https://www.clarity.ms/* ;
connect-src 'self' 'unsafe-inline' https://www.clarity.ms/s/0.7.16/clarity.js wss://* https://*.hotjar.com https://*.hotjar.io https://www.clarity.ms/s/* wss://*.hotjar.com ${envVariables.vueAppApiBaseUrl} ${envVariables.vueAppRskNodeHost} ${envVariables.cspConfiguration} https://api.coingecko.com/ https://*.clarity.ms https://www.clarity.ms/* ;
object-src 'none';
frame-src https://connect.trezor.io https://www.google.com/;
worker-src 'none';
Expand Down
27 changes: 15 additions & 12 deletions src/common/types/environment-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ export class EnvironmentVariables {

public debugMode: boolean;

public minFeeSatPerByte: {
fast: number;
average: number;
slow: number;
};

public miningSpeedBlock: {
fast: number;
average: number;
slow: number;
};

public burnDustValue: number;

public lbcAddress: string;
Expand All @@ -54,6 +42,20 @@ export class EnvironmentVariables {

public flyoverProviderId: number;

public cspConfiguration: string;

public minFeeSatPerByte: {
fast: number;
average: number;
slow: number;
};

public miningSpeedBlock: {
fast: number;
average: number;
slow: number;
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(defaultValues: any = {}) {
this.vueAppCoin = process.env.VUE_APP_COIN || defaultValues.vueAppCoin;
Expand Down Expand Up @@ -104,6 +106,7 @@ export class EnvironmentVariables {
|| defaultValues.grecaptchaTime;
this.flyoverProviderId = Number(process.env.VUE_APP_FLYOVER_PROVIDER_ID)
|| defaultValues.flyoverProviderId;
this.cspConfiguration = process.env.VUE_APP_CSP || defaultValues.cspConfiguration;
}

public get chainId(): number {
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const defaultEnvironmentVariables = {
flyoverPegoutDiffPercentage: 2,
flyoverProviderId: 2,
grecaptchaTime: constants.RECAPTCHA_NEW_TOKEN_TIME,
cspConfiguration: 'https://testnet.lps.tekscapital.com https://staging.lps.tekscapital.com',
alexjavabraz marked this conversation as resolved.
Show resolved Hide resolved
};

EnvironmentAccessorService.initializeEnvironmentVariables(defaultEnvironmentVariables);
Expand Down
Loading