From 571f4e6d077f7f21c6aed655ae380d85a7a5d3b8 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 8 Jan 2020 03:35:58 +0200 Subject: [PATCH] common name sanitization --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index fa3ef3b..ce366d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import fs = require('fs'); export default async function generateDevCert (commonName: string) { if (!commandExists.sync('openssl')) throw new Error('Unable to find openssl - make sure it is installed and available in your PATH'); - if (!commonName.match(/^(.|\.){1,64}$/)) + if (!commonName.match(/^(a-zA-Z0-9|\.){1,64}$/)) throw new Error(`Invalid Common Name ${commonName}.`); try { const opensslConfPath = generateOpensslConf(commonName);