Browse Source

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

pull/1671/head
Alessandro Ros 3 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 (
"strings" "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. // Credential is a parameter that is used as username or password.
type Credential string type Credential string
@ -29,7 +29,7 @@ func (d *Credential) UnmarshalJSON(b []byte) error {
if in != "" && if in != "" &&
!strings.HasPrefix(in, "sha256:") && !strings.HasPrefix(in, "sha256:") &&
!reCredential.MatchString(in) { !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) *d = Credential(in)

Loading…
Cancel
Save