🛡️ Sentinel: [MEDIUM] Fix JavaScript injection in DomMixin#40
🛡️ Sentinel: [MEDIUM] Fix JavaScript injection in DomMixin#40ToufiqQureshi wants to merge 1 commit intomainfrom
Conversation
- Identified and fixed a JavaScript injection vulnerability in `chuscraper/core/tabs/dom.py`. - Replaced unsanitized f-string interpolation of `selector` with `json.dumps(selector)` in JavaScript templates. - Explicitly cast `idx` to `int` in `query_selector_all` for improved robustness. - Verified fix with reproduction and verification scripts. - Updated Sentinel journal with findings and prevention strategies. Co-authored-by: ToufiqQureshi <139612256+ToufiqQureshi@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
I have addressed a security vulnerability in
chuscraper/core/tabs/dom.pywhere CSS selectors were being injected into JavaScript templates using unsanitized string interpolation within backticks (`). This could have allowed a malicious user-provided selector to execute arbitrary JavaScript in the browser context.The fix involves using
json.dumps(selector)to safely escape the selector as a standard JavaScript string literal and removing the problematic backticks. Additionally, I've hardened thequery_selector_allmethod by explicitly casting theidxvariable to an integer.Verification was performed using a reproduction script that demonstrated the breakout before the fix and confirmed successful escaping after the fix. Existing core tests were verified for compilation.
Details:
json.dumps()and removal of template literal backticks.final_verify.pyconfirmed the fix.PR created automatically by Jules for task 15747334358977430641 started by @ToufiqQureshi