mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-20 23:28:58 +00:00
improve armor header validation + tests | #598
This commit is contained in:
@@ -224,7 +224,7 @@ function splitHeaders(text) {
|
||||
*/
|
||||
function verifyHeaders(headers) {
|
||||
for (var i = 0; i < headers.length; i++) {
|
||||
if (!/^[^:\s]+: .+$/.test(headers[i])) {
|
||||
if (!/^([^\s:]|[^\s:][^:]*[^\s:]): .+$/.test(headers[i])) {
|
||||
throw new Error('Improperly formatted armor header: ' + headers[i]);
|
||||
}
|
||||
if (config.debug && !/^(Version|Comment|MessageID|Hash|Charset): .+$/.test(headers[i])) {
|
||||
|
||||
Reference in New Issue
Block a user