Commit adeefc6b75

adeefc6b752b9f13d2a79a49c769d48e16f1028d

parent: 49d601e534

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-20 10:40 UTC

push: log the GITBAY_APNS_HOST scheme downgrade

Dropping to plain HTTP for the test override was silent, which
contradicts what config.Push already promises: a misconfigured [push]
fails loudly at startup rather than filling a queue nobody is
watching. A stray GITBAY_APNS_HOST on a real instance would otherwise
send the provider JWT over cleartext with no sign anything had
changed. Warn once, at the point the scheme is decided.

Ref #89
internal/push/apns.go +10 −1
@@ -7,6 +7,7 @@ import (
77 "encoding/json"
88 "fmt"
99 "io"
10 "log/slog"
1011 "net/http"
1112 "os"
1213 "strconv"
@@ -65,8 +66,16 @@ func NewClient(cfg config.Push) (*Client, error) {
6566// speaks plain HTTP/1.1 rather than negotiating TLS, so the same override
6667// has to drop the scheme too, or every request fails with "server gave
6768// HTTP response to HTTPS client" instead of reaching the fake at all.
69//
70// The drop is logged rather than silent. config.Push's own doc comment
71// promises a misconfigured [push] fails loudly at startup rather than
72// filling a queue nobody is watching; a stray GITBAY_APNS_HOST on a real
73// instance would otherwise send the provider JWT over cleartext with no
74// sign anything had changed, where the pre-override behaviour at least
75// failed loudly by attempting TLS against a host that cannot answer it.
6876func apnsScheme() string {
69 if os.Getenv("GITBAY_APNS_HOST") != "" {
77 if h := os.Getenv("GITBAY_APNS_HOST"); h != "" {
78 slog.Warn("push: GITBAY_APNS_HOST is set, sending to it over plain HTTP instead of APNs", "host", h)
7079 return "http"
7180 }
7281 return "https"