Browse Source

allow additional characters in usernames and passwords (#1580) (#1666)

pull/1671/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
e426810455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      internal/conf/credential.go

6
internal/conf/credential.go

@ -7,9 +7,9 @@ import ( @@ -7,9 +7,9 @@ import (
"strings"
)
var reCredential = regexp.MustCompile(`^[a-zA-Z0-9!\$\(\)\*\+\.;<=>\[\]\^_\-\{\}]+$`)
var reCredential = regexp.MustCompile(`^[a-zA-Z0-9!\$\(\)\*\+\.;<=>\[\]\^_\-\{\}@#&]+$`)
const credentialSupportedChars = "A-Z,0-9,!,$,(,),*,+,.,;,<,=,>,[,],^,_,-,{,}"
const credentialSupportedChars = "A-Z,0-9,!,$,(,),*,+,.,;,<,=,>,[,],^,_,-,\",\",@,#,&"
// Credential is a parameter that is used as username or password.
type Credential string
@ -29,7 +29,7 @@ func (d *Credential) UnmarshalJSON(b []byte) error { @@ -29,7 +29,7 @@ func (d *Credential) UnmarshalJSON(b []byte) error {
if in != "" &&
!strings.HasPrefix(in, "sha256:") &&
!reCredential.MatchString(in) {
return fmt.Errorf("contains unsupported characters (supported are %s)", credentialSupportedChars)
return fmt.Errorf("credential contains unsupported characters. Supported are: %s", credentialSupportedChars)
}
*d = Credential(in)

Loading…
Cancel
Save