From 561321fbd770d2251cbf9ecdf1b6f180ab8b656d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 10:38:31 +0100 Subject: [PATCH] test(sso): always change the PKCE verifier when tampering with it The test replaced the first character with "x", which left about one in 64 random verifiers unchanged and failed the test spuriously. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/sso/sso_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/sso/sso_test.go b/internal/sso/sso_test.go index d79cda0..3d92beb 100644 --- a/internal/sso/sso_test.go +++ b/internal/sso/sso_test.go @@ -70,7 +70,14 @@ func TestExchangeRejects(t *testing.T) { }{ {"wrong nonce", func(i *ssotest.IDP, _ *sso.Flow) { i.NonceOverride = "other" }}, {"wrong audience", func(i *ssotest.IDP, _ *sso.Flow) { i.AudienceOverride = "someone-else" }}, - {"wrong pkce verifier", func(_ *ssotest.IDP, f *sso.Flow) { f.Verifier = "x" + f.Verifier[1:] }}, + {"wrong pkce verifier", func(_ *ssotest.IDP, f *sso.Flow) { + // Replacing the first character must change it, whatever it is. + first := "x" + if f.Verifier[0] == 'x' { + first = "y" + } + f.Verifier = first + f.Verifier[1:] + }}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {