Skip to content

Commit 51aaa93

Browse files
authored
Merge pull request #823 from forcedotcom/dev-3
@W-11732835@: Merging dev-3 to release-3 in preparation for v3.5.0 release.
2 parents 6875a57 + 71958a8 commit 51aaa93

33 files changed

+732
-241
lines changed

messages/EventKeyTemplates.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
"info": {
33
"categoryImplicitlyRun": "Implicitly including %s rules from category '%s'",
4-
"jarAndXmlProcessed": "XML files collected from JAR [%s]: %s",
4+
"jarAndXmlProcessed": "Cataloger: XML files collected from JAR [%s]: %s",
55
"usingEngineConfigFile": "Using engine configuration file at %s",
66
"generalInternalLog": "Log from Java: %s",
77
"customEslintHeadsUp": "About to run Eslint with custom config in %s. Please make sure your current directory has all the required NPM dependencies.",
@@ -18,9 +18,9 @@ module.exports = {
1818
"sfgeCompletedPathAnalysis": "Overall, analyzed %s path(s) from %s entry point(s). Detected %s violation(s)."
1919
},
2020
"warning": {
21-
"invalidCategorySkipped": "Cataloger skipped invalid PMD Category file '%s'.",
22-
"invalidRulesetSkipped": "Cataloger skipped invalid PMD Ruleset file '%s'.",
23-
"xmlDropped": "Dropping XML file [%s] since its path does not conform to Rulesets or Category.",
21+
"invalidCategorySkipped": "Cataloger: Skipping invalid PMD Category file '%s'.",
22+
"invalidRulesetSkipped": "Cataloger: Skipping invalid PMD Ruleset file '%s'.",
23+
"xmlDropped": "Cataloger: Dropping XML file [%s] since its path does not conform to Rulesets or Category.",
2424
"langMarkedForDeprecation": "Future releases will not include PMD support for %s. If this would cause you hardship, please log an issue on github.com/forcedotcom/sfdx-scanner",
2525
"customRuleFileNotFound": "Custom rule file path [%s] for language [%s] was not found.",
2626
"pmdSkippedFile": "PMD failed to evaluate against file '%s'. Message: %s",
@@ -49,7 +49,8 @@ module.exports = {
4949
"recursionLimitReached": "ERROR: PMD Ruleset [%s] references rule [%s] through 10 or more layers of indirection. Please reduce this number.",
5050
"xmlNotReadable": "ERROR: Error occurred while reading file [%s]: %s",
5151
"xmlNotParsable": "ERROR: Could not parse XML file [%s]: %s",
52-
"duplicateXmlPath": "ERROR: XML path [%s] defined in jar [%s] collides with previously defined path in jar [%s]. You will need to remove one of the jars by executing the following command 'sfdx scanner:rule:remove --force --path <jar-to-remove>'"
52+
"duplicateXmlPath": "ERROR: XML path [%s] defined in jar [%s] collides with previously defined path in jar [%s]. You will need to remove one of the jars by executing the following command 'sfdx scanner:rule:remove --force --path <jar-to-remove>'",
53+
"sfgeIncompleteAnalysis": "ERROR: SFGE encountered an error and couldn't complete analysis: %s"
5354
}
5455
}
5556

messages/run-dfa.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module.exports = {
2020
"rulethreadtimeoutDescriptionLong": "Time limit for evaluating a single entrypoint. Value in milliseconds. Inherits from SFGE_RULE_THREAD_TIMEOUT env-var if set. Default is 900,000 ms, or 15 minutes.",
2121
"sevthresholdDescription": "throws an error when violations of specific severity (or more severe) are detected, invokes --normalize-severity",
2222
"sevthresholdDescriptionLong": "Throws an error if violations are found with equal or greater severity than provided value. Values are 1 (high), 2 (moderate), and 3 (low). Exit code is the most severe violation. Using this flag also invokes the --normalize-severity flag",
23+
"sfgejvmargsDescription": "JVM arguments to optimize SFGE execution to your system",
24+
"sfgejvmargsDescriptionLong": "Specify JVM arguments to override system defaults while executing SFGE. For multiple arguments, add them to the same string separated by space.",
2325
"targetDescription": "location of source code",
2426
"targetDescriptionLong": "Source code location. May use glob patterns, or specify individual methods with #-syntax. Multiple values can be specified as a comma-separated list"
2527
},
@@ -47,9 +49,12 @@ module.exports = {
4749
Use --severity-threshold to throw a non-zero exit code when rule violations of a specific normalized severity (or greater) are found. For this example, if there are any rule violations with a severity of 2 or more (which includes 1-high and 2-moderate), the exit code will be equal to the severity of the most severe violation.
4850
E.g., $ sfdx scanner:run:dfa --target "/some-project/" --projectdir "/some-project/" --severity-threshold 2
4951
Use --rule-thread-count to allow more (or fewer) entrypoints to be evaluated concurrently.
50-
E.g., $ sfdx scanner:run:dfa --rule-thread-count 6
52+
E.g., $ sfdx scanner:run:dfa --rule-thread-count 6 ...
5153
Use --rule-thread-timeout to increase (or decrease) the maximum runtime for a single entrypoint evaluation.
5254
E.g., $ sfdx scanner:run:dfa --rule-thread-timeout 9000000 ...
5355
Increases timeout from 15 minutes (default) to 150 minutes.
56+
Use --sfgejvmargs to pass JVM args to override system defaults while executing Salesforce Graph Engine's rules.
57+
E.g., $ sfdx scanner:run:dfa --sfgejvmargs "-Xmx8g" ...
58+
Overrides system's default heapspace allocation to 8g and decreases chances of encountering OutOfMemory error.
5459
`
5560
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/sfdx-scanner",
33
"description": "Static code scanner that applies quality and security rules to Apex code, and provides feedback.",
4-
"version": "3.4.0",
4+
"version": "3.5.0",
55
"author": "ISV SWAT",
66
"bugs": "https://github.com/forcedotcom/sfdx-scanner/issues",
77
"dependencies": {
@@ -40,6 +40,7 @@
4040
"tsyringe": "^4.1.0",
4141
"typescript": "^4.6.2",
4242
"untildify": "^4.0.0",
43+
"uuid": "^9.0.0",
4344
"word-wrap": "^1.2.3",
4445
"xml-js": "^1.6.11"
4546
},
@@ -71,6 +72,7 @@
7172
"@types/sarif": "^2.1.4",
7273
"@types/semver": "^7.3.9",
7374
"@types/tmp": "^0.2.3",
75+
"@types/uuid": "^8.3.4",
7476
"chai": "^4",
7577
"eslint": "^8.10.0",
7678
"mocha": "^9",

retire-js/RetireJsVulns.json

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2602,11 +2602,60 @@
26022602
"info": [
26032603
"https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4"
26042604
]
2605+
},
2606+
{
2607+
"below": "2.29.4",
2608+
"atOrAbove": "2.18.0",
2609+
"severity": "medium",
2610+
"identifiers": {
2611+
"summary": "Regular Expression Denial of Service (ReDoS), Affecting moment package, versions >=2.18.0 <2.29.4",
2612+
"CVE": [
2613+
"CVE-2022-31129"
2614+
]
2615+
},
2616+
"info": [
2617+
"https://security.snyk.io/vuln/SNYK-JS-MOMENT-2944238",
2618+
"https://github.com/moment/moment/security/advisories/GHSA-wc69-rhjr-hc9g"
2619+
]
2620+
}
2621+
],
2622+
"extractors": {
2623+
"uri": [
2624+
"/moment\\.js/(§§version§§)/moment(.min)?\\.js"
2625+
],
2626+
"filecontent": [
2627+
"//! moment.js(?:[\n\r]+)//! version : (§§version§§)",
2628+
"\\.version=\"(§§version§§)\".{300,500}\\.isMoment="
2629+
]
2630+
}
2631+
},
2632+
"underscore.js": {
2633+
"bowername": [
2634+
"Underscore",
2635+
"underscore"
2636+
],
2637+
"vulnerabilities": [
2638+
{
2639+
"below": "1.12.1",
2640+
"atOrAbove": "1.3.2",
2641+
"severity": "High",
2642+
"identifiers": {
2643+
"summary": " vulnerable to Arbitrary Code Injection via the template function",
2644+
"CVE": [
2645+
"CVE-2021-23358"
2646+
]
2647+
},
2648+
"info": [
2649+
"https://nvd.nist.gov/vuln/detail/CVE-2021-23358"
2650+
]
26052651
}
26062652
],
26072653
"extractors": {
2654+
"uri": [
2655+
"/underscore\\.js/(§§version§§)/underscore(-min)?\\.js"
2656+
],
26082657
"filecontent": [
2609-
"//! moment.js(?:[\n\r]+)//! version : (§§version§§)"
2658+
"//[\\s]*Underscore.js (§§version§§)"
26102659
]
26112660
}
26122661
},

sfge/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ dependencies {
2828
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.2")
2929
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.2")
3030
testImplementation("org.junit.jupiter:junit-jupiter-params:5.7.2")
31+
testImplementation("org.mockito:mockito-core:2.21.0")
32+
testImplementation("org.mockito:mockito-junit-jupiter:2.23.0")
3133
}
3234

3335
group = "com.salesforce.apex"

sfge/src/main/java/com/salesforce/CliMessagerAppender.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,17 @@ protected CliMessagerAppender(
6262
@Override
6363
public void append(LogEvent event) {
6464
Level level = event.getLevel();
65-
if (Level.WARN.equals(level) && this.shouldLogWarningsOnVerbose) {
66-
CliMessager.postMessage(
67-
"SFGE Warning as Info", EventKey.INFO_GENERAL, getEventMessage(event));
65+
if (Level.WARN.equals(level)) {
66+
if (this.shouldLogWarningsOnVerbose) {
67+
CliMessager.postMessage(
68+
"SFGE Warning as Info", EventKey.INFO_GENERAL, getEventMessage(event));
69+
}
6870
} else if (Level.ERROR.equals(level)) {
6971
CliMessager.postMessage(
7072
"SFGE Error as Warning", EventKey.WARNING_GENERAL, getEventMessage(event));
7173
} else if (Level.FATAL.equals(level)) {
7274
CliMessager.postMessage(
7375
"SFGE Fatal as Error", EventKey.ERROR_GENERAL, getEventMessage(event));
74-
} else {
75-
error(
76-
String.format(
77-
"Unable to log less than WARN level [{}]: {}",
78-
event.getLevel(),
79-
getEventMessage(event)));
8076
}
8177
}
8278

0 commit comments

Comments
 (0)