fix sha512 hex length check

This commit is contained in:
Andrew Martinez
2021-08-18 14:34:29 -04:00
parent fa24821a84
commit 487bf0937e
2 changed files with 4 additions and 2 deletions
+1
View File
@@ -4,6 +4,7 @@
* Bug fix: Fabric v0.16.93 fixes `xgress.GetCircuit` to provide a `ctrl not ready` error response when requests arrive before the router is fully online.
* Bug fix: `ziti edge login` will no longer truncate paths on controller URLs
* Bug ifx: Ziti CLI will now longer check the proper lengths of sha512 hashes in hex format
# Release 0.22.0
@@ -373,6 +373,7 @@ func cleanHexString(in string) string {
}
func cleanSha512s(in []string) ([]string, error) {
const sha512HexLength = 128
hashMap := map[string]struct{}{}
for _, hash := range in {
@@ -383,8 +384,8 @@ func cleanSha512s(in []string) ([]string, error) {
}
cleanHash := cleanHexString(hash)
if len(cleanHash) != 64 {
return nil, fmt.Errorf("sha512 hash must be 64 hex characters, given [%s], cleaned [%s] with a length of %d", hash, cleanHash, len(cleanHash))
if len(cleanHash) != sha512HexLength {
return nil, fmt.Errorf("sha512 hash must be %d hex characters, given [%s], cleaned [%s] with a length of %d", sha512HexLength, hash, cleanHash, len(cleanHash))
}
hashMap[cleanHash] = struct{}{}