Skip to content

fix(security): 2 improvements across 2 files#1466

Open
tomaioo wants to merge 2 commits into
railmapgen:mainfrom
tomaioo:fix/security/prototype-pollution-via-object-mutation-
Open

fix(security): 2 improvements across 2 files#1466
tomaioo wants to merge 2 commits into
railmapgen:mainfrom
tomaioo:fix/security/prototype-pollution-via-object-mutation-

Conversation

@tomaioo

@tomaioo tomaioo commented May 23, 2026

Copy link
Copy Markdown

Summary

fix(security): 2 improvements across 2 files

Problem

Severity: Medium | File: src/components/svgs/nodes/i18n-text.tsx:L10

The I18nText component directly mutates the attrs prop object with attrs.content = translateName(attrs.contents). This mutates the original object reference, which can cause unexpected side effects, stale data, or prototype pollution if the object has a modified prototype chain. React props should be treated as immutable.

Solution

Create a new object instead of mutating: const textAttrs = { ...attrs, content: translateName(attrs.contents) }; and pass textAttrs to the Text component.

Changes

  • src/components/svgs/nodes/i18n-text.tsx (modified)
  • src/components/page-header/global-alerts.tsx (modified)

tomaioo added 2 commits May 22, 2026 23:22
- Security: Prototype Pollution via Object Mutation in I18nText Component
- Security: Unsafe URL Construction with User-Controlled Data in GlobalAlerts

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
- Security: Prototype Pollution via Object Mutation in I18nText Component
- Security: Unsafe URL Construction with User-Controlled Data in GlobalAlerts

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant