Skip to content

security: don't follow redirects on webhook delivery - #8263

Merged
unknwon merged 4 commits into
mainfrom
ghsa-c4v7-xg93-qf8g
May 19, 2026
Merged

unknwon merged 4 commits into
mainfrom
ghsa-c4v7-xg93-qf8g

Conversation

@unknwon

@unknwon unknwon commented May 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Refuse to follow HTTP redirects when delivering webhooks. The target URL is explicitly configured by the user, so any redirect would silently retarget the signed payload — which is the root cause of the SSRF vector regardless of whether the redirect destination is local or public.
  • Expose Request.SetCheckRedirect on internal/httplib so callers can install an http.Client.CheckRedirect policy.

Refs GHSA-c4v7-xg93-qf8g.

Test plan

  • Point a webhook at a controlled server that returns 301/302 (e.g. to http://169.254.169.254/); trigger delivery and confirm it fails with a "refusing to follow webhook redirect" error and the redirect target is never fetched.
  • Confirm normal (non-redirecting) webhook deliveries to allowed hosts still succeed.

unknwon added 2 commits May 18, 2026 13:45
Reject HTTP redirects whose target hostname resolves to a blocked local
network address. Adds a CheckRedirect hook to httplib so the webhook
delivery client can reuse the existing IsBlockedLocalHostname check on
every hop, not just the initial URL.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 aims to harden webhook delivery by applying local-network SSRF validation to HTTP redirect targets and exposing redirect policy configuration in httplib.

Changes:

  • Adds CheckRedirect support to internal/httplib.
  • Applies redirect-target local-network blocking during webhook delivery.
  • Documents the webhook redirect SSRF fix in the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
internal/httplib/httplib.go Adds Settings.CheckRedirect, a setter, and passes it into http.Client.
internal/database/webhook.go Installs a webhook redirect policy that blocks redirects resolving to local network addresses.
CHANGELOG.md Adds the security advisory entry for webhook redirect SSRF.

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

Comment thread internal/database/webhook.go Resolved
Comment thread internal/database/webhook.go Resolved
unknwon added 2 commits May 18, 2026 13:52
Setting CheckRedirect replaces net/http's default policy, so the
default 10-hop limit no longer applies. Reapply it in the callback to
keep a malicious endpoint from looping webhook delivery indefinitely.
The webhook target is explicitly configured by the user, so following
any redirect silently retargets the signed payload — which is the root
of the SSRF vector regardless of whether the redirect target is local
or public. Refuse all redirects instead of resolving and re-checking
them.
@unknwon
unknwon requested a review from Copilot May 18, 2026 17:57
@unknwon unknwon changed the title security: validate redirect targets in webhook deliveries Refuse to follow redirects in webhook delivery May 18, 2026
@unknwon unknwon changed the title Refuse to follow redirects in webhook delivery security: don't follow redirects on webhook delivery May 18, 2026
@unknwon unknwon added this to the 0.14.3 milestone May 18, 2026
@unknwon
unknwon removed the request for review from Copilot May 18, 2026 23:13
@unknwon
unknwon merged commit 199cf4f into main May 19, 2026
12 checks passed
@unknwon
unknwon deleted the ghsa-c4v7-xg93-qf8g branch May 19, 2026 01:08
unknwon added a commit that referenced this pull request Jun 7, 2026
@unknwon unknwon mentioned this pull request Nov 12, 2026
1 task done
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.

2 participants