From 05ae386b7957961023c19b01ac618e665acd51e8 Mon Sep 17 00:00:00 2001 From: Seba Kerckhof Date: Sat, 3 Nov 2018 21:14:47 +0100 Subject: [PATCH] Sanitize compiler name for environment variables (#10270) While strictly speaking more characters are allowed, they are not usable in a shell except for uppercase / digits / underscore. ( https://stackoverflow.com/a/2821183 ) --- packages/caching-compiler/caching-compiler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/caching-compiler/caching-compiler.js b/packages/caching-compiler/caching-compiler.js index e29e1362e5..670841773d 100644 --- a/packages/caching-compiler/caching-compiler.js +++ b/packages/caching-compiler/caching-compiler.js @@ -13,7 +13,9 @@ CachingCompilerBase = class CachingCompilerBase { }) { this._compilerName = compilerName; this._maxParallelism = maxParallelism; - const envVarPrefix = 'METEOR_' + compilerName.toUpperCase() + '_CACHE_'; + const compilerNameForEnvar = compilerName.toUpperCase() + .replace('/-/g', '_').replace(/[^A-Z0-9_]/g, ''); + const envVarPrefix = 'METEOR_' + compilerNameForEnvar + '_CACHE_'; const debugEnvVar = envVarPrefix + 'DEBUG'; this._cacheDebugEnabled = !! process.env[debugEnvVar];