Skip to content

Potential fix for code scanning alert no. 21: Incomplete URL scheme check#2765

Closed
nperez0111 wants to merge 2 commits into
mainfrom
alert-autofix-21
Closed

Potential fix for code scanning alert no. 21: Incomplete URL scheme check#2765
nperez0111 wants to merge 2 commits into
mainfrom
alert-autofix-21

Conversation

@nperez0111
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/TypeCellOS/BlockNote/security/code-scanning/21

The best fix is to explicitly block all known dangerous executable schemes in this sanitizer, not just javascript:.
Without changing existing behavior otherwise, update the condition in packages/react/src/util/sanitizeUrl.ts so the function only returns url.href when the protocol is not any of: javascript:, data:, vbscript:. For blocked schemes (or parse errors), continue returning "#" exactly as now.

Concretely, edit the if on line 12 region to include all three checks. No new imports, methods, or dependencies are required.

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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview May 21, 2026 6:58am
blocknote-website Ready Ready Preview May 21, 2026 6:58am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2bae65f-c7d6-4cb1-bcbd-50b3cd71e990

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch alert-autofix-21

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The multi-line if condition moved the 'javascript:' string to a line
no longer covered by the eslint-disable-next-line directive. Move the
comment inside the if condition so it correctly suppresses no-script-url
on the line containing the string literal.
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.

1 participant