Skip to content

Update WebHookLog URL sanitisation to support masked segments

James Nutt requested to merge jnutt/testhooks into master

What does this MR do and why?

This MR attempts to address #424339 (closed) by refactoring the WebHookLog model to rely on the sanitisation provided by UrlSanitizer rather than SafeUrl and adding support for masked segments in URLs.

This resolves an issue where a user creates a webhook with masked URL portions and encounters an unhandled exception when attempting to test it.

How to set up and validate locally

  1. Open a project.
  2. Go to Settings -> Webhooks and create a hook.
  3. Enter http://example.com/hook in the URL field.
  4. Enable masking, with example.com -> domain.
  5. Enable the hook for issue events. I don't think the specific choice matters.
  6. Save the hook, click 'Test' and select 'Issues events'

Before: Invalid character in host: '{domain}'

After: "Hook executed successfully but returned HTTP 404"

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by James Nutt

Merge request reports