Skip to content

Conversation

@JoannaaKL
Copy link
Contributor

Also allow http links in sanitisation filter.

@JoannaaKL JoannaaKL requested a review from a team as a code owner November 6, 2025 12:24
Copilot AI review requested due to automatic review settings November 6, 2025 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the HTML sanitization policy to allow both HTTP and HTTPS URL schemes in links, where previously only HTTPS was permitted.

  • Expands allowed URL schemes from HTTPS-only to include both HTTP and HTTPS protocols
Comments suppressed due to low confidence (2)

pkg/sanitize/sanitize.go:57

  • Allowing 'http' URLs introduces a security concern. HTTP traffic is unencrypted and susceptible to man-in-the-middle attacks, which could expose users to malicious content. The policy already uses RequireNoFollowOnLinks(true) and RequireNoReferrerOnLinks(true), but these don't protect against eavesdropping or tampering with HTTP links. Consider whether HTTP URLs are truly necessary, or if the policy should continue enforcing HTTPS-only to ensure secure connections.
		if toggled {

pkg/sanitize/sanitize.go:57

  • The change to allow 'http' URLs lacks test coverage. The existing test suite only includes an HTTPS URL test case (line 223-224 in sanitize_test.go). Add test cases to verify that HTTP URLs are properly allowed and sanitized, for example: a test with <a href=\"http://example.com\">link</a> to confirm the new behavior.
		if toggled {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JoannaaKL JoannaaKL merged commit bc4555f into main Nov 6, 2025
16 checks passed
@JoannaaKL JoannaaKL deleted the allow-http-in-links branch November 6, 2025 13:48
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.

3 participants