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

fix: Incomplete URL scheme check in marked.js #828

Closed
wants to merge 1 commit into from
Closed

Conversation

sebthom
Copy link
Member

@sebthom sebthom commented Nov 6, 2024

Fixes https://github.com/eclipse-tm4e/tm4e/security/code-scanning/2

To fix the problem, we need to extend the URL scheme check to include data: in addition to javascript: and vbscript:. This will ensure that URLs with potentially harmful schemes are properly sanitized. The best way to fix this without changing existing functionality is to modify the condition on line 878 to also check for data: schemes.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@sebthom sebthom changed the title Fix code scanning alert no. 2: Incomplete URL scheme check fix: Incomplete URL scheme check in marked.js Nov 6, 2024
@sebthom sebthom marked this pull request as ready for review November 6, 2024 12:12
@github-actions github-actions bot added the bug label Nov 6, 2024
@angelozerr
Copy link
Contributor

You can remove this marked.js

I did that a long time ago to play with marked.js with the marked.html file.

Indeed I had ported the markdown.js to Java to try to have the same renderer than vscode.

@sebthom
Copy link
Member Author

sebthom commented Nov 6, 2024

Ok thanks for the info!

@sebthom sebthom closed this Nov 6, 2024
@angelozerr
Copy link
Contributor

angelozerr commented Nov 6, 2024

Just to give you some info about this tm4e markdown plugin.

My goal was to have the same renderer than vscode to support hover (in LSP4E for instance). It is the reason why I have translated marked.js in Java because it is used in vscode.

And the nice thing is that markdown code block is managed with TM4E tokenizer, it means that it uses textmate to manage syntax coloration in hover.

I had used this marked Java port in my very old project at https://github.com/angelozerr/typescript.java/blob/8a6759ca825c2b0ae14cb8e09e5ba1778aae24d3/eclipse/ts.eclipse.ide.ui/src/ts/eclipse/ide/ui/utils/HTMLTypeScriptPrinter.java#L86

I know that LSP4E uses highlight.js to manage syntax coloration for code block but IMHO I think it should be better to use TM4E.

@sebthom
Copy link
Member Author

sebthom commented Nov 6, 2024

This relates to #286 right?

@angelozerr
Copy link
Contributor

This relates to #286 right?

Yes:) I have forgotten that we have already a discussion about that

@sebthom sebthom deleted the alert-autofix-2 branch November 15, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants