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

[Prod] Revert worker transactions, fix slow program query, address medium OWASP warnings #2281

Merged
merged 37 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
68bf924
Initial OWASP tinkering
thewatermethod Jul 12, 2024
ce95447
remove one off for programs
AdamAdHocTeam Jul 12, 2024
5e534b7
Tested Matts idea we can simply remove this function
AdamAdHocTeam Jul 12, 2024
8f78a63
Fix duplicative CSP keys
thewatermethod Jul 15, 2024
a2a5d37
Self host Merriweather
thewatermethod Jul 15, 2024
7bdb975
Renove extraneous Merriweathers
thewatermethod Jul 15, 2024
1509f1d
Revise style-src
thewatermethod Jul 15, 2024
eca68fd
Update record.ts
GarrettEHill Jul 15, 2024
5a90451
test fixes
GarrettEHill Jul 15, 2024
60a3ae6
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3040/owasp
thewatermethod Jul 16, 2024
8c8ce2e
deploy to sandbox
thewatermethod Jul 16, 2024
0e203ea
rollback style-src CSP changes
thewatermethod Jul 16, 2024
cd10e47
Switch to minimal plotly build
thewatermethod Jul 16, 2024
5b201a5
Reimplement strict style-src policy
thewatermethod Jul 16, 2024
0c0cfe5
Revert "Switch to minimal plotly build"
thewatermethod Jul 16, 2024
0e421db
Revert "Revert "Switch to minimal plotly build""
thewatermethod Jul 16, 2024
cc143e7
What does OWASP have to say about this?
thewatermethod Jul 16, 2024
62b8a4d
Use strict dynamic
thewatermethod Jul 16, 2024
7cd5d4d
Use "unsafe-inline"
thewatermethod Jul 16, 2024
478bd4e
Revert "Revert "Revert "Switch to minimal plotly build"""
thewatermethod Jul 16, 2024
105dd49
Move postCSS to peer deps and dev deps
thewatermethod Jul 16, 2024
5b08469
Rename unwanted renaming
thewatermethod Jul 17, 2024
fc549ce
Might as well set the X-CONTENT-TYPE while we are here
thewatermethod Jul 17, 2024
0f6294f
fix the error identified by Matt during review
GarrettEHill Jul 17, 2024
a92d949
lint
GarrettEHill Jul 17, 2024
499b8c3
Update record.test.js
GarrettEHill Jul 17, 2024
3808c2e
Update transactionWrapper.ts
GarrettEHill Jul 17, 2024
184165d
Merge pull request #2271 from HHS/TTAHUB-3125/refactor-lock
GarrettEHill Jul 18, 2024
957c663
Merge pull request #2268 from HHS/al-ttahub-3083-optimize-program-query
AdamAdHocTeam Jul 18, 2024
1b6af17
Merge pull request #2275 from HHS/suppress-postcss-warnings
thewatermethod Jul 18, 2024
9e3bab1
Merge pull request #2272 from HHS/mb/TTAHUB-3040/owasp
thewatermethod Jul 18, 2024
1dcba2e
keep sql and drop test files
GarrettEHill Jul 18, 2024
5aeb2f7
Update config.yml
GarrettEHill Jul 18, 2024
a3ff0df
Merge pull request #2278 from HHS/gh/cfignore-keep-sql-drop-tests
GarrettEHill Jul 18, 2024
f749515
Revert "Merge pull request #2233 from HHS/TTAHUB-3097/worker-transact…
thewatermethod Jul 19, 2024
6b53dbe
Merge remote-tracking branch origin/main into mb/revert-transactions-…
thewatermethod Jul 19, 2024
6f79381
Merge pull request #2280 from HHS/mb/revert-transactions-for-workers
thewatermethod Jul 19, 2024
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
2 changes: 2 additions & 0 deletions .cfignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ hses.zip
temp/
tests/
.tmp/
*.test.js
!*.sql
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ parameters:
default: "al-ttahub-2939-add-fei-root-cause-to-goal-card"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "jp/3112/rm-elasticsearch"
default: "gh/cfignore-keep-sql-drop-tests"
type: string
prod_new_relic_app_id:
default: "877570491"
Expand Down
2 changes: 1 addition & 1 deletion email_templates/changes_requested_by_manager/html.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ style
include ../email.css
p Hello,
p
p #{managerName} requested changes to report #{displayId}.
p #{managerName} requested changed to report #{displayId}.
if comments
p #{managerName} provided the following comments:
blockquote !{comments}
Expand Down
4 changes: 4 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,13 @@
"jest-fetch-mock": "^3.0.3",
"jest-junit": "^13.0.0",
"mutationobserver-shim": "^0.3.7",
"postcss": "^8.4.39",
"react-scripts": "^5.0.1",
"react-select-event": "^5.1.0"
},
"peerDependencies": {
"postcss": "^8.4.33"
},
"jest": {
"coveragePathIgnorePatterns": [
"<rootDir>/src/index.js",
Expand Down
2 changes: 0 additions & 2 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/logo64.png" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Merriweather&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand Down
28 changes: 28 additions & 0 deletions frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,34 @@
font-weight: bold;
}

@font-face {
font-family: 'Merriweather';
src: url('./assets/Merriweather-Regular.ttf') format('truetype');
font-weight: normal;
}

@font-face {
font-family: 'Merriweather';
src: url('./assets/Merriweather-Bold.ttf') format('truetype');
font-weight: bold;
}

@font-face {
font-family: 'Merriweather';
src: url('./assets/Merriweather-Italic.ttf') format('truetype');
font-style: italic;
font-weight: normal;
}

@font-face {
font-family: 'Merriweather';
src: url('./assets/Merriweather-BoldItalic.ttf') format('truetype');
font-style: italic;
font-weight: bold;
}



a {
color: $text-link;
}
Expand Down
Binary file added frontend/src/assets/Merriweather-Bold.ttf
Binary file not shown.
Binary file added frontend/src/assets/Merriweather-BoldItalic.ttf
Binary file not shown.
Binary file added frontend/src/assets/Merriweather-Italic.ttf
Binary file not shown.
Binary file added frontend/src/assets/Merriweather-Regular.ttf
Binary file not shown.
21 changes: 20 additions & 1 deletion frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8484,7 +8484,7 @@ mutationobserver-shim@^0.3.7:
resolved "https://registry.yarnpkg.com/mutationobserver-shim/-/mutationobserver-shim-0.3.7.tgz#8bf633b0c0b0291a1107255ed32c13088a8c5bf3"
integrity sha512-oRIDTyZQU96nAiz2AQyngwx1e89iApl2hN5AOYwyxLUB47UYsU3Wv9lJWqH5y/QdiYkc5HQLi23ZNB3fELdHcQ==

nanoid@^3.2.0, nanoid@^3.3.6:
nanoid@^3.2.0, nanoid@^3.3.6, nanoid@^3.3.7:
version "3.3.4"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
Expand Down Expand Up @@ -8964,6 +8964,11 @@ picocolors@^1.0.0:
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==

picocolors@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1"
integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==

picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3, picomatch@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
Expand Down Expand Up @@ -9612,6 +9617,15 @@ postcss@^7.0.35, postcss@^8.3.5, postcss@^8.4.18, postcss@^8.4.19, postcss@^8.4.
picocolors "^1.0.0"
source-map-js "^1.0.2"

postcss@^8.4.39:
version "8.4.39"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.39.tgz#aa3c94998b61d3a9c259efa51db4b392e1bde0e3"
integrity sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==
dependencies:
nanoid "^3.3.7"
picocolors "^1.0.1"
source-map-js "^1.2.0"

potpack@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/potpack/-/potpack-1.0.2.tgz#23b99e64eb74f5741ffe7656b5b5c4ddce8dfc14"
Expand Down Expand Up @@ -10971,6 +10985,11 @@ source-list-map@^2.0.0, source-list-map@^2.0.1:
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==

source-map-js@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af"
integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==

source-map-loader@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-3.0.2.tgz#af23192f9b344daa729f6772933194cc5fa54fee"
Expand Down
24 changes: 22 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ process.on('unhandledRejection', (reason, promise) => {
});

const app = express();

const oauth2CallbackPath = '/oauth2-client/login/oauth2/code/';
let index;

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

app.use((req, res, next) => {
// set the X-Content-Type-Options header to prevent MIME-sniffing
res.set('X-Content-Type-Options', 'nosniff');

// set nonce
res.locals.nonce = crypto.randomBytes(16).toString('hex');

// set CSP
const cspMiddleware = helmet.contentSecurityPolicy({
directives: {
...omit(helmet.contentSecurityPolicy.getDefaultDirectives(), 'upgrade-insecure-requests', 'block-all-mixed-content', 'script-src', 'img-src', 'default-src'),
...omit(
helmet.contentSecurityPolicy.getDefaultDirectives(),
'upgrade-insecure-requests',
'block-all-mixed-content',
'script-src',
'img-src',
'default-src',
'style-src',
'font-src',
),
styleSrc: ["'self'", "'unsafe-inline'"],
fontSrc: ["'self'"],
'form-action': ["'self'"],
scriptSrc: ["'self'", '*.googletagmanager.com'],
scriptSrcElem: ["'self'", 'https://*.googletagmanager.com', `'nonce-${res.locals.nonce}'`],
Expand All @@ -81,9 +99,11 @@ if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'dss') {
}

app.use('/api/v1', require('./routes/externalApi').default);

app.use('/api', require('./routes/apiDirectory').default);

// Disable "X-Powered-By" header
app.disable('x-powered-by');

// TODO: change `app.get...` with `router.get...` once our oauth callback has been updated
app.get(oauth2CallbackPath, cookieSession, async (req, res) => {
try {
Expand Down
Loading