Conversation
Merge activity
|
graphite-app Bot
pushed a commit
that referenced
this pull request
Jan 1, 2026
…r, fix ##4490 (#5751) ### TL;DR Fixed a security vulnerability where prototype properties like "constructor" in select/plural statements could cause unexpected behavior. ### What changed? Modified the `formatToParts` function to use `Object.prototype.hasOwnProperty.call()` when accessing options in select and plural elements. This prevents potential issues when keys like "constructor", "__proto__", or other JavaScript object prototype properties are used as values in message formats. ### How to test? Added comprehensive test cases that verify: - Select statements with "constructor" as a value - Select statements with "__proto__" as a value - Select statements with "toString" as a value - Select statements with "hasOwnProperty" as a value - Plural rules that could potentially match prototype properties - Ensuring no crashes when select value is "constructor" ### Why make this change? This fixes GitHub issue #4490 where using certain property names that exist on the JavaScript object prototype (like "constructor") in select/plural statements could lead to unexpected behavior or potential security vulnerabilities. By using `hasOwnProperty`, we ensure that only the object's own properties are accessed, not those inherited from the prototype chain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Fixed a security vulnerability where prototype properties like "constructor" in select/plural statements could cause unexpected behavior.
What changed?
Modified the
formatToPartsfunction to useObject.prototype.hasOwnProperty.call()when accessing options in select and plural elements. This prevents potential issues when keys like "constructor", "proto", or other JavaScript object prototype properties are used as values in message formats.How to test?
Added comprehensive test cases that verify:
Why make this change?
This fixes GitHub issue #4490 where using certain property names that exist on the JavaScript object prototype (like "constructor") in select/plural statements could lead to unexpected behavior or potential security vulnerabilities. By using
hasOwnProperty, we ensure that only the object's own properties are accessed, not those inherited from the prototype chain.