Skip to content

Commit

Permalink
Merge pull request #137 from projectsyn/fix-pw-too-long-error
Browse files Browse the repository at this point in the history
Limit ArgoCD password seed to the max length bcrypt allows
  • Loading branch information
bastjan authored Nov 15, 2023
2 parents bdceddc + 1eef39d commit 6ef601b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/argocd/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func CreateArgoSecret(ctx context.Context, config *rest.Config, namespace, passw
if err != nil {
return err
}
// bcrypt supports a maximum of 72 bytes for the password
// https://cs.opensource.google/go/x/crypto/+/bc7d1d1eb54b3530da4f5ec31625c95d7df40231
if len(password) > 72 {
password = password[:72]
}
pwHashBytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
mtime := time.Now().Format(time.RFC3339)
if err != nil {
Expand Down

0 comments on commit 6ef601b

Please sign in to comment.