Skip to content

🛡️ Sentinel: [CRITICAL] Fix prototype pollution in Lua labels#25

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

🛡️ Sentinel: [CRITICAL] Fix prototype pollution in Lua labels#25
ericbfriday wants to merge 1 commit into
masterfrom
sentinel-fix-prototype-pollution-15110526690881242223

Conversation

@ericbfriday
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
💡 Vulnerability: Prototype pollution in luaparse.js where user-supplied Lua labels could be abused to poison the global Object.prototype.
🎯 Impact: This could allow arbitrary properties to be injected into the application causing unexpected behavior, potential Denial of Service (DoS), or potentially remote code execution if other gadgets exist.
🔧 Fix: Initialized the labels scope dictionary with Object.create(null) instead of an object literal, effectively removing the prototype chain.
✅ Verification: npm run build:packages and npm run test pass successfully.


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

- Changed initialization of `labels` from `{}` to `Object.create ? Object.create(null) : {}` to prevent prototype pollution via user-supplied string keys.
- Added a comment indicating the security mitigation.
- Documented findings in `.jules/sentinel.md`.
@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.

Copilot AI review requested due to automatic review settings May 23, 2026 00:00
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 mitigates a prototype-pollution vector in Lua label handling by changing the internal labels dictionary initialization to use a null-prototype object, and documents the security finding for future reference.

Changes:

  • Initialize FullFlowContext’s labels dictionary with a null prototype to avoid special keys like __proto__ affecting dictionary behavior.
  • Add an inline security comment in luaparse.js describing the mitigation.
  • Add a Sentinel/security writeup documenting the finding and prevention guidance.

Reviewed changes

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

File Description
luaparse.js Switches the labels dictionary initialization to a null-prototype object to mitigate prototype pollution via label names.
.jules/sentinel.md Documents the vulnerability and recommended prevention approach.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread luaparse.js
var scope = {
labels: {},
// Securely initialize the labels dictionary to prevent prototype pollution via user-supplied Lua labels (e.g., `::__proto__::`)
labels: Object.create ? Object.create(null) : {},
Comment thread luaparse.js
Comment on lines +1677 to +1678
// Securely initialize the labels dictionary to prevent prototype pollution via user-supplied Lua labels (e.g., `::__proto__::`)
labels: Object.create ? Object.create(null) : {},
Comment thread .jules/sentinel.md
Comment on lines +2 to +4
**Vulnerability:** Prototype pollution vulnerability found in how `luaparse.js` handles labels. Lua label nodes were collected into a plain JavaScript object (`{}`) dictionary. When parsed, Lua labels with the name `__proto__` can be abused to poison the global `Object.prototype`.
**Learning:** Dictionaries storing user-supplied string keys must not be instantiated as plain object literals (`{}`) since it allows accessing and modifying the object prototype via `__proto__`.
**Prevention:** In environments where we store user-supplied string keys as dictionary keys, objects must be initialized securely. Use `Object.create ? Object.create(null) : {}` as a safer fallback to create a dictionary without a prototype chain, preventing prototype pollution. No newline at end of file
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