Skip to content

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mydea
Copy link
Member

@mydea mydea commented May 9, 2025

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)

@mydea mydea requested a review from AbhiPrasad May 9, 2025 12:03
@mydea mydea self-assigned this May 9, 2025

res.on('end', () => {
// Execute the downloaded script
exec(scriptData, installError => {

Check failure

Code scanning / CodeQL

Uncontrolled command line Critical

This command line depends on a
user-provided value
.
});
})
.on('error', e => {
console.error('Failed to download the installation script:', e);

Check warning

Code scanning / CodeQL

Log injection Medium

Log entry depends on a
user-provided value
.

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:

  1. Extract the error message from the e object using e.message.
  2. Remove any newline (\n) or carriage return (\r) characters from the message using String.prototype.replace.
  3. 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.


Suggested changeset 1
packages/bun/scripts/install-bun.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/bun/scripts/install-bun.js b/packages/bun/scripts/install-bun.js
--- a/packages/bun/scripts/install-bun.js
+++ b/packages/bun/scripts/install-bun.js
@@ -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);
EOF
@@ -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);
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants