From d3eb6e77d975de4460c8258778a25260245a6f73 Mon Sep 17 00:00:00 2001 From: Rex Raphael Date: Sat, 14 Nov 2026 20:47:13 -0600 Subject: [PATCH 1/3] build(deps): move to ledger 1.9.3 Saving a card answered 500 on app.loomplane.com: Stripe enables Managed Payments by default and refused ledger's setup-mode Checkout session with "Invalid mode: setup". ledger 1.9.3 turns Managed Payments off for that session alone (xraph/ledger#47). --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4ba7eed3..5680fa3d 100644 --- a/go.mod +++ b/go.mod @@ -82,7 +82,7 @@ require ( github.com/xraph/herald v1.10.3 github.com/xraph/herald/drivers/apns v1.10.3 github.com/xraph/keysmith v1.9.1 - github.com/xraph/ledger v1.9.2 + github.com/xraph/ledger v1.9.3 github.com/xraph/nexus v1.9.3 github.com/xraph/nexus/providers/anthropic v1.9.1 github.com/xraph/nexus/providers/openai v1.9.1 diff --git a/go.sum b/go.sum index 0a65462e..30d724af 100644 --- a/go.sum +++ b/go.sum @@ -842,8 +842,8 @@ github.com/xraph/herald/drivers/apns v1.10.3 h1:B24dlJj+UrZ1bzpndL7IJHUvDhXXprPo github.com/xraph/herald/drivers/apns v1.10.3/go.mod h1:MUbgvOsvjcda3SGf4LjQLtLQrsVflAbZAXKnpiBBU78= github.com/xraph/keysmith v1.9.1 h1:ZtZ+j1ZbxHKMJzkRnZWwo0hJLsB86Ro5oe7sWCoMKlQ= github.com/xraph/keysmith v1.9.1/go.mod h1:WPSJLvoXi8g8LvV2+Tg4JOafGeb+/PlC8ZaW8XYIYss= -github.com/xraph/ledger v1.9.2 h1:h+9wWFkf1rGmdWknqTlaVu7eBTIZw0qpuWzQ+vQuPV0= -github.com/xraph/ledger v1.9.2/go.mod h1:k769SQtmWXI9I4DKbja26oZdH/sW29qE/8Y5iNstsdg= +github.com/xraph/ledger v1.9.3 h1:oz4tlIdDxThus7nX28vpQW//DPzM1yDUStkJV90jQrQ= +github.com/xraph/ledger v1.9.3/go.mod h1:qJvX411LrVwLXwkkVh1UAjUxRpj44c99XvCRjImKSFA= github.com/xraph/nexus v1.9.3 h1:swjUBnkGFYs6f0sifyW7a7CmHetwjmslUKGsH19CFhQ= github.com/xraph/nexus v1.9.3/go.mod h1:0hU8ddSNwAw1bh7HlAe9v4ftR0VR0FlYZqpRjKAuhT0= github.com/xraph/nexus/providers/anthropic v1.9.1 h1:xoIc53B8DmKun+MLPWTFruMGotpSPoCWeOvBx8uk87g= From 9355aee8eb080146d9b451fbc5ab3f85725b25eb Mon Sep 17 00:00:00 2001 From: Rex Raphael Date: Sat, 14 Nov 2026 21:10:40 -0600 Subject: [PATCH 2/3] build(deps): move to authsome 1.12.2 authsome 1.12.2 moves to ledger 1.9.3 and forge 1.13.7, which this branch already requires. No migrations. --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5680fa3d..271850c1 100644 --- a/go.mod +++ b/go.mod @@ -62,7 +62,7 @@ require ( github.com/stripe/stripe-go/v87 v87.1.0 github.com/vishvananda/netlink v1.3.1 github.com/vishvananda/netns v0.0.5 - github.com/xraph/authsome v1.12.1 + github.com/xraph/authsome v1.12.2 github.com/xraph/bastion v1.4.2 github.com/xraph/chronicle v1.11.0 github.com/xraph/chronicle/extension v1.11.0 diff --git a/go.sum b/go.sum index 30d724af..fe0f069d 100644 --- a/go.sum +++ b/go.sum @@ -782,8 +782,8 @@ github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6 github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= -github.com/xraph/authsome v1.12.1 h1:yWxi7xlSiSgh52nWkYBn6dKBiKY9DlhHX9CxXOHwCYs= -github.com/xraph/authsome v1.12.1/go.mod h1:t/2Id0S+RKAH7FMGz1XiVhRo8KypnD+8aZoXDPQXfNU= +github.com/xraph/authsome v1.12.2 h1:d3lmVO80e0ZJknuNGysK2rw9rVANkBihNQddj9uBZaA= +github.com/xraph/authsome v1.12.2/go.mod h1:bwi67iJdJ2hPrBC4yV5qtgo+qTl20JfPMzLTr3baX20= github.com/xraph/bastion v1.4.2 h1:kHXVoNUVazHIUAZq1bHcmi2EU8TPTFyX0l/ukzZHtro= github.com/xraph/bastion v1.4.2/go.mod h1:862Zqo8bol14XVglystGodqNBo72qAXIux0giixBYtw= github.com/xraph/chronicle v1.11.0 h1:+aRFsdO089LfVym2qyct+0GIF/G+WnDVFG7NTlw6o8M= From f990b6ccd629b49a5c70a3b55ca3affb17fe8581 Mon Sep 17 00:00:00 2001 From: Rex Raphael Date: Sat, 14 Nov 2026 21:10:40 -0600 Subject: [PATCH 3/3] fix(test): keep rate-limited request runs inside one window TestSignupGate_floodIsRateLimited failed on CI with "a fourth sign-up from one address: 403, want 429". The limiter Loomplane gives authsome counts in fixed one-minute windows aligned to the clock. Under -race the run of sign-ups can cross a minute boundary, the count starts again from zero, and the fourth sign-up reaches the waitlist instead of the limit. inOneRateWindow waits for the next minute when less than half of the current one is left. The sign-up flood, the office sign-ups, the setup validation run and the node-join run all call it before the requests that have to share a window. --- tests/integration/nodes_test.go | 1 + tests/integration/setup_test.go | 1 + tests/integration/signup_gate_test.go | 16 ++++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/tests/integration/nodes_test.go b/tests/integration/nodes_test.go index 6aa415c8..d1fc1aff 100644 --- a/tests/integration/nodes_test.go +++ b/tests/integration/nodes_test.go @@ -307,6 +307,7 @@ func TestNodes_listCancelAndLimitJoinTokens(t *testing.T) { Inventory: nodeproto.Inventory{OS: "linux", Arch: "amd64"}, NodeVersion: buildinfo.Version, ProtocolVersion: nodeproto.Version, }, nil) } + inOneRateWindow(t) // every join from here on counts against one window if got := join(scoped.Token); got != http.StatusUnauthorized { t.Fatalf("join with a cancelled token: %d", got) } diff --git a/tests/integration/setup_test.go b/tests/integration/setup_test.go index bc68e7e6..f42ea229 100644 --- a/tests/integration/setup_test.go +++ b/tests/integration/setup_test.go @@ -378,6 +378,7 @@ func TestSetup_validation(t *testing.T) { long := strings.Repeat("x", 65) // Five, the most one address may send a minute. The unit tests cover // the other refusals. + inOneRateWindow(t) for name, form := range map[string]map[string]string{ "no name": {"email": "ada@example.com", "password": "Correct-horse-battery-9", "organization_name": "Acme"}, "bad email": {"name": "Ada", "email": "not an email", "password": "Correct-horse-battery-9", "organization_name": "Acme"}, diff --git a/tests/integration/signup_gate_test.go b/tests/integration/signup_gate_test.go index 155c361b..b5052b50 100644 --- a/tests/integration/signup_gate_test.go +++ b/tests/integration/signup_gate_test.go @@ -391,6 +391,20 @@ func TestSignupGate_burstCantWedgeThePool(t *testing.T) { } } +// inOneRateWindow waits, when it has to, so that what follows starts with +// at least half of a rate-limit window left. The limiter Loomplane gives +// authsome counts in fixed windows aligned to the minute, so a run of +// requests that crosses a boundary starts counting again from zero. Under +// -race on CI a handful of sign-ups can take long enough for that to happen. +func inOneRateWindow(t *testing.T) { + t.Helper() + const window = time.Minute // authsome's default, which these tests keep + now := time.Now() + if left := now.Truncate(window).Add(window).Sub(now); left < window/2 { + time.Sleep(left + 100*time.Millisecond) + } +} + // authsome takes three sign-ups a minute from one address. The gate runs // in front of that route, so it counts against the same budget first: a // flood from one address gets 429s before the gate looks anything up, so @@ -405,6 +419,7 @@ func TestSignupGate_floodIsRateLimited(t *testing.T) { } flood := &setupClient{t: t, base: c.base, key: c.key, from: "203.0.113.7"} + inOneRateWindow(t) codes := make([]int, 0, 6) for i := range 6 { status, _, _ := flood.send(http.MethodPost, "/authsome/v1/signup", @@ -426,6 +441,7 @@ func TestSignupGate_floodIsRateLimited(t *testing.T) { // again on authsome's route: three invited people can sign up from one // address, and only a fourth sign-up is turned away. office := &setupClient{t: t, base: c.base, key: c.key, from: "192.0.2.10"} + inOneRateWindow(t) for i := range 3 { email := fmt.Sprintf("colleague%d@example.com", i) if status, raw, _ := c.send(http.MethodPost, "/api/v1/invitations", map[string]string{"email": email}); status != http.StatusCreated {