Skip to content

Potential fix for code scanning alert no. 3: Prototype-polluting assignment#17

Merged
owenrumney merged 1 commit intomainfrom
alert-autofix-3
Apr 30, 2026
Merged

Potential fix for code scanning alert no. 3: Prototype-polluting assignment#17
owenrumney merged 1 commit intomainfrom
alert-autofix-3

Conversation

@owenrumney
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/owenrumney/go-lsp/security/code-scanning/3

Use a key/value structure that is safe for untrusted keys. The best minimal fix here is to change entryById from plain-object indexing to a Map, and update all reads/writes in this file to set/get so special keys like __proto__ are treated as normal map keys and cannot affect prototypes.

In internal/debugui/static/index.html, update:

  • entryById[e.id] = e;entryById.set(e.id, e);
  • const req = entryById[e.pairedWith];const req = entryById.get(e.pairedWith);

Also update the entryById initialization line in the shown file to new Map() (wherever it is currently declared as {} in this file). This preserves behavior while removing prototype-pollution risk.

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

…gnment

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@owenrumney owenrumney marked this pull request as ready for review April 30, 2026 20:09
@owenrumney owenrumney merged commit 84bc949 into main Apr 30, 2026
8 checks passed
@owenrumney owenrumney deleted the alert-autofix-3 branch April 30, 2026 20:12
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