Skip to content

Commit 85ce110

Browse files
committed
fix: add csp
1 parent 466804d commit 85ce110

1 file changed

Lines changed: 77 additions & 66 deletions

File tree

config/environment.js

Lines changed: 77 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,90 @@
11
'use strict';
22

3-
module.exports = function(environment) {
4-
//<<<<<<< HEAD
5-
const rootURLParamIndex = process.argv.indexOf('--root-url');
6-
const rootURL = rootURLParamIndex >= 0 ? process.argv[rootURLParamIndex + 1] : '/';
7-
//=======
8-
// let ENV = {
9-
// modulePrefix: 'sysdig-inspect',
10-
// environment,
11-
// rootURL: '/',
12-
// locationType: 'auto',
13-
// EmberENV: {
14-
// FEATURES: {
15-
// // Here you can enable experimental features on an ember canary build
16-
// // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
17-
// },
18-
// EXTEND_PROTOTYPES: {
19-
// // Prevent Ember Data from overriding Date.parse.
20-
// Date: false
21-
// }
22-
// },
23-
//>>>>>>> bd341dc (v3.4.4...v3.12.1)
3+
module.exports = function (environment) {
4+
//<<<<<<< HEAD
5+
const rootURLParamIndex = process.argv.indexOf('--root-url');
6+
const rootURL =
7+
rootURLParamIndex >= 0 ? process.argv[rootURLParamIndex + 1] : '/';
8+
//=======
9+
// let ENV = {
10+
// modulePrefix: 'sysdig-inspect',
11+
// environment,
12+
// rootURL: '/',
13+
// locationType: 'auto',
14+
// EmberENV: {
15+
// FEATURES: {
16+
// // Here you can enable experimental features on an ember canary build
17+
// // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
18+
// },
19+
// EXTEND_PROTOTYPES: {
20+
// // Prevent Ember Data from overriding Date.parse.
21+
// Date: false
22+
// }
23+
// },
24+
//>>>>>>> bd341dc (v3.4.4...v3.12.1)
2425

25-
const targetEnvParamIndex = process.argv.indexOf('--target-env');
26-
const targetEnv = targetEnvParamIndex >= 0 ? process.argv[targetEnvParamIndex + 1] : 'electron';
26+
const targetEnvParamIndex = process.argv.indexOf('--target-env');
27+
const targetEnv =
28+
targetEnvParamIndex >= 0
29+
? process.argv[targetEnvParamIndex + 1]
30+
: 'electron';
2731

28-
const userTrackingKeyIndex = process.argv.indexOf('--user-tracking-key');
29-
const userTrackingKey = userTrackingKeyIndex >= 0 ? process.argv[userTrackingKeyIndex + 1] : null;
32+
const userTrackingKeyIndex = process.argv.indexOf('--user-tracking-key');
33+
const userTrackingKey =
34+
userTrackingKeyIndex >= 0 ? process.argv[userTrackingKeyIndex + 1] : null;
3035

31-
let ENV = {
32-
targetEnv,
33-
modulePrefix: 'sysdig-inspect',
34-
environment,
35-
rootURL: rootURL,
36-
locationType: 'hash',
37-
EmberENV: {
38-
FEATURES: {
39-
// Here you can enable experimental features on an ember canary build
40-
// e.g. 'with-controller': true
41-
},
42-
EXTEND_PROTOTYPES: {
43-
// Prevent Ember Data from overriding Date.parse.
44-
Date: false
45-
}
46-
},
36+
let ENV = {
37+
targetEnv,
38+
modulePrefix: 'sysdig-inspect',
39+
environment,
40+
rootURL: rootURL,
41+
locationType: 'hash',
42+
EmberENV: {
43+
FEATURES: {
44+
// Here you can enable experimental features on an ember canary build
45+
// e.g. 'with-controller': true
46+
},
47+
EXTEND_PROTOTYPES: {
48+
// Prevent Ember Data from overriding Date.parse.
49+
Date: false,
50+
},
51+
},
4752

48-
APP: {
49-
// Here you can pass flags/options to your application instance
50-
// when it is created
51-
USER_TRACKING_KEY: userTrackingKey,
52-
}
53-
};
53+
APP: {
54+
// Here you can pass flags/options to your application instance
55+
// when it is created
56+
USER_TRACKING_KEY: userTrackingKey,
57+
},
58+
contentSecurityPolicy: {
59+
'default-src': "'self'",
60+
'script-src': "'self' 'unsafe-inline' 'unsafe-eval'",
61+
'style-src': "'self' 'unsafe-inline'",
62+
'img-src': "'self' data:",
63+
'font-src': "'self' data:",
64+
},
65+
};
5466

55-
if (environment === 'development') {
56-
// ENV.APP.LOG_RESOLVER = true;
57-
// ENV.APP.LOG_ACTIVE_GENERATION = true;
58-
// ENV.APP.LOG_TRANSITIONS = true;
59-
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
60-
// ENV.APP.LOG_VIEW_LOOKUPS = true;
61-
}
67+
if (environment === 'development') {
68+
// ENV.APP.LOG_RESOLVER = true;
69+
// ENV.APP.LOG_ACTIVE_GENERATION = true;
70+
// ENV.APP.LOG_TRANSITIONS = true;
71+
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
72+
// ENV.APP.LOG_VIEW_LOOKUPS = true;
73+
}
6274

63-
if (environment === 'test') {
64-
// Testem prefers this...
65-
ENV.locationType = 'none';
75+
if (environment === 'test') {
76+
// Testem prefers this...
77+
ENV.locationType = 'none';
6678

67-
// keep test console output quieter
68-
ENV.APP.LOG_ACTIVE_GENERATION = false;
69-
ENV.APP.LOG_VIEW_LOOKUPS = false;
79+
// keep test console output quieter
80+
ENV.APP.LOG_ACTIVE_GENERATION = false;
81+
ENV.APP.LOG_VIEW_LOOKUPS = false;
7082

71-
ENV.APP.rootElement = '#ember-testing';
72-
}
83+
ENV.APP.rootElement = '#ember-testing';
84+
}
7385

74-
if (environment === 'production') {
86+
if (environment === 'production') {
87+
}
7588

76-
}
77-
78-
return ENV;
89+
return ENV;
7990
};

0 commit comments

Comments
 (0)