mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-22 22:59:09 +02:00
Make the agent token-leak assertion able to fail
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user