forgejo/services/webhook
Giteabot dab40cd5f4
Support allowed hosts for webhook to work with proxy (#27655) (#27675)
Backport #27655 by @wolfogre

When `webhook.PROXY_URL` has been set, the old code will check if the
proxy host is in `ALLOWED_HOST_LIST` or reject requests through the
proxy. It requires users to add the proxy host to `ALLOWED_HOST_LIST`.
However, it actually allows all requests to any port on the host, when
the proxy host is probably an internal address.

But things may be even worse. `ALLOWED_HOST_LIST` doesn't really work
when requests are sent to the allowed proxy, and the proxy could forward
them to any hosts.

This PR fixes it by:

- If the proxy has been set, always allow connectioins to the host and
port.
- Check `ALLOWED_HOST_LIST` before forwarding.

Co-authored-by: Jason Song <i@wolfogre.com>
2023-10-18 15:07:52 +02:00
..
deliver.go Support allowed hosts for webhook to work with proxy (#27655) (#27675) 2023-10-18 15:07:52 +02:00
deliver_test.go Support allowed hosts for webhook to work with proxy (#27655) (#27675) 2023-10-18 15:07:52 +02:00
dingtalk.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
dingtalk_test.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
discord.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
discord_test.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
feishu.go Modify the content format of the Feishu webhook (#25106) 2023-08-24 09:00:11 +08:00
feishu_test.go Modify the content format of the Feishu webhook (#25106) 2023-08-24 09:00:11 +08:00
general.go Modify the content format of the Feishu webhook (#25106) 2023-08-24 09:00:11 +08:00
general_test.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
main_test.go move repository deletion to service layer (#26948) 2023-09-08 04:51:15 +00:00
matrix.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
matrix_test.go
msteams.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
msteams_test.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
notifier.go Move notification interface to services layer (#26915) 2023-09-05 18:37:47 +00:00
packagist.go
packagist_test.go
payloader.go
slack.go Fix release URL in webhooks (#27182) (#27185) 2023-09-21 23:22:14 +00:00
slack_test.go
telegram.go
telegram_test.go
webhook.go
webhook_test.go
wechatwork.go