From 9237056d64464642259db94c61811cd26ac38af7 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Mon, 15 Apr 2024 09:52:05 +0200 Subject: [PATCH] Increase the entropy in generated pac secrets we would hit some conflicts when generating the pac secrets, so increase the entropy of 6. The secret is composed of 62 characters (26 uppercase + 26 lowercase + 10 digits) so the total number of combinations for a string of length nn would be 62n62n. With a length of 6 there are approximately 56.8 billion possible combinations which would not conflict anymore. Fixes #1663 Signed-off-by: Chmouel Boudjnah --- pkg/secrets/basic_auth.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/secrets/basic_auth.go b/pkg/secrets/basic_auth.go index 0bdfad9c7..159185c22 100644 --- a/pkg/secrets/basic_auth.go +++ b/pkg/secrets/basic_auth.go @@ -22,6 +22,7 @@ const ( ` //nolint:gosec basicAuthSecretName = `pac-gitauth-%s` + ranStringSeedLen = 6 ) // MakeBasicAuthSecret Make a secret for git-clone basic-auth workspace. @@ -93,5 +94,5 @@ func MakeBasicAuthSecret(runevent *info.Event, secretName string) (*corev1.Secre func GenerateBasicAuthSecretName() string { return strings.ToLower( - fmt.Sprintf(basicAuthSecretName, random.AlphaString(4))) + fmt.Sprintf(basicAuthSecretName, random.AlphaString(ranStringSeedLen))) }