Gitea Webhook Change

A while back I wrote about deploying DroneCI and Gitea together to build projects automatically. A few months ago my CI broke and I've only just now gotten around to fixing it.

In PR #17482 the Gitea project introduced a breaking change for security reasons. They introduced a new webhook.ALLOWED_HOST_LIST value which needed to be configured in order for webhooks to work.

Diagnosis

In Gitea open the repo in question and navigate to the repo specific settings -> webhooks.

Next utilise the recent deliveries history at the bottom to determine your failure scenario.

Mine stated:

Delivery: Post "https://drone.123.com/hook?secret=HMKLFV47c1kJ78QyVez6RHcxPJAHI6TB": dial tcp 192.168.1.10:443: webhook can only call allowed HTTP servers (check your webhook.ALLOWED_HOST_LIST setting), deny 'drone.123.com(192.168.1.10:443)'

Fixing it

The fix was quite straightforward. Modify the app.ini file which contains your Gitea config and add:

[webhook]
ALLOWED_HOST_LIST = drone.123.com, 192.168.x.x/24

Add as many hosts as is required. Restart Gitea and you'll once more have working webhooks.