Skip to content

Commit ef8acb0

Browse files
authored
Merge pull request #1602 from topcoder-platform/develop
PROD Release - Work Manager Security Issues (5442)
2 parents 32c1a42 + addbf7e commit ef8acb0

File tree

21 files changed

+116
-163
lines changed

21 files changed

+116
-163
lines changed

config/constants/development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ module.exports = {
5151
// duration to show the prompt saying user will be logged out, before actually logging out the user
5252
IDLE_TIMEOUT_GRACE_MINUTES: 5,
5353
MULTI_ROUND_CHALLENGE_TEMPLATE_ID: 'd4201ca4-8437-4d63-9957-3f7708184b07',
54-
UNIVERSAL_NAV_URL: '//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js',
54+
UNIVERSAL_NAV_URL: 'https://uni-nav.topcoder-dev.com/v1/tc-universal-nav.js',
5555
HEADER_AUTH_URLS_HREF: `https://accounts-auth0.${DOMAIN}?utm_source=community-app-main`,
5656
HEADER_AUTH_URLS_LOCATION: `https://accounts-auth0.${DOMAIN}?retUrl=%S&utm_source=community-app-main`,
5757
SKILLS_V5_API_URL: `${API_V5}/standardized-skills/skills/autocomplete`,

config/constants/production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
IDLE_TIMEOUT_MINUTES: 10,
4949
IDLE_TIMEOUT_GRACE_MINUTES: 5,
5050
MULTI_ROUND_CHALLENGE_TEMPLATE_ID: 'd4201ca4-8437-4d63-9957-3f7708184b07',
51-
UNIVERSAL_NAV_URL: '//uni-nav.topcoder.com/v1/tc-universal-nav.js',
51+
UNIVERSAL_NAV_URL: 'https://uni-nav.topcoder.com/v1/tc-universal-nav.js',
5252
HEADER_AUTH_URLS_HREF: `https://accounts-auth0.${DOMAIN}?utm_source=community-app-main`,
5353
HEADER_AUTH_URLS_LOCATION: `https://accounts-auth0.${DOMAIN}?retUrl=%S&utm_source=community-app-main`,
5454
SKILLS_V5_API_URL: `${API_V5}/standardized-skills/skills/autocomplete`,

config/env.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ dotenvFiles.forEach(dotenvFile => {
4949
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
5050
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
5151
// We also resolve them to make sure all tools using them work consistently.
52-
const appDirectory = fs.realpathSync(process.cwd())
52+
const appDirectory = process.cwd()
5353
process.env.NODE_PATH = (process.env.NODE_PATH || '')
5454
.split(path.delimiter)
5555
.filter(folder => folder && !path.isAbsolute(folder))

config/paths.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const url = require('url')
66

77
// Make sure any symlinks in the project folder are resolved:
88
// https://github.com/facebook/create-react-app/issues/637
9-
const appDirectory = fs.realpathSync(process.cwd())
9+
const appDirectory = process.cwd()
1010
const resolveApp = relativePath => path.resolve(appDirectory, relativePath)
1111

1212
const envPublicUrl = process.env.PUBLIC_URL

config/webpack.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'
2727
// makes for a smoother build process.
2828
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false'
2929

30-
// Check if TypeScript is setup
31-
const useTypeScript = fs.existsSync(paths.appTsConfig)
32-
3330
// style files regexes
3431
const cssRegex = /\.css$/
3532
const cssModuleRegex = /\.module\.css$/
@@ -257,7 +254,7 @@ module.exports = function (webpackEnv) {
257254
// for React Native Web.
258255
extensions: paths.moduleFileExtensions
259256
.map(ext => `.${ext}`)
260-
.filter(ext => useTypeScript || !ext.includes('ts')),
257+
.filter(ext => !ext.includes('ts')),
261258
alias: {
262259
// Support React Native Web
263260
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/

docker/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Use the base image with Node.js
22
FROM node:12
3+
RUN useradd -m -s /bin/bash appuser
34
ARG NODE_ENV
45
ARG BABEL_ENV
56

@@ -18,6 +19,9 @@ COPY . /challenge-engine-ui
1819
# Set working directory for future use
1920
WORKDIR /challenge-engine-ui
2021

22+
RUN chown -R appuser:appuser /challenge-engine-ui
23+
USER appuser
24+
2125
# Install the dependencies from package.json
2226
RUN echo "NODE ENV in Docker: $NODE_ENV"
2327
RUN echo "BABEL ENV in Docker: $BABEL_ENV"

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
"jwt-decode": "^2.2.0",
3939
"lodash": "^4.17.11",
4040
"mini-css-extract-plugin": "0.4.3",
41-
"moment": "^2.24.0",
42-
"moment-duration-format": "^2.2.2",
43-
"moment-timezone": "^0.5.34",
41+
"moment": "^2.29.4",
42+
"moment-duration-format": "^2.3.2",
43+
"moment-timezone": "^0.5.43",
4444
"node-sass": "^4.14.0",
4545
"normalize-text": "^2.4.1",
4646
"optimize-css-assets-webpack-plugin": "5.0.1",

scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const printBuildError = require('react-dev-utils/printBuildError')
2828
const measureFileSizesBeforeBuild =
2929
FileSizeReporter.measureFileSizesBeforeBuild
3030
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild
31-
const useYarn = fs.existsSync(paths.yarnLockFile)
31+
const useYarn = false
3232

3333
// These sizes are pretty large. We'll warn for bundles exceeding them.
3434
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024

scripts/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const paths = require('../config/paths')
3232
const configFactory = require('../config/webpack.config')
3333
const createDevServerConfig = require('../config/webpackDevServer.config')
3434

35-
const useYarn = fs.existsSync(paths.yarnLockFile)
35+
const useYarn = false
3636
const isInteractive = process.stdout.isTTY
3737

3838
// Warn and crash if required files are missing

scripts/test.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,16 @@ process.on('unhandledRejection', err => {
1616
require('../config/env')
1717

1818
const jest = require('jest')
19-
const execSync = require('child_process').execSync
2019
let argv = process.argv.slice(2)
2120

22-
function isInGitRepository () {
23-
try {
24-
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' })
25-
return true
26-
} catch (e) {
27-
return false
28-
}
29-
}
30-
31-
function isInMercurialRepository () {
32-
try {
33-
execSync('hg --cwd . root', { stdio: 'ignore' })
34-
return true
35-
} catch (e) {
36-
return false
37-
}
38-
}
39-
4021
// Watch unless on CI, in coverage mode, or explicitly running all tests
4122
if (
4223
!process.env.CI &&
4324
argv.indexOf('--coverage') === -1 &&
4425
argv.indexOf('--watchAll') === -1
4526
) {
4627
// https://github.com/facebook/create-react-app/issues/5210
47-
const hasSourceControl = isInGitRepository() || isInMercurialRepository()
48-
argv.push(hasSourceControl ? '--watch' : '--watchAll')
28+
argv.push('--watchAll')
4929
}
5030

5131
jest.run(argv)

0 commit comments

Comments
 (0)