-
Notifications
You must be signed in to change notification settings - Fork 432
fix(shared): replace custom deepmerge with @fastify/deepmerge #7622
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
Conversation
Replace vulnerable custom `fastDeepMergeAndReplace` and `fastDeepMergeAndKeep` utilities with battle-tested `@fastify/deepmerge` library. Benefits: - Built-in prototype pollution protection (blocks __proto__, constructor, prototype) - ~30x faster performance than standard deepmerge libraries - Well-maintained by trusted Fastify team - Non-mutating API (returns new objects) Changes: - Add @fastify/deepmerge dependency to @clerk/shared and @clerk/ui - Update parseLocalization.ts with stripUndefined helper to preserve fallback-to-English behavior for undefined values - Update parseAppearance.ts to use functional merge pattern - Refactor createVariants.ts to functional style (non-mutating) - Remove custom fastDeepMerge.ts and its tests
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe pull request replaces custom deep merge utility functions with the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
This approach is not preferable. Additional dependencies and |
Summary
Replace vulnerable custom
fastDeepMergeAndReplaceandfastDeepMergeAndKeeputilities with the battle-tested@fastify/deepmergelibrary.This is an alternative approach to #7621 which fixes the same prototype pollution vulnerability (SEC-252) but by adopting an external library instead of patching the existing code.
Benefits of @fastify/deepmerge
__proto__,constructor,prototypeChanges
@fastify/deepmerge: ^3.1.0to@clerk/sharedand@clerk/uiparseLocalization.tswithstripUndefinedhelper to preserve fallback-to-English behaviorparseAppearance.tsto use functional merge patterncreateVariants.tsto functional style (non-mutating)fastDeepMerge.tsand its testsTrade-offs vs #7621
Test plan
@clerk/sharedtests pass (56 files, 912 tests)@clerk/uitests pass (100 files, 1399 tests)undefinedvalues in localization still fall back to English defaultsSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.