wickrio-bot-api
Advanced tools
Comparing version 5.82.2 to 5.82.3
{ | ||
"name": "wickrio-bot-api", | ||
"version": "5.82.2", | ||
"version": "5.82.3", | ||
"description": "The official Wickr IO Bot API Framework", | ||
@@ -5,0 +5,0 @@ "main": "src/WickrIOBot.js", |
@@ -143,19 +143,21 @@ const WickrIOAPI = require('wickrio_addon') | ||
const processes = JSON.parse(fs.readFileSync('processes.json')) | ||
const tokens = JSON.parse(process.env.tokens) | ||
let administrators | ||
if (tokens.ADMINISTRATORS_CHOICE && tokens.ADMINISTRATORS_CHOICE.value === 'yes' && | ||
tokens.ADMINISTRATORS && tokens.ADMINISTRATORS.value) { | ||
if (tokens.ADMINISTRATORS.encrypted) { | ||
administrators = WickrIOAPI.cmdDecryptString( | ||
tokens.ADMINISTRATORS.value | ||
) | ||
} else { | ||
administrators = tokens.ADMINISTRATORS.value | ||
} | ||
administrators = administrators.split(/[ ,]+/) | ||
if (process.env.tokens !== undefined) { | ||
const tokens = JSON.parse(process.env.tokens) | ||
let administrators | ||
if (tokens.ADMINISTRATORS_CHOICE && tokens.ADMINISTRATORS_CHOICE.value === 'yes' && | ||
tokens.ADMINISTRATORS && tokens.ADMINISTRATORS.value) { | ||
if (tokens.ADMINISTRATORS.encrypted) { | ||
administrators = WickrIOAPI.cmdDecryptString( | ||
tokens.ADMINISTRATORS.value | ||
) | ||
} else { | ||
administrators = tokens.ADMINISTRATORS.value | ||
} | ||
administrators = administrators.split(/[ ,]+/) | ||
// Make sure there are no white spaces on the whitelisted users | ||
for (let i = 0; i < administrators.length; i++) { | ||
const administrator = administrators[i].trim() | ||
const admin = myLocalAdmins.addAdmin(administrator) | ||
// Make sure there are no white spaces on the whitelisted users | ||
for (let i = 0; i < administrators.length; i++) { | ||
const administrator = administrators[i].trim() | ||
const admin = myLocalAdmins.addAdmin(administrator) | ||
} | ||
} | ||
@@ -272,2 +274,5 @@ } | ||
async encryptEnv() { | ||
if (process.env.tokens === undefined) { | ||
return true | ||
} | ||
try { | ||
@@ -490,3 +495,8 @@ const processes = JSON.parse(fs.readFileSync('processes.json')) | ||
parseMessage(message) { | ||
const tokens = JSON.parse(process.env.tokens) | ||
let tokens | ||
if (process.env.tokens !== undefined) { | ||
tokens = JSON.parse(process.env.tokens) | ||
} else { | ||
tokens = {} | ||
} | ||
message = JSON.parse(message) | ||
@@ -872,2 +882,24 @@ const { edit, control, msg_ts, time, receiver, sender, ttl, bor } = message | ||
} | ||
/* | ||
* copy processes.json tokens to process.env | ||
*/ | ||
processesJsonToProcessEnv() { | ||
console.log('Copying processes.json tokens to process.env') | ||
// Read in the processes.json file | ||
const processesJsonFile = path.join(process.cwd(), 'processes.json') | ||
if (!fs.existsSync(processesJsonFile)) { | ||
console.error(processesJsonFile + ' does not exist!') | ||
return false | ||
} | ||
const processesJson = fs.readFileSync(processesJsonFile); | ||
//console.log('processes.json=' + processesJson) | ||
const processesJsonObject = JSON.parse(processesJson) | ||
process.env['tokens'] = JSON.stringify(processesJsonObject.apps[0].env.tokens) | ||
//console.log('end process.env=' + JSON.stringify(process.env)) | ||
//console.log('end process.env.tokens=' + process.env.tokens) | ||
return true | ||
} | ||
} | ||
@@ -874,0 +906,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115391
2625
19