Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 1, 2025

This is an automated pull request to merge mariano/browserbase into dev.
It was created by the [Auto Pull Request] action.

- Added @1password/sdk and @1password/sdk-core to manage credentials securely.
- Updated @browserbasehq/sdk to version 2.6.0 and added @browserbasehq/stagehand for improved functionality.
- Introduced new components for Browserbase integration, including a page and session management.
- Adjusted Docker configuration to use environment files specific to each service.
- Enhanced Next.js configuration to ensure proper handling of 1Password and Browserbase packages.

This update improves the overall security and functionality of the application.
- Added SMTP configuration options to environment variables for email provisioning.
- Implemented mailbox provisioning functionality using Nodemailer, allowing for automatic email creation for organizations.
- Updated Browserbase integration to pass organization ID to the Stagehand component for improved session management.
- Refactored 1Password credential retrieval to support organization-specific logins.

This update enhances the application's email capabilities and improves the integration with Browserbase, streamlining the onboarding process for new organizations.
…oning

- Changed SMTP configuration options in the environment to be optional, enhancing flexibility.
- Simplified the mailbox provisioning process by removing unnecessary parameters and adjusting email formatting.
- Updated the 1Password login item creation to remove the title suffix, ensuring a cleaner title format.
- Improved the handling of SMTP credentials for better integration with SES.

These changes enhance the application's email provisioning capabilities and streamline the organization setup process.
Copy link

vercel bot commented Sep 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
app Error Error Sep 1, 2025 3:23pm
portal Ready Ready Preview Comment Sep 1, 2025 3:23pm

// username like org-<id-short>
const localPart = params.organizationId;
const email = `comp-${localPart}@${domain}`;
const password = generateStrongPassword();

Check failure

Code scanning / CodeQL

Insecure randomness High

This uses a cryptographically insecure random number generated at
Math.random()
in a security context.

Copilot Autofix

AI 10 days ago

The fix is to completely replace all use of Math.random() in password generation with calls to a cryptographically secure random number generator. In Node.js, this means using crypto.randomInt() for securely generating random indices into the symbols string in the pick function, as well as for randomizing the order of password characters instead of the Fisher-Yates shuffle based on Math.random(). For shuffling, the secure way in Node.js is to either implement an unbiased Fisher-Yates shuffle with crypto.randomInt() for index selection, or to use a well-known shuffle implementation with a secure random source.

Edits are needed to:

  • The pick function to replace its source of randomness (Math.random()).
  • The .sort(() => Math.random() - 0.5) shuffling logic, which must be replaced with a secure, unbiased shuffle using crypto.randomInt().

These changes are all within the generateStrongPassword function in apps/app/src/lib/mail/provisionMailbox.ts. No new external dependencies are needed beyond native Node.js crypto.

Suggested changeset 1
apps/app/src/lib/mail/provisionMailbox.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/app/src/lib/mail/provisionMailbox.ts b/apps/app/src/lib/mail/provisionMailbox.ts
--- a/apps/app/src/lib/mail/provisionMailbox.ts
+++ b/apps/app/src/lib/mail/provisionMailbox.ts
@@ -13,11 +13,17 @@
   const raw = crypto.randomBytes(32).toString('base64url');
   const symbols = '!@#$%^&*()-_=+[]{}';
   const pick = (s: string, n: number) =>
-    Array.from({ length: n }, () => s[Math.floor(Math.random() * s.length)]).join('');
-  const pwd = (raw.slice(0, 18) + pick(symbols, 6))
-    .split('')
-    .sort(() => Math.random() - 0.5)
-    .join('');
+    Array.from({ length: n }, () => s[crypto.randomInt(s.length)]).join('');
+  // Secure Fisher-Yates shuffle for strong password
+  function secureShuffle(str: string): string {
+    const arr = str.split('');
+    for (let i = arr.length - 1; i > 0; i--) {
+      const j = crypto.randomInt(i + 1);
+      [arr[i], arr[j]] = [arr[j], arr[i]];
+    }
+    return arr.join('');
+  }
+  const pwd = secureShuffle(raw.slice(0, 18) + pick(symbols, 6));
   return pwd;
 }
 
EOF
@@ -13,11 +13,17 @@
const raw = crypto.randomBytes(32).toString('base64url');
const symbols = '!@#$%^&*()-_=+[]{}';
const pick = (s: string, n: number) =>
Array.from({ length: n }, () => s[Math.floor(Math.random() * s.length)]).join('');
const pwd = (raw.slice(0, 18) + pick(symbols, 6))
.split('')
.sort(() => Math.random() - 0.5)
.join('');
Array.from({ length: n }, () => s[crypto.randomInt(s.length)]).join('');
// Secure Fisher-Yates shuffle for strong password
function secureShuffle(str: string): string {
const arr = str.split('');
for (let i = arr.length - 1; i > 0; i--) {
const j = crypto.randomInt(i + 1);
[arr[i], arr[j]] = [arr[j], arr[i]];
}
return arr.join('');
}
const pwd = secureShuffle(raw.slice(0, 18) + pick(symbols, 6));
return pwd;
}

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant