Block recursive web hooks
What does this MR do and why?
A previous MR !75821 (merged) added logging of recursive webhooks. This MR now blocks recursive webhooks in addition to logging them.
See feature issue: #329743 (closed).
How to set up and validate locally
Setup
- To allow testing locally, allow webhooks requests to your localhost:
- Go Admin > Settings > Network (
/admin/application_settings/network
). - Expand Outbound requests.
- Check Allow requests to the local network from web hooks and services.
- Click Save changes.
- Go Admin > Settings > Network (
- Create a private token (
/-/profile/personal_access_tokens
). - Choose a project that:
- you have admin rights to
- has a merge request
- Add a new Webhook to the project:
- Go Settings > Webhooks.
- For URL add
http://127.0.0.1:3000/api/v4/projects/<project-id>/merge_requests/<merge-request-iid>/add_spent_time?duration=3m&private_token=<your-token>
, replacing the three placeholders with the correct details. - For Trigger select "Merge request events".
- Uncheck Enable SSL verification.
- Save the Webhook.
Trigger the recursion
Tail the auth logs from your terminal: tail -f log/auth.log
.
Go to the merge request and update its description.
On master
the Webhook will fire recursively and log to logs/auth.log
each time.
On this branch, the Webhook will instead only fire once and log to logs/auth.log
once.
View the Webhook details
- Go Settings > Webhooks.
- Scroll down to your webhook, and click Edit.
- Scroll down to Recent events.
You should only see a single event.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #329743 (closed)
Edited by Luke Duncalfe