Skip to content

chore(deps): update dependency defu to v6 [security]#81

Open
renovate[bot] wants to merge 1 commit intomainfrom
renovate/npm-defu-vulnerability
Open

chore(deps): update dependency defu to v6 [security]#81
renovate[bot] wants to merge 1 commit intomainfrom
renovate/npm-defu-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate bot commented Apr 4, 2026

This PR contains the following updates:

Package Change Age Confidence
defu ^3.2.2^6.0.0 age confidence

GitHub Vulnerability Alerts

CVE-2026-35209

Impact

Applications that pass unsanitized user input (e.g. parsed JSON request bodies, database records, or config files from untrusted sources) as the first argument to defu() are vulnerable to prototype pollution.

A crafted payload containing a __proto__ key can override intended default values in the merged result:

import { defu } from 'defu'

const userInput = JSON.parse('{"__proto__":{"isAdmin":true}}')
const config = defu(userInput, { isAdmin: false })

config.isAdmin // true — attacker overrides the server default

Root Cause

The internal _defu function used Object.assign({}, defaults) to copy the defaults object. Object.assign invokes the __proto__ setter, which replaces the resulting object's [[Prototype]] with attacker-controlled values. Properties inherited from the polluted prototype then bypass the existing __proto__ key guard in the for...in loop and land in the final result.

Fix

Replace Object.assign({}, defaults) with object spread ({ ...defaults }), which uses [[DefineOwnProperty]] and does not invoke the __proto__ setter.

Affected Versions

<= 6.1.4

Credits

Reported by @​BlackHatExploitation


Release Notes

unjs/defu (defu)

v6.1.5

Compare Source

compare changes

🩹 Fixes
  • Prevent prototype pollution via __proto__ in defaults (#​156)
  • Ignore inherited enumerable properties (11ba022)
🏡 Chore
✅ Tests
  • Add more tests for plain objects (b65f603)
🤖 CI
❤️ Contributors

v6.1.4

Compare Source

compare changes

🩹 Fixes
  • Merge objects with Module type (#​121)
💅 Refactors
  • Move isPlainObject to _utils to allow testing (e922a16)
  • Make isPlainObject logic more readable (e458b63)
📖 Documentation
🏡 Chore
✅ Tests
  • Improve tests for isPlainObject (b24a213)
❤️ Contributors

v6.1.3

Compare Source

compare changes

🩹 Fixes
  • Only merge plain objects (#​111)
📖 Documentation
📦 Build
  • Backward compatible cjs entry (#​110)
🏡 Chore
🎨 Styles
  • Format with prettier v3 (32650f1)
❤️ Contributors

v6.1.2

Compare Source

compare changes

🩹 Fixes
  • Add node16 compatible type declaration (#​73)
🏡 Chore
  • Fix renovate config (#​56)
  • Use changelogen to release (5e24124)
🎨 Styles
❤️ Contributors
6.1.1 (2022-11-14)

v6.1.1

Compare Source

v6.1.0

Compare Source

Features
Bug Fixes
  • types: constrain inferred types of Defu (3d3ea3e)
6.0.1 (2022-08-16)
Bug Fixes

v6.0.1

Compare Source

Features
Bug Fixes
  • types: constrain inferred types of Defu (3d3ea3e)
6.0.1 (2022-08-16)
Bug Fixes

v6.0.0

Compare Source

Features
Bug Fixes
  • types: constrain inferred types of Defu (3d3ea3e)
6.0.1 (2022-08-16)
Bug Fixes

v5.0.1

Compare Source

⚠ BREAKING CHANGES
  • Use named exports:
  • import defu from 'defu' => import { defu } from 'defu'
  • defu.fn => import { defuFn }
  • defu.arrayFn => import { defuArrayFn }
  • When merging input value with defaults with an array, order is reversed
Features
  • concat array defaults to the last (f6df314)
  • use named exports (4a8fc52)
Bug Fixes
5.0.1 (2022-01-13)

v5.0.0

Compare Source

⚠ BREAKING CHANGES
  • Use named exports:
  • import defu from 'defu' => import { defu } from 'defu'
  • defu.fn => import { defuFn }
  • defu.arrayFn => import { defuArrayFn }
  • When merging input value with defaults with an array, order is reversed
Features
  • concat array defaults to the last (f6df314)
  • use named exports (4a8fc52)
Bug Fixes
5.0.1 (2022-01-13)

v4.0.1

Compare Source

⚠ BREAKING CHANGES
  • undefined values will be bypassed and not consistent behavior with defaults-deep anymore.
Features
4.0.1 (2021-04-23)

v4.0.0

Compare Source

⚠ BREAKING CHANGES
  • undefined values will be bypassed and not consistent behavior with defaults-deep anymore.
Features
4.0.1 (2021-04-23)

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/npm-defu-vulnerability branch from 3dafbd0 to e8b86bf Compare April 8, 2026 15:37
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.

0 participants