Skip to content

refactor: replace external uuid with crypto.randomUUID()#7040

Open
AviVahl wants to merge 1 commit intonetlify:mainfrom
AviVahl:avi/drop-uuid-usage
Open

refactor: replace external uuid with crypto.randomUUID()#7040
AviVahl wants to merge 1 commit intonetlify:mainfrom
AviVahl:avi/drop-uuid-usage

Conversation

@AviVahl
Copy link
Copy Markdown

@AviVahl AviVahl commented Apr 26, 2026

Summary

older versions of uuid have a security vulnerability. newer version are esm-only.

replaced with node's built-in crypto.randomUUID()

@AviVahl AviVahl requested a review from a team as a code owner April 26, 2026 09:35
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 49384699-ec68-4852-a462-00b037a6095d

📥 Commits

Reviewing files that changed from the base of the PR and between ebcfb92 and 34877ab.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • packages/build/package.json
  • packages/build/src/plugins/ipc.js
  • packages/edge-bundler/node/bundler.ts
  • packages/edge-bundler/node/server/server.test.ts
  • packages/edge-bundler/package.json
  • packages/js-client/package.json
  • packages/js-client/src/index.test.ts
💤 Files with no reviewable changes (2)
  • packages/js-client/package.json
  • packages/build/package.json
✅ Files skipped from review due to trivial changes (4)
  • packages/edge-bundler/package.json
  • packages/edge-bundler/node/bundler.ts
  • packages/edge-bundler/node/server/server.test.ts
  • packages/js-client/src/index.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/build/src/plugins/ipc.js

📝 Walkthrough

Summary by CodeRabbit

  • Chores

    • Removed an external UUID dependency from build, edge-bundler, and js-client packages.
  • Refactor

    • Switched internal identifier generation to the platform’s native UUID generation.
  • Tests

    • Updated test fixtures and request/header identifiers to use native UUID generation.

Walkthrough

The PR removes the uuid dependency from several packages and replaces all uses of uuid.v4() with Node's crypto.randomUUID() in production code and tests (IPC, bundle ID generation, request IDs, and multiple test files). Corresponding package.json entries removing uuid were updated. No exported/public APIs or other logic were changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description explains the motivation (security vulnerability and ESM-only newer versions) and the solution (using crypto.randomUUID()), but does not follow the provided template structure with checklist items and other required sections. Consider following the repository's PR template more closely, including the checklist items for tests, documentation, and issue references to ensure consistency with contribution guidelines.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: replacing the external uuid package with Node's built-in crypto.randomUUID() across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/edge-bundler/node/bundler.ts (1)

1-1: Optional: prefer the node: protocol for the builtin import.

Using node:crypto makes it explicit that this is a Node builtin (helps bundlers and readers, avoids any chance of shadowing by a userland crypto package). Same applies in packages/build/src/plugins/ipc.js and packages/edge-bundler/node/server/server.test.ts.

♻️ Suggested change
-import crypto from 'crypto'
+import { randomUUID } from 'node:crypto'

…and update the call site:

-  const buildID = crypto.randomUUID()
+  const buildID = randomUUID()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/edge-bundler/node/bundler.ts` at line 1, The import uses the generic
builtin path ("import crypto from 'crypto'") which can be shadowed; change it to
the explicit Node builtin specifier by importing from "node:crypto" instead and
update any related call sites that reference the imported symbol (e.g., the
top-level import statement that defines crypto and uses like crypto.randomBytes
in bundler.ts and the analogous imports in the IPC plugin and server tests) so
they continue to reference the same symbol name; ensure all three occurrences
replace 'crypto' with 'node:crypto' while keeping the imported identifier
(crypto) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/edge-bundler/node/bundler.ts`:
- Line 1: The import uses the generic builtin path ("import crypto from
'crypto'") which can be shadowed; change it to the explicit Node builtin
specifier by importing from "node:crypto" instead and update any related call
sites that reference the imported symbol (e.g., the top-level import statement
that defines crypto and uses like crypto.randomBytes in bundler.ts and the
analogous imports in the IPC plugin and server tests) so they continue to
reference the same symbol name; ensure all three occurrences replace 'crypto'
with 'node:crypto' while keeping the imported identifier (crypto) unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 24db2caa-b0b8-4d89-97de-55ef517d97f0

📥 Commits

Reviewing files that changed from the base of the PR and between d17373f and ebcfb92.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • packages/build/package.json
  • packages/build/src/plugins/ipc.js
  • packages/edge-bundler/node/bundler.ts
  • packages/edge-bundler/node/server/server.test.ts
  • packages/edge-bundler/package.json
  • packages/js-client/package.json
  • packages/js-client/src/index.test.ts
💤 Files with no reviewable changes (2)
  • packages/js-client/package.json
  • packages/build/package.json

older versions of uuid have a security vulnerability. newer version are esm-only.

replaced with node's built-in crypto.randomUUID()
@AviVahl AviVahl force-pushed the avi/drop-uuid-usage branch from ebcfb92 to 34877ab Compare May 4, 2026 08:11
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.

1 participant