Skip to content

Commit 9e3bab1

Browse files
Merge pull request #2272 from HHS/mb/TTAHUB-3040/owasp
[TTAHUB-3040] Resolve OWASP warnings
2 parents 1b6af17 + fc549ce commit 9e3bab1

File tree

8 files changed

+51
-5
lines changed

8 files changed

+51
-5
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ parameters:
406406
default: "al-ttahub-2939-add-fei-root-cause-to-goal-card"
407407
type: string
408408
sandbox_git_branch: # change to feature branch to test deployment
409-
default: "jp/3112/rm-elasticsearch"
409+
default: "mb/TTAHUB-3040/owasp"
410410
type: string
411411
prod_new_relic_app_id:
412412
default: "877570491"

frontend/public/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<head>
44
<meta charset="utf-8" />
55
<link rel="icon" href="%PUBLIC_URL%/logo64.png" />
6-
<link rel="preconnect" href="https://fonts.gstatic.com">
7-
<link href="https://fonts.googleapis.com/css2?family=Merriweather&display=swap" rel="stylesheet">
86
<meta name="viewport" content="width=device-width, initial-scale=1" />
97
<meta name="theme-color" content="#000000" />
108
<meta

frontend/src/App.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,34 @@
99
font-weight: bold;
1010
}
1111

12+
@font-face {
13+
font-family: 'Merriweather';
14+
src: url('./assets/Merriweather-Regular.ttf') format('truetype');
15+
font-weight: normal;
16+
}
17+
18+
@font-face {
19+
font-family: 'Merriweather';
20+
src: url('./assets/Merriweather-Bold.ttf') format('truetype');
21+
font-weight: bold;
22+
}
23+
24+
@font-face {
25+
font-family: 'Merriweather';
26+
src: url('./assets/Merriweather-Italic.ttf') format('truetype');
27+
font-style: italic;
28+
font-weight: normal;
29+
}
30+
31+
@font-face {
32+
font-family: 'Merriweather';
33+
src: url('./assets/Merriweather-BoldItalic.ttf') format('truetype');
34+
font-style: italic;
35+
font-weight: bold;
36+
}
37+
38+
39+
1240
a {
1341
color: $text-link;
1442
}
139 KB
Binary file not shown.
140 KB
Binary file not shown.
139 KB
Binary file not shown.
146 KB
Binary file not shown.

src/app.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ process.on('unhandledRejection', (reason, promise) => {
4242
});
4343

4444
const app = express();
45+
4546
const oauth2CallbackPath = '/oauth2-client/login/oauth2/code/';
4647
let index;
4748

@@ -60,10 +61,27 @@ app.use(express.json({ limit: '2MB' }));
6061
app.use(express.urlencoded({ extended: true }));
6162

6263
app.use((req, res, next) => {
64+
// set the X-Content-Type-Options header to prevent MIME-sniffing
65+
res.set('X-Content-Type-Options', 'nosniff');
66+
67+
// set nonce
6368
res.locals.nonce = crypto.randomBytes(16).toString('hex');
69+
70+
// set CSP
6471
const cspMiddleware = helmet.contentSecurityPolicy({
6572
directives: {
66-
...omit(helmet.contentSecurityPolicy.getDefaultDirectives(), 'upgrade-insecure-requests', 'block-all-mixed-content', 'script-src', 'img-src', 'default-src'),
73+
...omit(
74+
helmet.contentSecurityPolicy.getDefaultDirectives(),
75+
'upgrade-insecure-requests',
76+
'block-all-mixed-content',
77+
'script-src',
78+
'img-src',
79+
'default-src',
80+
'style-src',
81+
'font-src',
82+
),
83+
styleSrc: ["'self'", "'unsafe-inline'"],
84+
fontSrc: ["'self'"],
6785
'form-action': ["'self'"],
6886
scriptSrc: ["'self'", '*.googletagmanager.com'],
6987
scriptSrcElem: ["'self'", 'https://*.googletagmanager.com', `'nonce-${res.locals.nonce}'`],
@@ -81,9 +99,11 @@ if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'dss') {
8199
}
82100

83101
app.use('/api/v1', require('./routes/externalApi').default);
84-
85102
app.use('/api', require('./routes/apiDirectory').default);
86103

104+
// Disable "X-Powered-By" header
105+
app.disable('x-powered-by');
106+
87107
// TODO: change `app.get...` with `router.get...` once our oauth callback has been updated
88108
app.get(oauth2CallbackPath, cookieSession, async (req, res) => {
89109
try {

0 commit comments

Comments
 (0)