Skip to content

fix: prototype-polluting function - #500

Closed
julio-lopez wants to merge 1 commit into
mainfrom
alert-autofix-3
Closed

julio-lopez wants to merge 1 commit into
mainfrom
alert-autofix-3

Conversation

@julio-lopez

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/kopia/htmlui/security/code-scanning/3

The best fix is to harden deep-path traversal/assignment by rejecting unsafe path segments before any read/write happens. In general, for deep assignment helpers, you should block prototype-pollution gadget keys (__proto__, constructor, prototype) for every segment in the path and avoid traversing into those keys.

In src/utils/deepstate.js, update setDeepStateProperty to validate each part during traversal and also validate the final segment before assignment. If any segment is unsafe, return early (no state mutation). This preserves existing behavior for valid keys and prevents pollution through both intermediate and terminal path components. No new imports are needed; add a local denylist check inside the function.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@julio-lopez julio-lopez changed the title Potential fix for code scanning alert no. 3: Prototype-polluting function fix: Prototype-polluting function Nov 3, 2026
@julio-lopez julio-lopez changed the title fix: Prototype-polluting function fix: prototype-polluting function Nov 3, 2026
@julio-lopez julio-lopez closed this Nov 3, 2026
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