Make the agent token-leak assertion able to fail

This commit is contained in:
Viktor Liu
2026-09-22 21:06:07 +02:00
parent 8f06a43d93
commit d0e705bb25
+4 -1
View File
@@ -91,7 +91,10 @@ func TestAgentHandshake_TokenNeverSent(t *testing.T) {
}()
require.NoError(t, agentClientHandshake(daemonSide, token, false))
assert.NotContains(t, sent.Bytes(), token, "the token must not cross the socket")
// bytes.Contains, not assert.NotContains: testify compares a []byte
// haystack element-wise, and a []byte is never an element of a []byte, so
// the assertion held whatever crossed the wire — including the whole token.
assert.False(t, bytes.Contains(sent.Bytes(), token), "the token must not cross the socket")
}
// A tag is bound to the nonce it answered, so replaying one against a fresh