-
Notifications
You must be signed in to change notification settings - Fork 458
Centralize and Fix DOMPurify Sanitizer #1544
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
Open
Zachary-Squires
wants to merge
84
commits into
OpenEnergyDashboard:development
Choose a base branch
from
Andrew-Bonner:development
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+781
−472
Open
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
62035d5
Create README.md
Zachary-Squires 794d464
Create thing-in-docs-folder
Zachary-Squires 4ea1a46
add a file for team meeting schedule
Andrew-Bonner aca1a74
Update thing-in-docs-folder
Zachary-Squires 2627f0e
Merge branch 'main' of https://github.com/CS495-Fall2025/Team-5
Zachary-Squires 23bca3d
Adding the commit from 1488 called "fix: resolved PR feedback on sani…
Landon-Wivell bacc35d
feat(security): centralize DOMPurify sanitizer and patch XSS in succe…
Landon-Wivell 979c3de
Added the commit from 1488 called "feat(security): centralize DOMPuri…
Zachary-Squires 7cfcb79
fix: resolved PR feedback on sanitizer imports and tests
Landon-Wivell e642e0e
Ran npm install, should bring jsdom and dompurify
Zachary-Squires 7cb2438
Restore executable permissions on scripts and binaries
Zachary-Squires 2ceee19
Merge pull request #1 from Andrew-Bonner/team_b
Zachary-Squires c24d3c4
Normalize all line endings to LF
Zachary-Squires f38a83e
Merge pull request #2 from Andrew-Bonner/team_b
Zachary-Squires ad31fd0
Change to not allow default postgres or secret token in OED production.
Zachary-Squires 2ba98fc
Merge branch 'OpenEnergyDashboard:development' into team_b
Zachary-Squires f5d6ce0
Merge branch 'team_b' of https://github.com/Andrew-Bonner/OED into te…
Zachary-Squires 489cc17
Merge pull request #3 from Andrew-Bonner/team_b
Zachary-Squires 3c3b6cc
Fix PR suggestions
Zach-O-Bates 6eb6d29
Revert "Merge pull request #3 from Andrew-Bonner/team_b"
Zachary-Squires 7611ae5
Merge branch 'team_b' into development
Zach-O-Bates 040f138
Simplify test to better align with mentor suggestions
Zach-O-Bates da2dd00
Update .gitattributes
Zachary-Squires 5a40623
Update docker-compose.yml
Zachary-Squires 9acd4b6
Update jsdom package
Zach-O-Bates c03723a
Addressing Suggestions for PR 1544
Zachary-Squires 533c588
Mark cron scripts as executable
Zachary-Squires df29aaa
Mark docker-compose.yml as executable
Zachary-Squires 80382e2
Update docker-compose.yml
Zachary-Squires fea6028
try to resolve some blank line change issues
huss 2ba9168
Merge remote-tracking branch 'origin/development' into pr/Zachary-Squ…
huss 6ca696c
revert dompurify & jsdom versions
huss 29be1dc
fix so check header ignores new CSV file
huss e48479f
Add meeting times to team_schedule
Zach-O-Bates e49ef60
Add final presentation date to team schedule
Zach-O-Bates a4d4e02
Enhance README with project details and contributors
Zach-O-Bates 139a958
Adjust file structure according to the Github folder document
Zach-O-Bates 92f084b
Delete .DS_Store
Zach-O-Bates c365ac0
Create the team and client folders for meeting notes
Zach-O-Bates 1978591
Merge branch 'main' of https://github.com/CS495-Fall2025/Team-5
Zach-O-Bates 33adcec
Summarize and organize first client meeting notes
Zach-O-Bates 9751b9f
Add notes from client meeting on September 17, 2025
Zach-O-Bates f04df81
Rename 9-17-2025-ClientMeeting to 9-17-2025-ClientMeeting.md
Zach-O-Bates f6d65e3
Rename client meeting document for consistency
Zach-O-Bates 3a8d079
Add notes from the client meeting on September 22, 2025
Zach-O-Bates 37b746d
Update and rename team_schedule to team_schedule.md
Zach-O-Bates 1eb48d5
Fix typo in presentation date heading
Zach-O-Bates 80c2ec2
Add meeting notes for client meeting on 10-01-2025
Zach-O-Bates baf5dc7
Removed meeting 10-01 from a mistakenly created folder
Zach-O-Bates c2d1d73
Add client meeting notes for October 8, 2025
Zach-O-Bates 1d8fabe
Add notes for October 15, 2025 Client Meeting
Zach-O-Bates e9f7466
Adjust folder structure in client meetings
Zach-O-Bates 61c4b30
Added test for the second route in crossSite.js
Zach-O-Bates ee55196
updated the expected to be a status code 401
Andrew-Bonner bd0068a
Add files via upload
Andrew-Bonner 7a6554c
Create 10-22-2025-ClientMeeting.md
Andrew-Bonner cf32365
Create 10-29-2025-ClientMeeting.md
Zach-O-Bates 2b0c4f5
Create 11-5-2025-ClientMeeting.md
Zach-O-Bates 767e1cf
Create 11-12-2025-ClientMeeting.md
Zach-O-Bates d56f5e5
Create 11-19-2025-ClientMeeting.md
Zach-O-Bates 053867e
Create 11-26-2025-ClientMeeting.md
Zach-O-Bates fbee51f
Create 12-3-2025-ClientMeeting.md
Zach-O-Bates 745b22c
Update 10-22-2025-ClientMeeting.md
Andrew-Bonner abd89ad
Update 10-29-2025-ClientMeeting.md
Andrew-Bonner 3e343d4
Update 11-12-2025-ClientMeeting.md
Andrew-Bonner a51091a
Add notes for 11-5-2025 Client Meeting
Zach-O-Bates b821692
Revise client meeting notes for 11-5-2025
Zach-O-Bates d01e164
Add notes for client meeting on November 12, 2025
Zach-O-Bates 319649c
Add meeting notes for client meeting on 12-3-2025
Zach-O-Bates 8fe87d1
Update 11-19-2025-ClientMeeting.md
Andrew-Bonner 05f92eb
Merge branch 'OpenEnergyDashboard:development' into development
Zach-O-Bates 4ce2e1d
Create Meeting-Minutes folder for weekly notes
Oykunle 5f0572f
weekly meeting notes (Weeks 1–9)
Oykunle e1fecf6
Create risk-log.md
BrianRaymond800 6040351
Update risk-log.md
BrianRaymond800 d3e3e86
Move meeting minutes into the team meeting folder and add UML diagrams
Zach-O-Bates e91c33b
Move risk log into the documents folder
Zach-O-Bates fa02303
Add communication plan document
Zach-O-Bates f28e5da
Add meeting notes for 09/01/2026
Oykunle 148d882
Add meeting notes for 09/01/2026
Oykunle 73b39d8
Remove the multiple instances of xss indicators
Zach-O-Bates 45ff19e
Merge remote-tracking branch 'team5/main' into development
Zach-O-Bates 70fd5fa
Revert "Merge remote-tracking branch 'team5/main' into development"
Zach-O-Bates b3baabe
Merge branch 'OpenEnergyDashboard:development' into development
Andrew-Bonner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| const { JSDOM } = require('jsdom'); | ||
huss marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const createDOMPurify = require('dompurify'); | ||
|
|
||
| // Create jsdom window application and initialize | ||
| const window = new JSDOM('').window; | ||
| const DOMPurify = createDOMPurify(window); | ||
|
|
||
| module.exports = DOMPurify; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| /* This file tests the functionality of the DOMPurify library. It tests for XSS | ||
| vulnerabilities in HTML of user uploaded data.*/ | ||
|
|
||
| /* Run in OED Docker web container terminal/shell: | ||
| npm run testsome src/server/test/crossSite/crossSite.js */ | ||
| const { chai, mocha, expect, app, testUser } = require('../common'); | ||
| const xssIndicators = [ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for changing so only one version. How about moving it right below the mocha.describe so it isn't globally scoped? |
||
| 'onerror', | ||
| 'alert', | ||
| 'document.domain', | ||
| '<script', | ||
| 'javascript:', | ||
| 'onload', | ||
| 'onclick', | ||
| '<iframe' | ||
| ]; | ||
|
|
||
| mocha.describe('Cross site', () => { | ||
|
|
||
| mocha.it('Test for sanitization of HTML', async () => { | ||
| const filePath = 'src/server/test/crossSite/readings.csv'; | ||
|
|
||
| const res = await chai.request(app).post('/api/csv/readings') | ||
| .field('email', testUser.username) | ||
| .field('password', testUser.password) | ||
| /* This next line should produce: | ||
| res.text: <h1>FAILURE</h1>CSVPipelineError: | ||
| User Error: Meter with name '<img src="x">' not found. | ||
| */ | ||
| .field('meterName', '<img src=x onerror="alert(document.domain)">') | ||
| .field('gzip', "no") | ||
| .attach('csvfile', 'src/server/test/crossSite/something.csv'); | ||
|
|
||
| expect(res).to.have.status(400); | ||
| expect(res.text).to.include('<img src="x">'); | ||
|
|
||
| xssIndicators.forEach(indicator => { | ||
| expect(res.text, `Output should not contain ${indicator}`).to.not.include(indicator); | ||
| }); | ||
| }); | ||
|
|
||
| mocha.it('Test for sanitization of login HTML in username', async () => { | ||
| const res = await chai.request(app) | ||
| .post('/api/login') | ||
| .send({ | ||
| username: '<img src=x onerror="alert(1)">', | ||
| password: 'password123' | ||
| }); | ||
| expect(res).to.have.status(401); | ||
|
|
||
| xssIndicators.forEach(indicator => { | ||
| expect(res.text, `Output should not contain ${indicator}`).to.not.include(indicator); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1,2,3 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.