Skip to content

fix: implement validation URL to block XSS and invalid links - #1012

Merged
Spiral-Memory merged 1 commit into
RocketChat:developfrom
Khizarshah01:fix-url-validation
Sep 21, 2025
Merged

Spiral-Memory merged 1 commit into
RocketChat:developfrom
Khizarshah01:fix-url-validation

Conversation

@Khizarshah01

Copy link
Copy Markdown
Contributor

Security Fix: URL Validation in InsertLinkToolBox

Acceptance Criteria fulfillment

  • Added URL validation using isUrl
  • Blocked dangerous schemes (javascript:, data:, etc.)
  • Added visual feedback for invalid URLs

Fixes #1010
#1011

Video/Screenshots

Given video in issue #1010

Technical Changes

  1. Added validator lib and use isUrl function that checks whether the URL is valid or not.
  2. Modified InsertLinkToolBox to:
  • Disable "Add" button for invalid URLs
  • Show error message for bad inputs
  • Maintain existing edit functionality

PR Test Details

Test with:

Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-<pr_number> after approval. Contributors are requested to replace <pr_number> with the actual PR number.

@Spiral-Memory
Spiral-Memory merged commit 58e1f81 into RocketChat:develop Sep 21, 2025
1 check passed
github-actions Bot added a commit that referenced this pull request Sep 21, 2025
@Spiral-Memory

Copy link
Copy Markdown
Collaborator

Thanks @Khizarshah01 for adding the URL validator.

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.

Bug: InsertLinkToolBox component accepts invalid or unsafe URLs (e.g., javascript:), allowing potential XSS and broken links

2 participants