clone

a self-hosted multitenant nostr relay with sites, file storage, git hosting, and inbox and outbox delivery

accept public address literals as callback hosts

Dami committed 849dd72
commit
849dd7263f8767ba381c64bb3eec0974c020a642
parent
d96b31a2f7589c387df35368fb602f248c525e99
author
Dami <dami.etoile@gmail.com>
2 files changed, +10 -3
Minternal/daemon/callbacks.go9++++++---
Minternal/daemon/callbacks_test.go4++++
M internal/daemon/callbacks.go +6 -3
M internal/daemon/callbacks_test.go +4 -0
@@ -100,6 +100,8 @@ func TestCallbackRegistrationValidatesURLFilterScopeAndCap(t *testing.T) {
100100 {"credentials", member, "https://user:pw@hooks.example/wake", `{"kinds":[1]}`, "invalid: url must be https"},101101 {"private address", member, "https://10.0.0.1/wake", `{"kinds":[1]}`, "invalid: url must not name a private"},102102 {"loopback address", member, "https://127.0.0.1/wake", `{"kinds":[1]}`, "invalid: url must not name a private"},103+ {"loopback ipv6", member, "https://[::1]/wake", `{"kinds":[1]}`, "invalid: url must not name a private"},104+ {"shared address", member, "https://100.64.0.9/wake", `{"kinds":[1]}`, "invalid: url must not name a private"},103105 {"localhost", member, "https://localhost/wake", `{"kinds":[1]}`, "invalid: url must name a public host"},104106 {"bare host", member, "https://relay/wake", `{"kinds":[1]}`, "invalid: url must name a public host"},105107 {"no kinds", member, "https://hooks.example/wake", `{"#p":["` + member + `"]}`, "invalid: filter must name at least one kind"},
@@ -145,6 +147,8 @@ func TestCallbackRegistrationValidatesURLFilterScopeAndCap(t *testing.T) {
145147 for i := 0; i < 6; i++ {146148 addCallback(t, tenant, owner, "https://hooks.example/owner/"+strconv.Itoa(i), `{"kinds":[1]}`)147149 }150+ // A public address literal is a host like any other.151+ addCallback(t, tenant, owner, "https://[2001:db8::10]/wake", `{"kinds":[1]}`)148152 // The secret shows once: listings and the table row never repeat it.149153 listed, err := tenant.Execute(ctx, agent, "listcallbacks", nil)150154 if err != nil {