-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactors all bad usage of innerHTML out of our codebase #7242
Conversation
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.
This looks great. I'm going to ask @ozyx to review as he implemented this originally for the main code path.
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.
This looks good to me overall, but I would recommend pulling the changes to implement eslint-plugin-no-unsanitized
as well to prevent this in the future. Tests are also failing for some CI-related reason.
@@ -418,7 +421,10 @@ export default { | |||
// Have to throw away the old canvas elements and replace with new | |||
// canvas elements in order to get new drawing contexts. | |||
const div = document.createElement('div'); | |||
div.innerHTML = this.canvasTemplate + this.canvasTemplate; | |||
div.innerHTML = ` | |||
<canvas style="position: absolute; background: none; width: 100%; height: 100%;"></canvas> |
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.
what about this innerhtml?
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.
The vulnerability arises not just from assignment to innerHTML, but when that assignment contains variables that could potentially store user input. It can expose the app at some level to cross site scripting. So this one should be OK.
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.
Got it
This branch will dead end and in the next release we'll pick up from the main Open MCT so I'm going to merge this, @ozyx |
Closes
Describe your changes:
Applying these changes: #7144 to the base version of Open MCT used in OMM.
Functionality to Verify:
All Submissions:
Author Checklist
Reviewer Checklist