-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(bun): Ensure bun is latest for local tests #16244
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
base: develop
Are you sure you want to change the base?
Conversation
|
||
res.on('end', () => { | ||
// Execute the downloaded script | ||
exec(scriptData, installError => { |
Check failure
Code scanning / CodeQL
Uncontrolled command line Critical
user-provided value
}); | ||
}) | ||
.on('error', e => { | ||
console.error('Failed to download the installation script:', e); |
Check warning
Code scanning / CodeQL
Log injection Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
To fix the issue, we need to sanitize the error message contained in the e
object before logging it. Specifically:
- Extract the error message from the
e
object usinge.message
. - Remove any newline (
\n
) or carriage return (\r
) characters from the message usingString.prototype.replace
. - Log the sanitized message instead of the raw
e
object.
This ensures that any potentially malicious input in the error message is neutralized before being written to the log.
-
Copy modified lines R64-R65
@@ -63,3 +63,4 @@ | ||
.on('error', e => { | ||
console.error('Failed to download the installation script:', e); | ||
const sanitizedMessage = e.message.replace(/\n|\r/g, ""); | ||
console.error('Failed to download the installation script:', sanitizedMessage); | ||
process.exit(1); |
I noticed that my bun version locally was old, leading to weird test issues.
Now, our install script will ensure this is the latest version. On CI, we already test against the latest version.
(Noticed this because bun 1.0.2 which I had installed reports itself as Node 18.5.0 which lead to ESM warnings)