Merge pull request #133 from BytewaveMLP/security-random-values

Update secret/token security checks
This commit is contained in:
Eliot Partridge
2019-09-18 18:50:16 -05:00
committed by GitHub
+9 -4
View File
@@ -58,15 +58,20 @@ export const args = argv as AppArgs;
export const { version, description }: AppPackage = require('../../../package.json'); export const { version, description }: AppPackage = require('../../../package.json');
export const config: AppConfig = require('../../../config.json'); export const config: AppConfig = require('../../../config.json');
const INSECURE_RANDOM_VALUES = [
'gfhfdshtrdhgedryhe4t3y5uwjthr',
'sdlfgihsdor8ghor8dgdrgdegrdg',
'<some_random_string_here>',
'<some_other_random_string_here>',
];
if (!DEVELOPMENT && !TESTS && if (!DEVELOPMENT && !TESTS &&
(!config.secret || !config.token (!config.secret || !config.token
|| config.secret.length < 16 || config.secret.length < 16
|| config.token.length < 16 || config.token.length < 16
|| config.secret === config.token || config.secret === config.token
|| config.secret === 'gfhfdshtrdhgedryhe4t3y5uwjthr' || INSECURE_RANDOM_VALUES.includes(config.secret)
|| config.token === 'sdlfgihsdor8ghor8dgdrgdegrdg' || INSECURE_RANDOM_VALUES.includes(config.token))) {
|| config.secret === '<some_random_string_here>'
|| config.token === '<some_random_string_here>')) {
console.error( console.error(
` `
================================================================================ ================================================================================