Base85: Update magic regexes to require 20 non-whitespace base85 chars

This commit is contained in:
Benedikt Werner 2020-05-22 03:30:57 +02:00
parent 1294d764e2
commit ee408f7add
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB

View File

@ -35,16 +35,31 @@ class FromBase85 extends Operation {
]; ];
this.checks = [ this.checks = [
{ {
pattern: "^\\s*(?:<~)?(?:(?:\\s*[!-u]){5}|\\s*z)+[!-u\\s]*(?:~>)?\\s*$", pattern:
args: ["!-u"] "^\\s*(?:<~)?" + // Optional whitespace and starting marker
"[\\s!-uz]*" + // Any amount of base85 characters and whitespace
"[!-uz]{20}" + // At least 20 continoues base85 characters without whitespace
"[\\s!-uz]*" + // Any amount of base85 characters and whitespace
"(?:~>)?\\s*$", // Optional ending marker and whitespace
args: ["!-u"],
}, },
{ {
pattern: "^(?:\\s*[0-9a-zA-Z.\\-:+=^!/*?&<>()[\\]{}@%$#])+\\s*$", pattern:
args: ["0-9a-zA-Z.\\-:+=^!/*?&<>()[]{}@%$#"] "^" +
"[\\s0-9a-zA-Z.\\-:+=^!/*?&<>()[\\]{}@%$#]*" +
"[0-9a-zA-Z.\\-:+=^!/*?&<>()[\\]{}@%$#]{20}" + // At least 20 continoues base85 characters without whitespace
"[\\s0-9a-zA-Z.\\-:+=^!/*?&<>()[\\]{}@%$#]*" +
"$",
args: ["0-9a-zA-Z.\\-:+=^!/*?&<>()[]{}@%$#"],
}, },
{ {
pattern: "^(?:\\s*[0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~])+\\s*$", pattern:
args: ["0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~"] "^" +
"[\\s0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~]*" +
"[0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~]{20}" + // At least 20 continoues base85 characters without whitespace
"[\\s0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~]*" +
"$",
args: ["0-9A-Za-z!#$%&()*+\\-;<=>?@^_`{|}~"],
}, },
]; ];
} }