-
Notifications
You must be signed in to change notification settings - Fork 916
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
Bump highlight.js from 9.18.5 to 10.7.3 to solve security concerns #4045
Merged
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## 1.x #4045 +/- ##
==========================================
- Coverage 67.50% 67.50% -0.01%
==========================================
Files 3044 3044
Lines 58692 58692
Branches 8902 8902
==========================================
- Hits 39621 39619 -2
- Misses 16923 16925 +2
Partials 2148 2148
Flags with carried forward coverage won't be shown. Click here to find out more. |
ananzh
requested review from
kavilla,
seanneumann,
AMoo-Miki,
ashwin-pc,
joshuarrrr,
abbyhu2000,
zengyan-amazon,
kristenTian,
zhongnansu and
manasvinibs
as code owners
May 16, 2023 22:09
Signed-off-by: ananzh <ananzh@amazon.com>
ananzh
changed the title
Bump highlight.js from
Bump highlight.js from May 18, 2023
9.18.5
to 10.4.1
to solve security concerns9.18.5
to 10.7.3
to solve security concerns
ananzh
changed the title
Bump highlight.js from
Bump highlight.js from 9.18.5 to 10.7.3 to solve security concerns
May 18, 2023
9.18.5
to 10.7.3
to solve security concerns
abbyhu2000
approved these changes
May 18, 2023
AMoo-Miki
approved these changes
May 18, 2023
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-1.x 1.x
# Navigate to the new working tree
pushd ../.worktrees/backport-1.x
# Create a new branch
git switch --create backport/backport-4045-to-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d71c377ad8ae4d48579dff32d63de5e9679479b1
# Push it to GitHub
git push --set-upstream origin backport/backport-4045-to-1.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-1.x Then, create a pull request where the |
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 highlight.js package is a syntax highlighter for web and node.js. The minimum version required to solve this security concern for
highlight.js is
10.4.1. Currently,osd-ui-framework
is using 9.18.5.In OpenSearch Dashboards, highlight.js is directly called below:
In the above code snippet,
highlight.js
is used to highlight code blocks in a React component namedGuideCodeViewer
. ThehighlightBlock
method takes a DOM node and highlights the text within it according to the language of the code .Since there are over 300+ commits between highlight
9.18.5
and10.4.1
. It is hard to determine whether there are breaking changes. Let’s instead compare withhighlightBlock
function definitions from these two versions 10.4.1 https://github.com/highlightjs/highlight.js/blob/e96b915af70d1c3f014b732c10e7cd077f22b9c3/src/highlight.js#L676 and 9.18.5 https://github.com/highlightjs/highlight.js/blob/f54e96c24325f077a027bb950dcd9f8f3ef48b16/src/highlight.js#L907.before:highlightBlock
andafter:highlightBlock
are fired. From the above code snippet in OpenSearch Dashboards, we do not appear to use these events, so this change is unlikely to affect us.Based on this analysis, there doesn't appear to be any breaking changes in the highlightBlock function between the two versions. So the fix could just be bump the package to 10.4.1.
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr