Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds link sanitization to citation components to prevent malicious links and enforces ESLint rules to prevent direct use of anchor elements. The changes establish Markdown reference-style links as the single source of truth for URLs over entity-defined URLs.
- Implements centralized link sanitization through HTML content transformer
- Adds ESLint rules to prevent direct
<a>element usage - Updates citation logic to prefer Markdown URLs over entity URLs
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/component/src/hooks/internal/useSanitizeHrefCallback.ts | New hook for sanitizing URLs using HTML content transformer |
| packages/component/src/LinkDefinition/LinkDefinitionItem.tsx | Updated to use sanitized URLs and added prop validation |
| packages/component/src/Attachment/Text/private/MarkdownTextContent.tsx | Major refactor to implement URL sanitization and single source of truth logic |
| packages/component/src/Attachment/FileContent.tsx | Renamed variable for clarity and added ESLint disable comment |
| packages/component/src/ActivityStatus/private/Originator.tsx | Added URL sanitization and prop validation |
| .eslintrc.react.yml | Added ESLint rule to forbid direct anchor element usage |
| tests/html2/citation/ | Test files for validating sanitization behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
OEvgeny
approved these changes
Sep 2, 2025
This file contains hidden or 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
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.
Changelog Entry
Breaking changes
Claimentity is being deprecated, in PR #5564, by @compulim. It will be removed on or after 2027-08-29entities[@id=""][@type="Message"].citation[@type="Claim"]insteadAdded
Removed
Claimentity is being deprecated, in PR #5564, by @compulim. It will be removed on or after 2027-08-29entities[@id=""][@type="Message"].citation[@type="Claim"]insteadDescription
Adding sanitization to links used in citation. Also URL in Markdown reference style link is source-of-truth, the URL in
Claimentity is treated as auxiliary/redundant.Design
As sanitization is done by HTML content transformer, we are leveraging the HTML content transformer to detect whether links (HREFs) should be sanitized.
If web developers want to change what URL scheme is supported, they should modify the sanitization engine in the HTML content transformer.
Citation
There are 2 types of citation, and their behaviors:
Single source of truth
For citation, the URL can be set at both Markdown reference style link and
Claimentity.If the are inconsistent, a warning will be presented and the URL from Markdown reference style is used as the source of truth.
In other word, the URL presented in
Claimentity is always ignored.For "plain text" channels such as email/SMS, they cannot use the
Claimentity. Thus,Claimentity is always designed to be an auxiliary/redundant data.Specific Changes
.eslintrc.ymlto detect<a>viareact/forbid-elementsruleCHANGELOG.mdReview Checklist
Accessibility reviewed (tab order, content readability, alt text, color contrast)Browser and platform compatibilities reviewedCSS styles reviewed (minimal rules, noz-index)Internationalization reviewed (strings, unit formatting)package.jsonandpackage-lock.jsonreviewed