Skip to content

Commit

Permalink
Increase the entropy in generated pac secrets
Browse files Browse the repository at this point in the history
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 openshift-pipelines#1663

Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel committed Apr 15, 2024
1 parent d87b05f commit 9237056
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/secrets/basic_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
`
//nolint:gosec
basicAuthSecretName = `pac-gitauth-%s`
ranStringSeedLen = 6
)

// MakeBasicAuthSecret Make a secret for git-clone basic-auth workspace.
Expand Down Expand Up @@ -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)))
}

0 comments on commit 9237056

Please sign in to comment.