fix: sanitize error message, escape characters, add nonce, render as innerText [IDE-967]#273
Merged
bastiandoetsch merged 5 commits intomainfrom Mar 25, 2025
Conversation
ShawkyZ
reviewed
Mar 17, 2025
| private final Map<String, String> colorCache = new HashMap<>(); | ||
| private String nonce = ""; | ||
|
|
||
| private byte ASCII_RANGE = 0x7F; |
Check warning
Code scanning / PMD
Avoid unused private fields such as 'ASCII_RANGE'. Warning
|
|
||
| public String getErrorHtml(String errorMessage, String path) { | ||
| var html = """ | ||
| if (errorMessage == null) errorMessage = "Unknown error"; |
Check warning
Code scanning / PMD
Avoid reassigning parameters such as 'path' Warning
| public String getErrorHtml(String errorMessage, String path) { | ||
| var html = """ | ||
| if (errorMessage == null) errorMessage = "Unknown error"; | ||
| if (path == null) path = "Unknown path"; |
Check warning
Code scanning / PMD
Avoid reassigning parameters such as 'path' Warning
bastiandoetsch
approved these changes
Mar 25, 2025
Contributor
|
@DariusZdroba , please fix the linter stuff and then we'll merge it in :) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
The error messages rendered in Eclipse could potentially contain HTML or scripts which could be rendered as part of the panel ( no resources were accessible through the scripts but still should not happen )
To fix this, the following measures have been applied:
Content-Security-Policyin the headers, only scripts which have the randomly setnoncewill run.StringEscapeUtilsChecklist
Screenshots / GIFs
Visuals that may help the reviewer. Please add screenshots for any UI change. GIFs are most welcome!