Skip to content

🛡️ Sentinel: [CRITICAL] Fix Prototype Pollution vulnerability in label dictionary#33

Open
ericbfriday wants to merge 1 commit into
masterfrom
sentinel-fix-prototype-pollution-16078060755960758820
Open

🛡️ Sentinel: [CRITICAL] Fix Prototype Pollution vulnerability in label dictionary#33
ericbfriday wants to merge 1 commit into
masterfrom
sentinel-fix-prototype-pollution-16078060755960758820

Conversation

@ericbfriday
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
đź’ˇ Vulnerability: A prototype pollution vulnerability existed in luaparse.js where the labels dictionary for the flow context scope was initialized using a standard object literal {}. This allows a malicious Lua script with labels named after Object prototype properties (e.g., ::__proto__::) to pollute the Javascript prototype and cause unexpected behaviour or logic bypasses in the lexer and surrounding ecosystem.
🎯 Impact: Denial of Service (DoS) and potential logic corruption depending on how the parsed AST is consumed by applications, as arbitrary properties on Object.prototype could be overridden or instantiated.
đź”§ Fix: Initialized the labels dictionary using Object.create ? Object.create(null) : {} to safely construct a dictionary without inheriting from Object.prototype. Added a learning to .jules/sentinel.md.
âś… Verification: Create a script initializing the parser and passing a Lua source like ::__proto__::. It should not crash or throw exceptions internally. Run npm run test to verify parser functionality remains unaltered.


PR created automatically by Jules for task 16078060755960758820 started by @ericbfriday

…l dictionary

- Replaced plain object literal with `Object.create ? Object.create(null) : {}` for labels dictionary initialization.
- Added Sentinel journal entry in `.jules/sentinel.md` noting the vulnerability and prevention.
Copilot AI review requested due to automatic review settings May 26, 2026 23:39
@google-labs-jules
Copy link
Copy Markdown

đź‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a đź‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a security issue in luaparse.js by preventing prototype-related key collisions/mutation in the internal labels dictionary used for Lua 5.2+ goto / label flow tracking, and records the incident in a Sentinel learning log.

Changes:

  • Initialize FullFlowContext’s scope.labels with a null-prototype dictionary (Object.create(null)) instead of {}.
  • Add .jules/sentinel.md documenting the prototype-pollution class of issue and the preferred prevention strategy.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
luaparse.js Switches labels from a plain object to a prototype-less dictionary to avoid __proto__-style key hazards.
.jules/sentinel.md Adds a Sentinel entry describing the vulnerability and the intended prevention approach.

đź’ˇ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread luaparse.js
Comment on lines 1676 to 1678
var scope = {
labels: {},
labels: Object.create ? Object.create(null) : {},
locals: [],
Comment thread luaparse.js
Comment on lines 1676 to 1678
var scope = {
labels: {},
labels: Object.create ? Object.create(null) : {},
locals: [],
Comment thread .jules/sentinel.md
## 2024-05-27 - [Prototype Pollution in Lua labels dictionary]
**Vulnerability:** A prototype pollution vulnerability existed in `luaparse.js` where the `labels` dictionary for the flow context scope was initialized using a standard object literal `{}`. This allows a malicious Lua script with labels named after Object prototype properties (e.g., `::__proto__::`) to pollute the Javascript prototype and cause Denial of Service or logic bypasses in the lexer and surrounding ecosystem.
**Learning:** In Javascript parsers analyzing user-provided identifiers and labels, using plain object literals as dictionaries is unsafe as properties like `__proto__` can be accessed or overwritten.
**Prevention:** Always initialize dictionaries storing user-controlled keys using `Object.create(null)` to create a prototype-less object, ensuring secure property assignments and lookups. Due to the environment potentially missing polyfills, a secure fallback `Object.create ? Object.create(null) : {}` should be used.
Comment thread .jules/sentinel.md
Comment on lines +2 to +3
**Vulnerability:** A prototype pollution vulnerability existed in `luaparse.js` where the `labels` dictionary for the flow context scope was initialized using a standard object literal `{}`. This allows a malicious Lua script with labels named after Object prototype properties (e.g., `::__proto__::`) to pollute the Javascript prototype and cause Denial of Service or logic bypasses in the lexer and surrounding ecosystem.
**Learning:** In Javascript parsers analyzing user-provided identifiers and labels, using plain object literals as dictionaries is unsafe as properties like `__proto__` can be accessed or overwritten.
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.

2 participants