all repos — honk @ 4c589271d0cc6f2076a3ec0d21dcce75e71a0078

my fork of honk

add a note about http sig requirements,
and check that host header matches
Ted Unangst tedu@tedunangst.com
Fri, 26 Apr 2019 10:02:46 -0400
commit

4c589271d0cc6f2076a3ec0d21dcce75e71a0078

parent

40eeb4b494f0c4006860083bea1ee58668b0ffd2

2 files changed, 9 insertions(+), 0 deletions(-)

jump to
M docs/manual.txtdocs/manual.txt

@@ -60,3 +60,8 @@ with other servers via https URLs.

If the proxy is configured to support caching, be mindful of the fact that ActivityPub requests vary based on the Accept and Content-Type headers. + +ActivityPub in practice uses HTTP signatures to verify requests. In order for +this to work, the backend server must receive certain header fields +unmodified. In particular, the Host header and the message content cannot be +altered.
M zig.gozig.go

@@ -26,6 +26,7 @@ "encoding/base64"

"encoding/pem" "fmt" "io" + "log" "net/http" "regexp" "strings"

@@ -135,6 +136,9 @@ case "(request-target)":

s = strings.ToLower(req.Method) + " " + req.URL.RequestURI() case "host": s = req.Host + if s != serverName { + log.Printf("caution: servername host header mismatch") + } default: s = req.Header.Get(h) }