Skip to content
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

replace innerHTML in showErrorMarker #5574

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

dimovpetar
Copy link
Contributor

Make showErrorMarker CSP compliant.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Pull Request Checklist:

Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.79%. Comparing base (f6a8d37) to head (d23582e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5574   +/-   ##
=======================================
  Coverage   86.79%   86.79%           
=======================================
  Files         594      594           
  Lines       43126    43129    +3     
  Branches     7148     7149    +1     
=======================================
+ Hits        37431    37434    +3     
  Misses       5695     5695           
Flag Coverage Δ
unittests 86.79% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nightwing
Copy link
Member

Looks like this will escape the html twice, because it is escaped in

annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";

and the tooltip uses innerHTML as well
this.setHtml(tooltipContent);

@dimovpetar
Copy link
Contributor Author

I guess this PR can be merged after #5575 is resolved then. Or do you have any proposals how to avoid this issue?

@@ -122,7 +122,12 @@ exports.showErrorMarker = function(editor, dir) {

w.el.className = "error_widget_wrapper";
el.className = "error_widget " + gutterAnno.className;
el.innerHTML = gutterAnno.text.join("<br>");
gutterAnno.text.forEach(function (annoTextLine, i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that #5602 has been merged you should be able to use gutterAnno.displayText here to avoid issues with the text being escaped twice and being rendered incorrectly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
I also adapted line 101.

@dimovpetar dimovpetar requested a review from akoreman July 8, 2024 11:31
@akoreman akoreman merged commit 1bad1a1 into ajaxorg:master Jul 8, 2024
3 checks passed
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.

3 participants