Repository navigation
fix(chat): Unable to open links from replies - #21608
Conversation
WalkthroughThe pull request introduces modifications to the Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/component.tsx(2 hunks)
🔇 Additional comments (1)
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/component.tsx (1)
Line range hint 31-41: LGTM! This change fixes the link clicking issue.
Removing the preventDefault() call allows links to be clicked while maintaining the message focusing functionality.
| <Styled.Markdown | ||
| $emphasizedMessage={emphasizedMessage} | ||
| linkTarget="_blank" | ||
| allowedElements={window.meetingClientSettings.public.chat.allowedElements} | ||
| unwrapDisallowed | ||
| > |
There was a problem hiding this comment.
💡 Codebase verification
Based on the analysis of the codebase, I can now generate the final response.
Add security attributes for external links and validate allowedElements.
The current implementation needs two security improvements:
- Add
linkRel="noopener noreferrer"to prevent reverse tabnabbing fromtarget="_blank"links - The
allowedElementsfromwindow.meetingClientSettings.public.chatis properly initialized and validated through the application's configuration system
<Styled.Markdown
$emphasizedMessage={emphasizedMessage}
linkTarget="_blank"
+ linkRel="noopener noreferrer"
allowedElements={window.meetingClientSettings.public.chat.allowedElements}
unwrapDisallowed
>🔗 Analysis chain
Add security attributes for external links.
While setting linkTarget="_blank" improves UX, it needs additional security attributes to prevent potential security vulnerabilities (e.g., reverse tabnabbing).
Apply this diff to add security attributes:
<Styled.Markdown
$emphasizedMessage={emphasizedMessage}
- linkTarget="_blank"
+ linkTarget="_blank"
+ linkRel="noopener noreferrer"
allowedElements={window.meetingClientSettings.public.chat.allowedElements}
unwrapDisallowed
>Also, consider adding a type check for window.meetingClientSettings.public.chat.allowedElements to ensure it's properly initialized before use.
Let me search for more context about the initialization and validation of meetingClientSettings.
Let me search for the initialization and validation of allowedElements in the chat configuration.
Let me check the Markdown component implementation and its security features.
Let me check the ReactMarkdown component's usage and security configurations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if allowedElements is properly initialized elsewhere
rg -A 5 "meetingClientSettings.*allowedElements" --type ts
Length of output: 1030
Script:
#!/bin/bash
# Search for meetingClientSettings initialization and type definitions
rg -g "*.ts*" "meetingClientSettings" -B 2 -A 2
# Search for any type definitions related to chat settings
ast-grep --pattern 'interface $_ {
$$$
chat: $$$
$$$
}'
Length of output: 80898
Script:
#!/bin/bash
# Search for chat allowedElements initialization and validation
rg -g "*.ts*" "allowedElements.*chat" -B 2 -A 2
# Search for any chat configuration files
fd -e ts -e tsx chat-config
Length of output: 1741
Script:
#!/bin/bash
# Search for Markdown component implementation
rg -g "*.ts*" -B 3 -A 3 "const.*Markdown.*=.*styled"
# Search for any security-related props in Markdown usage
ast-grep --pattern '$_Markdown
$$$
linkRel=$_
$$$'
Length of output: 17322
Script:
#!/bin/bash
# Search for ReactMarkdown imports and configurations
rg -g "*.ts*" "ReactMarkdown" -B 2 -A 2
# Search for any security-related configurations in the chat settings
rg -g "*.ts*" "allowedElements.*=" -B 2 -A 2
Length of output: 7475
|
Automated tests Summary✅ All the CI tests have passed! |



What does this PR do?
Fix a bug where we cannot open links from replies.
Closes Issue(s)
n/a