Skip to content

Conversation

pelikhan
Copy link
Contributor

Satnization:

  • control characters
  • mentions
  • ansi
  • urls (allowed domains)
  • https only
  • html character escaping
  • length

Copilot AI and others added 2 commits August 22, 2025 14:36
…r agent output sanitization (#9)

* Initial plan

* Implement enhanced agent output sanitization with configurable domain allowlisting

- Extract JavaScript sanitization code to separate sanitize_output.cjs file
- Add XML character escaping (< > & " ') to prevent injection attacks
- Add URI protocol filtering to replace non-https protocols with "(redacted)"
- Add configurable allowed-domains option with default GitHub domains
- Update schema to support allowed-domains configuration
- Update tests to match new sanitization function signature
- Add comprehensive documentation for security features

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Fix HTTP protocol filtering to only allow HTTPS

- Changed regex pattern from `http` to `http://` to avoid matching `https://`
- Now correctly filters out `http://` URLs while preserving `https://` URLs
- Addresses feedback to only allow HTTPS protocols for security

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Enhanced sanitization with mention neutralization, bot trigger handling, and environment-based domain configuration

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Fix HTTP protocol filtering to only allow HTTPS URLs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Refactor sanitize_output.cjs to use main function pattern like create_issue.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Remove unnecessary module.exports from sanitize_output.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Add comprehensive JavaScript tests for sanitize_output.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Fix formatting inconsistencies in OutputConfig struct and extractOutputConfig function

* Add extensive tests for sanitizeContent function in sanitize_output.test.cjs

* Refactor script formatting in workflow jobs to use dedicated functions for improved readability and maintainability

* Add tests for FormatJavaScriptForYAML and WriteJavaScriptToYAML functions to ensure proper formatting and indentation

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
@pelikhan pelikhan merged commit 9b40fe9 into githubnext:main Aug 22, 2025
5 checks passed
@pelikhan pelikhan deleted the sanitize-output-js branch August 22, 2025 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants