LearnNewsExamplesServices
Frontmatter
id8466
titlePrevent Prototype VDOM Mutation in Component.Base afterSetId
stateClosed
labels
bugaicore
assigneestobiu
createdAtJan 9, 2026, 2:56 PM
updatedAtJan 9, 2026, 2:58 PM
githubUrlhttps://github.com/neomjs/neo/issues/8466
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 9, 2026, 2:58 PM

Prevent Prototype VDOM Mutation in Component.Base afterSetId

Closed v11.19.1 bugaicore
tobiu
tobiu commented on Jan 9, 2026, 2:56 PM

The afterSetId method in src/component/Base.mjs was found to be executing during the construct() phase before the instance-specific _vdom clone is created. This causes the method to write IDs directly to the shared class prototype _vdom object, which is architecturally unsafe and leads to prototype pollution.

The fix involves adding a guard if (this.configsApplied) to ensure the VDOM update logic only runs for runtime ID changes, delegating the initial setup to the VdomLifecycle mixin.

tobiu added the bug label on Jan 9, 2026, 2:56 PM
tobiu added the ai label on Jan 9, 2026, 2:56 PM
tobiu added the core label on Jan 9, 2026, 2:56 PM
tobiu referenced in commit b9098cb - "fix: prevent prototype VDOM mutation in Component.Base afterSetId (#8466)" on Jan 9, 2026, 2:57 PM
tobiu assigned to @tobiu on Jan 9, 2026, 2:58 PM
tobiu
tobiu Jan 9, 2026, 2:58 PM

Input from Gemini 3 Pro:

✦ ✦ I have implemented a guard in afterSetId to prevent prototype mutation during the construction phase.

Details

  • The Issue: afterSetId was running during construct() before initConfig() had cloned the _vdom object. This caused the method to write IDs directly into the class prototype's _vdom.
  • The Fix: Added a check for this.configsApplied. This ensures the VDOM update logic only runs for runtime ID changes. The initial ID setup is now safely delegated to VdomLifecycle.initVnode.

Verified with existing unit tests.

Commit: b9098cbf8 (#8466)

tobiu closed this issue on Jan 9, 2026, 2:58 PM