]> source.dussan.org Git - gitea.git/commit
If httpsig verification fails, fix Host header and try again
authorAnthony Wang <ta180m@proton.me>
Tue, 14 Jun 2022 21:23:08 +0000 (16:23 -0500)
committerAnthony Wang <ta180m@proton.me>
Tue, 14 Jun 2022 21:23:08 +0000 (16:23 -0500)
commitf53e46c721a037c55facb9200106a6b491bf834c
treeaa82a7d2d326741cdc2f806423997195a0e6badf
parenta3120079a5dd4376c7c85584bdc5f6290cf5b84e
If httpsig verification fails, fix Host header and try again

This fixes a very rare bug when Gitea and another AP server (confirmed to happen with Mastodon) are running on the same machine, Gitea fails to verify incoming HTTP signatures. This is because the other AP server creates the sig with the public Gitea domain as the Host. However, when Gitea receives the request, the Host header is instead localhost, so the signature verification fails. Manually changing the host header to the correct value and trying the verification again fixes the bug.
routers/api/v1/activitypub/reqsignature.go