Add enhanced text sanitization (#83)

* Add enhanced text sanitization

* Format code with prettier

* Refactor tests to remove redundancy and improve structure

- Remove redundant 'mixed input patterns' test from sanitizer.test.ts
- Consolidate integration tests into 2 focused real-world scenarios
- Add HTML comment stripping to sanitizeContent function
- Update test expectations to match sanitization behavior
- Maintain full coverage with fewer, more focused tests

* Fix prettier formatting

* Remove rendered.html from repository

* Remove test-markdown.json and update .gitignore

* Revert .gitignore changes
This commit is contained in:
Lina Tawfik
2025-05-29 16:35:50 -07:00
committed by GitHub
parent fb7365fba9
commit 35ad5fc467
6 changed files with 498 additions and 175 deletions

View File

@@ -9,8 +9,8 @@ import {
formatComments,
formatReviewComments,
formatChangedFilesWithSHA,
stripHtmlComments,
} from "../github/data/formatter";
import { sanitizeContent } from "../github/utils/sanitizer";
import {
isIssuesEvent,
isIssueCommentEvent,
@@ -436,14 +436,14 @@ ${
eventData.eventName === "pull_request_review") &&
eventData.commentBody
? `<trigger_comment>
${stripHtmlComments(eventData.commentBody)}
${sanitizeContent(eventData.commentBody)}
</trigger_comment>`
: ""
}
${
context.directPrompt
? `<direct_prompt>
${stripHtmlComments(context.directPrompt)}
${sanitizeContent(context.directPrompt)}
</direct_prompt>`
: ""
}