Skip to content

Sanitize markdown in maintainers IssuesTab discussion rendering (RenderMarkdownContent) #190

Description

@Jagadeeshftw

📌 Description

IssuesTab (src/features/maintainers/components/issues/IssuesTab.tsx) renders discussion content via RenderMarkdownContent from src/app/utils/renderMarkdown.tsx, which uses react-markdown with no explicit sanitization and no javascript: link guard. Discussion text originates from external GitHub content.

💡 Why it matters: Unsanitized maintainer-discussion markdown is an XSS vector.

🧩 Requirements and context

  • Add rehype-sanitize (or equivalent) to RenderMarkdownContent.
  • Block javascript:/data: URLs in links.
  • Ensure raw HTML in markdown is not rendered.
  • Add tests asserting script/HTML payloads are neutralized.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b security/sanitize-discussion-markdown

2. Implement changes

  • Write/modify the relevant source: src/app/utils/renderMarkdown.tsx
  • Write comprehensive tests: src/app/utils/renderMarkdown.test.tsx
  • Add documentation: TSDoc + security note
  • Include TSDoc doc comments
  • Validate security assumptions: XSS payloads neutralized

3. Test and commit

  • Run tests:
npm run test
  • Cover edge cases: <script>, inline event handlers, javascript: links
  • Include test output and security notes in the PR description.

Example commit message

fix(security): sanitize discussion markdown rendering

✅ Acceptance criteria

  • Sanitization plugin applied
  • Dangerous URL schemes blocked
  • Raw HTML not rendered
  • Tests assert payloads neutralized

🔒 Security notes

Mitigates stored XSS from external GitHub discussion content.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial CampaignGrantFox official campaign issuefrontendFrontend / UI worksecuritySecurity hardening / audit

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions