Skip to content

PM- 228 Fix system information leak #1603

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

Merged
merged 4 commits into from
Jan 21, 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
8 changes: 5 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ process.on('unhandledRejection', err => {
// Ensure environment variables are read.
require('../config/env')

console.log(`Build script is run with FILE_PICKER_API_KEY=${process.env.FILE_PICKER_API_KEY}`)
console.log(`Build script is run`)

const path = require('path')
const chalk = require('chalk')
Expand Down Expand Up @@ -114,8 +114,10 @@ checkBrowsers(paths.appPath, isInteractive)
}
)
.catch(err => {
if (err && err.message) {
console.error(err.message)
if (err && process.env.NODE_ENV === 'development') {
console.log(err)
} else {
console.error('An unexpected error occurred while build')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do the same in here? eg. log the error for dev env?

}
process.exit(1)
})
Expand Down
6 changes: 4 additions & 2 deletions scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ checkBrowsers(paths.appPath, isInteractive)
})
})
.catch(err => {
if (err && err.message) {
console.error(err.message)
if (err && process.env.NODE_ENV === 'development') {
console.log(err)
} else {
console.error('An error occurred while starting the development server')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do the same in here? eg. log the error for dev env?

}
process.exit(1)
})
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ app.get('/*', (req, res) => res.sendFile(path.join(__dirname, 'build', 'index.ht
const port = process.env.PORT || 3000
app.listen(port)

console.log(`App is listening on port ${port}`)
console.log(`App is now listening...`)
6 changes: 5 additions & 1 deletion src/components/ChallengeEditor/Description-Field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,11 @@ class DescriptionField extends Component {
}).then(res => {
onload(res)
}).catch(err => {
console.log(err)
if (process.env.NODE_ENV === 'development') {
console.log(err)
} else {
console.log('An unexpected error occured while uploading image')
}
onerror()
})
}
Expand Down
6 changes: 5 additions & 1 deletion src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ class Routes extends React.Component {
getFreshToken().then((token) => {
this.props.saveToken(token)
}).catch((error) => {
console.error(error.message)
if (process.env.NODE_ENV === 'development') {
console.error(error)
} else {
console.error('An unexpected error occurred while getting auth token')
}
const redirectBackToUrl = encodeURIComponent(window.location.origin + this.props.location.pathname)
window.location = `${ACCOUNTS_APP_LOGIN_URL}?retUrl=${redirectBackToUrl}`
})
Expand Down
12 changes: 10 additions & 2 deletions src/services/axiosWithAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export const getToken = () => {
resolve(token)
})
.catch((err) => {
console.error(err)
if (process.env.NODE_ENV === 'development') {
console.log(err)
} else {
console.error('Error getting auth token')
}
reject(err)
})
}
Expand All @@ -40,7 +44,11 @@ axiosInstance.interceptors.request.use(config => {
return config
})
.catch((err) => {
console.error(err)
if (process.env.NODE_ENV === 'development') {
console.log(err)
} else {
console.error('An unexpected error occured while retrieving the auth token.')
}
const redirectBackToUrl = window.location.origin
window.location = ACCOUNTS_APP_LOGIN_URL + '?retUrl=' + redirectBackToUrl
})
Expand Down
Loading