-
Notifications
You must be signed in to change notification settings - Fork 489
feat: markdown support for gh issues / pull requests #220
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
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdded rehype-raw and rehype-sanitize dependencies and updated the Markdown rendering pipeline to allow sanitized raw HTML; GitHub issue and PR body rendering were switched from prose-wrapped divs to the unified Markdown component and some unused icon imports were removed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Comment |
Summary of ChangesHello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial enhancement to the application's UI by upgrading its Markdown rendering capabilities. The primary goal is to ensure that Markdown content, particularly within GitHub issues and pull requests, is displayed accurately, including any embedded raw HTML or images. This change provides a more faithful and complete representation of the original content, improving the user experience when viewing detailed descriptions. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces markdown rendering for GitHub issue and pull request bodies, which is a great enhancement for user experience. It correctly uses react-markdown and the new rehype-raw plugin to support HTML content. However, there is a significant security concern with using rehype-raw on user-generated content without proper sanitization, which could lead to Cross-Site Scripting (XSS) attacks. I've added comments with suggestions to use rehype-sanitize to mitigate this risk. Please also remember to add rehype-sanitize as a dependency in package.json. The rest of the changes look good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
apps/ui/package.jsonapps/ui/src/components/ui/markdown.tsxapps/ui/src/components/views/github-issues-view.tsxapps/ui/src/components/views/github-prs-view.tsx
🧰 Additional context used
🧬 Code graph analysis (2)
apps/ui/src/components/views/github-prs-view.tsx (1)
apps/ui/src/components/ui/markdown.tsx (1)
Markdown(15-50)
apps/ui/src/components/views/github-issues-view.tsx (1)
apps/ui/src/components/ui/markdown.tsx (1)
Markdown(15-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: e2e
🔇 Additional comments (7)
apps/ui/src/components/views/github-issues-view.tsx (2)
6-6: Good addition of the Markdown component import.This change consolidates markdown rendering logic, improving code maintainability and consistency across the application.
244-248: Refactoring to use the Markdown component improves consistency.The change from a styled div to the unified Markdown component is a good improvement. However, be aware that the Markdown component now uses
rehype-raw, which renders raw HTML from GitHub issue bodies. Ensure that:
- GitHub's API returns sanitized content to prevent XSS attacks, or
- Additional sanitization is implemented in the Markdown component using
rehype-sanitizeSince this content is user-generated (GitHub issues can be created by any user with repository access), this could be a security concern if malicious HTML/JavaScript is present in issue bodies.
Based on the security concern raised in apps/ui/package.json regarding rehype-raw usage.
apps/ui/src/components/views/github-prs-view.tsx (2)
6-6: Good refactoring to use the Markdown component consistently.This change aligns PR body rendering with the same pattern used for issues, improving code consistency and maintainability. However, the same XSS security concern mentioned in the github-issues-view.tsx review applies here: ensure GitHub's API returns sanitized content or implement additional sanitization in the Markdown component.
Based on the security concern raised in apps/ui/package.json regarding rehype-raw usage.
Also applies to: 290-294
2-2: Icons properly removed and unused.The
AlertCircleandCircleicons are not referenced elsewhere in the file, confirming the import removal is correct.apps/ui/src/components/ui/markdown.tsx (2)
42-43: Good addition of image styling.The image styling classes are comprehensive and provide appropriate constraints (max-width, rounded corners, border) that will work well with the existing prose styles.
13-13: Documentation update accurately reflects the new capability.The comment correctly documents that the component now supports raw HTML elements including images.
apps/ui/package.json (1)
75-75: Verify use of allowDangerousHtml with remark-rehype before finalizing this dependency.The allowDangerousHtml option in remark-rehype is dangerous; otherwise, rehype-raw is safe. Version 7.0.0 is the latest and only non-vulnerable version available.
If
allowDangerousHtml: trueis configured in remark-rehype to process untrusted GitHub content, confirm that rehype-sanitize is used after rehype-raw to strip potentially harmful HTML. Otherwise, ifallowDangerousHtmlis not enabled, this plugin poses no additional XSS risk.
- Added rehype-sanitize as a dependency to sanitize Markdown content. - Updated the Markdown component to include rehype-sanitize in the rehypePlugins for improved security against XSS attacks.
Add Markdown support for gh pr and issues
Preview
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.