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 #175

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

legobeat
Copy link
Contributor

@legobeat legobeat commented Oct 8, 2024

To fix the problem, we need to extend the disallowedProtocols array to include data: and vbscript: schemes. This ensures that URLs with these schemes are also considered invalid, thereby enhancing the security of the URL validation logic.

  • Modify the disallowedProtocols array to include data: and vbscript: schemes.
  • Ensure that the isValidSuspectHref function correctly identifies these schemes as disallowed.

Related

@legobeat legobeat force-pushed the autofix/alert-1-051a239a5a branch from 0f3c1a6 to 57aadb1 Compare October 8, 2024 03:50
@legobeat legobeat changed the title Fix code scanning alert no. 1: Incomplete URL scheme check fix: Incomplete URL scheme check Oct 8, 2024
@legobeat legobeat marked this pull request as ready for review October 8, 2024 03:53
@legobeat legobeat requested review from 409H and a team October 8, 2024 03:54
@NicholasEllul NicholasEllul requested a review from a team October 23, 2024 15:31
@@ -87,7 +87,7 @@ function setupOpenSelfInNewTabLink() {
*/
function isValidSuspectHref(href: string) {
/* eslint-disable-next-line */
const disallowedProtocols = ['javascript:'];
const disallowedProtocols = ['javascript:', 'data:', 'vbscript:'];
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

@legobeat legobeat force-pushed the autofix/alert-1-051a239a5a branch from 9b25752 to f2eb0a1 Compare October 23, 2024 16:22
@legobeat legobeat merged commit 179980b into main Oct 23, 2024
19 checks passed
@legobeat legobeat deleted the autofix/alert-1-051a239a5a branch October 23, 2024 16:34
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.

2 participants