-
Notifications
You must be signed in to change notification settings - Fork 0
Add DOMPurify to address XSS issues; closes #420 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: base-sha/e1a3fa6b6cbc4536d5519f2aa347e03178ccb050
Are you sure you want to change the base?
Conversation
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
|
This is a benchmark review for experiment This pull request was cloned from Experiment configurationreview_config:
# User configuration for the review
# - benchmark - use the user config from the benchmark reviews
# - <value> - use the value directly
user_config:
enable_ai_review: true
enable_rule_comments: false
enable_complexity_comments: benchmark
enable_docstring_comments: benchmark
enable_security_comments: benchmark
enable_tests_comments: benchmark
enable_comment_suggestions: benchmark
enable_approvals: true
ai_review_config:
# The model responses to use for the experiment
# - benchmark - use the model responses from the benchmark reviews
# - llm - call the language model to generate responses
model_responses:
comments_model: benchmark
comment_validation_model: benchmark
comment_suggestion_model: benchmark
complexity_model: benchmark
docstrings_model: benchmark
security_model: benchmark
tests_model: benchmark
# The pull request dataset to run the experiment on
pull_request_dataset:
- https://github.com/erxes/erxes/pull/5153
- https://github.com/0ussamaBernou/my-portfolio/pull/6
- https://github.com/strawberry-graphql/strawberry/pull/3467
- https://github.com/shreejitverma/MScFE690-Capstone/pull/6
- https://github.com/gdsfactory/kfactory/pull/298
- https://github.com/2lambda123/kwenta/pull/50
- https://github.com/EduardSchwarzkopf/pecuny/pull/128
- https://github.com/ElectronicBabylonianLiterature/ebl-api/pull/546
- https://github.com/ShiroePL/EasternTalesShelf/pull/44
- https://github.com/kloudlite/web/pull/195
- https://github.com/dciborow/action-pylint/pull/14
- https://github.com/4DNucleome/PartSeg/pull/1099
- https://github.com/nbhirud/nbhirud.github.io/pull/6
- https://github.com/EduardSchwarzkopf/pecuny/pull/129
- https://github.com/Xmaster6y/mulsi/pull/17
- https://github.com/shreejitverma/MScFE690-Capstone/pull/5
- https://github.com/zen-audio-player/zen-audio-player.github.io/pull/431
- https://github.com/Xmaster6y/mulsi/pull/15
- https://github.com/LunaPurpleSunshine/ipget/pull/196
- https://github.com/erxes/erxes/pull/5152
- https://github.com/ShiroePL/EasternTalesShelf/pull/45
- https://github.com/LunaPurpleSunshine/ipget/pull/195
- https://github.com/osama1998H/spms/pull/56
- https://github.com/gdsfactory/gdsfactory/pull/2694
- https://github.com/shreejitverma/MScFE690-Capstone/pull/4
- https://github.com/albumentations-team/albumentations/pull/1679
- https://github.com/osama1998H/spms/pull/57
- https://github.com/CPUT-DEVS/devpost-hackathon/pull/29
- https://github.com/Amm1rr/WebAI-to-API/pull/31
- https://github.com/DevCycleHQ/go-server-sdk/pull/248
- https://github.com/0ussamaBernou/my-portfolio/pull/8
- https://github.com/LunaPurpleSunshine/ipget/pull/194
- https://github.com/jackdewinter/pymarkdown/pull/1061
- https://github.com/osism/python-osism/pull/869
- https://github.com/nbhirud/nbhirud.github.io/pull/5
- https://github.com/CPUT-DEVS/devpost-hackathon/pull/28
- https://github.com/yaitoo/sqle/pull/41
- https://github.com/gdsfactory/kfactory/pull/300
- https://github.com/osama1998H/spms/pull/55
- https://github.com/shreejitverma/MScFE690-Capstone/pull/7
- https://github.com/nbhirud/system_update/pull/18
- https://github.com/jackdewinter/pymarkdown/pull/1060
- https://github.com/strawberry-graphql/strawberry/pull/3469
- https://github.com/Xmaster6y/mulsi/pull/18
- https://github.com/jkool702/openwrt/pull/41
- https://github.com/nbhirud/nbhirud.github.io/pull/4
- https://github.com/NoobInDaHause/NoobCogs/pull/13
- https://github.com/UCL/dxss/pull/63
- https://github.com/nbhirud/nbhirud.github.io/pull/3
- https://github.com/nbhirud/system_update/pull/17
review_comment_labels:
- label: correct
question: Is this comment correct?
- label: helpful
question: Is this comment helpful?
- label: comment-type
question: Is the comment type correct?
- label: comment-area
question: Is the comment area correct?
- label: llm-test
question: Should this comment become an LLM test?
# Benchmark reviews generated by running
# python -m scripts.experiment benchmark <experiment_name>
benchmark_reviews: []
|
SourceryAI
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @sourcery-ai-experiments-bot - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Docstrings: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
| const { | ||
| entries, | ||
| setPrototypeOf, | ||
| isFrozen, | ||
| getPrototypeOf, | ||
| getOwnPropertyDescriptor, | ||
| } = Object; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code_refinement): Consider destructuring directly in the import statement for clarity.
Destructuring directly in the import statement can make the code cleaner and more readable by reducing the need for additional destructuring assignments inside the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment helpful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment type correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment area correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this comment become an LLM test?
| it("should load DOMPurify and sanitize", async function() { | ||
| const page = await browser.newPage(); | ||
| await page.goto(indexHTMLURL); | ||
|
|
||
| const dp = await page.evaluate(() => { | ||
| return Object.keys(window).includes("DOMPurify"); | ||
| }); | ||
| assert.ok(dp, "DOMPurify should be loaded on the page."); | ||
|
|
||
| const sanitizedOutput = await page.evaluate(() => { | ||
| const dirty = "<img src=\"x\" onerror=\"alert(1)\">"; | ||
| return window.DOMPurify.sanitize(dirty); | ||
| }); | ||
| assert.strictEqual(sanitizedOutput, "<img src=\"x\">", "DOMPurify should sanitize malicious scripts correctly."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Consider adding more test cases for DOMPurify.
It's great to see tests for basic DOMPurify functionality. Consider adding more cases to cover different types of XSS payloads and tag combinations to ensure robust sanitization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment helpful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment type correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment area correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this comment become an LLM test?
Closes zen-audio-player#420