@opscompass/opscompass-cli 1.0.43 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils.js +8 -3
- package/modules/license-manager.js +1 -1
- package/package.json +2 -2
package/lib/utils.js
CHANGED
|
@@ -24,6 +24,7 @@ const findRemoveSync = require("find-remove");
|
|
|
24
24
|
const HOBKEY = Buffer.from(`${decoder}=`, "base64").toString();
|
|
25
25
|
const hashPrefix = "oc$hash:"; // Prefix for encrypted values
|
|
26
26
|
const hashRegex = /^oc\$hash:/; // Regex for encrypted values
|
|
27
|
+
const obfuscatedRegex = /^oc\$(hash|mask)/; // Regex for encrypted or masked values
|
|
27
28
|
|
|
28
29
|
// Test for any null or undefined objects
|
|
29
30
|
function hasNullOrUndefined(obj, count = Object.keys(obj).length) {
|
|
@@ -263,7 +264,7 @@ function getConfigFilePath(args = []) {
|
|
|
263
264
|
* Function read a configuration file
|
|
264
265
|
* @param {string}[] args - license-manager arguments
|
|
265
266
|
*/
|
|
266
|
-
function readConfigFile(args) {
|
|
267
|
+
async function readConfigFile(args) {
|
|
267
268
|
const cfgFile = getConfigFilePath(args);
|
|
268
269
|
if (!cfgFile) return undefined;
|
|
269
270
|
|
|
@@ -279,6 +280,10 @@ function readConfigFile(args) {
|
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
decryptValues(cfgFile);
|
|
283
|
+
// Also unmask the cfg file here - in case there are masked values
|
|
284
|
+
const { unmaskObjValues } = require("./maskValues");
|
|
285
|
+
await unmaskObjValues(cfgFile);
|
|
286
|
+
|
|
282
287
|
return cfgFile;
|
|
283
288
|
}
|
|
284
289
|
|
|
@@ -602,8 +607,8 @@ function encryptValues(config) {
|
|
|
602
607
|
for (const resource of config[resType]) {
|
|
603
608
|
for (const attr of Object.keys(encryptAttrs)) {
|
|
604
609
|
if (resource.hasOwnProperty(attr) && resource[attr] !== null) {
|
|
605
|
-
// If this is a sensitive value and it is not already
|
|
606
|
-
if (!resource[attr].match(
|
|
610
|
+
// If this is a sensitive value and it is not already obfuscated
|
|
611
|
+
if (!resource[attr].match(obfuscatedRegex)) {
|
|
607
612
|
resource[attr] = encryptAES(resource[attr]);
|
|
608
613
|
// console.error("Encrypted attribute %s: %s ", attr, resource[attr]);
|
|
609
614
|
}
|
|
@@ -356,7 +356,7 @@ async function readMonitoringConfiguration(args) {
|
|
|
356
356
|
} else console.log("undefined");
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
|
-
const monitoringConfig = utils.readConfigFile(args);
|
|
359
|
+
const monitoringConfig = await utils.readConfigFile(args);
|
|
360
360
|
if (monitoringConfig) {
|
|
361
361
|
console.log(JSON.stringify(monitoringConfig, null, 2));
|
|
362
362
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opscompass/opscompass-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"description": "Calls OpsCompass's APIs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"author": "opscompass",
|
|
17
17
|
"license": "SEE LICENSE IN license.txt",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@opscompass/opscompass-api": "^1.0.
|
|
19
|
+
"@opscompass/opscompass-api": "^1.0.43",
|
|
20
20
|
"adm-zip": "^0.5.16",
|
|
21
21
|
"axios": "^0.28.1",
|
|
22
22
|
"better-sqlite3": "^11.8.0",
|