@xliic/cicd-core-node
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -39,39 +39,40 @@ "use strict"; | ||
let failureConditions = DEFAULT_FAILURE_CONDITIONS; | ||
let audit = {}; | ||
const confFilePath = path.join(rootDir, CONF_FILE); | ||
if (!fs.existsSync(confFilePath) && mandatoryConfig) { | ||
if (fs.existsSync(confFilePath)) { | ||
audit = readBranchConfig(branchName, parse_1.parseYaml(rootDir, CONF_FILE), confFilePath); | ||
} | ||
else if (mandatoryConfig) { | ||
throw new ConfigError(`Config file ${CONF_FILE} is not found`); | ||
} | ||
else { | ||
const audit = readBranchConfig(branchName, parse_1.parseYaml(rootDir, CONF_FILE), confFilePath); | ||
if (typeof (audit === null || audit === void 0 ? void 0 : audit.discovery) === "boolean") { | ||
if (audit.discovery) { | ||
// discover files but do not audit | ||
discoveryPatterns = DEFAULT_PATTERNS; | ||
auditDiscovered = false; | ||
} | ||
else { | ||
// discovery is fully disabled | ||
discoveryPatterns = null; | ||
auditDiscovered = false; | ||
} | ||
if (typeof (audit === null || audit === void 0 ? void 0 : audit.discovery) === "boolean") { | ||
if (audit.discovery) { | ||
// discover files but do not audit | ||
discoveryPatterns = DEFAULT_PATTERNS; | ||
auditDiscovered = false; | ||
} | ||
else { | ||
discoveryPatterns = | ||
typeof ((_a = audit.discovery) === null || _a === void 0 ? void 0 : _a.search) === "object" | ||
? audit.discovery.search | ||
: DEFAULT_PATTERNS; | ||
auditDiscovered = | ||
typeof ((_b = audit.discovery) === null || _b === void 0 ? void 0 : _b.audit) === "boolean" | ||
? audit.discovery.audit | ||
: false; | ||
// discovery is fully disabled | ||
discoveryPatterns = null; | ||
auditDiscovered = false; | ||
} | ||
// mapping section | ||
if (audit === null || audit === void 0 ? void 0 : audit.mapping) { | ||
mappedFiles = checkMappedFiles(audit.mapping); | ||
} | ||
// failure conditions | ||
if (audit.fail_on) { | ||
failureConditions = Object.assign(Object.assign({}, failureConditions), audit.fail_on); | ||
} | ||
} | ||
else { | ||
discoveryPatterns = | ||
typeof ((_a = audit.discovery) === null || _a === void 0 ? void 0 : _a.search) === "object" | ||
? audit.discovery.search | ||
: DEFAULT_PATTERNS; | ||
auditDiscovered = | ||
typeof ((_b = audit.discovery) === null || _b === void 0 ? void 0 : _b.audit) === "boolean" | ||
? audit.discovery.audit | ||
: false; | ||
} | ||
// mapping section | ||
if (audit === null || audit === void 0 ? void 0 : audit.mapping) { | ||
mappedFiles = checkMappedFiles(audit.mapping); | ||
} | ||
// failure conditions | ||
if (audit.fail_on) { | ||
failureConditions = Object.assign(Object.assign({}, failureConditions), audit.fail_on); | ||
} | ||
return { auditDiscovered, discoveryPatterns, mappedFiles, failureConditions }; | ||
@@ -78,0 +79,0 @@ } |
{ | ||
"name": "@xliic/cicd-core-node", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Performs API contract security audit to get a detailed analysis of the possible vulnerabilities and other issues in the API contract.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -50,8 +50,8 @@ /* | ||
let failureConditions: FailureConditions = DEFAULT_FAILURE_CONDITIONS; | ||
let audit: AuditConfig = {}; | ||
const confFilePath = path.join(rootDir, CONF_FILE); | ||
if (!fs.existsSync(confFilePath) && mandatoryConfig) { | ||
throw new ConfigError(`Config file ${CONF_FILE} is not found`); | ||
} else { | ||
const audit = readBranchConfig( | ||
if (fs.existsSync(confFilePath)) { | ||
audit = readBranchConfig( | ||
branchName, | ||
@@ -61,33 +61,35 @@ parseYaml(rootDir, CONF_FILE), | ||
); | ||
} else if (mandatoryConfig) { | ||
throw new ConfigError(`Config file ${CONF_FILE} is not found`); | ||
} | ||
if (typeof audit?.discovery === "boolean") { | ||
if (audit.discovery) { | ||
// discover files but do not audit | ||
discoveryPatterns = DEFAULT_PATTERNS; | ||
auditDiscovered = false; | ||
} else { | ||
// discovery is fully disabled | ||
discoveryPatterns = null; | ||
auditDiscovered = false; | ||
} | ||
if (typeof audit?.discovery === "boolean") { | ||
if (audit.discovery) { | ||
// discover files but do not audit | ||
discoveryPatterns = DEFAULT_PATTERNS; | ||
auditDiscovered = false; | ||
} else { | ||
discoveryPatterns = | ||
typeof audit.discovery?.search === "object" | ||
? audit.discovery.search | ||
: DEFAULT_PATTERNS; | ||
auditDiscovered = | ||
typeof audit.discovery?.audit === "boolean" | ||
? audit.discovery.audit | ||
: false; | ||
// discovery is fully disabled | ||
discoveryPatterns = null; | ||
auditDiscovered = false; | ||
} | ||
} else { | ||
discoveryPatterns = | ||
typeof audit.discovery?.search === "object" | ||
? audit.discovery.search | ||
: DEFAULT_PATTERNS; | ||
auditDiscovered = | ||
typeof audit.discovery?.audit === "boolean" | ||
? audit.discovery.audit | ||
: false; | ||
} | ||
// mapping section | ||
if (audit?.mapping) { | ||
mappedFiles = checkMappedFiles(audit.mapping); | ||
} | ||
// mapping section | ||
if (audit?.mapping) { | ||
mappedFiles = checkMappedFiles(audit.mapping); | ||
} | ||
// failure conditions | ||
if (audit.fail_on) { | ||
failureConditions = { ...failureConditions, ...audit.fail_on }; | ||
} | ||
// failure conditions | ||
if (audit.fail_on) { | ||
failureConditions = { ...failureConditions, ...audit.fail_on }; | ||
} | ||
@@ -94,0 +96,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
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
2961
137386