Validate TURN config to guard against invalid values (#4742)

This commit is contained in:
Raja Subramanian
2026-08-11 20:34:49 +05:30
committed by GitHub
parent c4c356f6ca
commit 7167f91493
7 changed files with 344 additions and 37 deletions
+3 -2
View File
@@ -1434,8 +1434,9 @@ func TestTurnAuthFailure(t *testing.T) {
validPassword, err := authHandler.CreatePassword(testApiKey, pID, validExpiry)
require.NoError(t, err)
// username encoded with an already-expired timestamp.
expiredUsername, _ := authHandler.CreateUsername(testApiKey, pID, -10)
// username encoded with an already-expired timestamp; constructed directly
// because CreateUsername floors non-positive TTLs to the default.
expiredUsername := base62.EncodeToString(fmt.Appendf(nil, "%s|%s|%d", testApiKey, pID, time.Now().Add(-time.Minute).Unix()))
// username encoded with an api key the server does not know about.
unknownAPIKeyUsername, _ := authHandler.CreateUsername("unknown-api-key", pID, 300)