Skip to content

Commit 279e173

Browse files
Merge pull request #833 from forcedotcom/dev-3
@W-11792858@: Release activity for v3.5.1 - Merging dev-3 to release-3
2 parents 51aaa93 + a6ef4b4 commit 279e173

21 files changed

+224
-17
lines changed

cli-messaging/src/main/java/com/salesforce/messaging/EventKey.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ public enum EventKey {
3838
WARNING_GENERAL("warning.sfgeWarnLog", 1, MessageType.WARNING, MessageHandler.UX, true),
3939
WARNING_MULTIPLE_METHOD_TARGET_MATCHES("warning.multipleMethodTargetMatches", 3, MessageType.WARNING, MessageHandler.UX, false),
4040
WARNING_NO_METHOD_TARGET_MATCHES("warning.noMethodTargetMatches", 2, MessageType.WARNING, MessageHandler.UX, false),
41-
ERROR_GENERAL("error.internal.sfgeErrorLog", 1, MessageType.ERROR, MessageHandler.UX, false);
41+
ERROR_GENERAL("error.internal.sfgeErrorLog", 1, MessageType.ERROR, MessageHandler.UX, false),
4242

43-
final String messageKey;
43+
/** GENERAL PURPOSE */
44+
INFO_TELEMETRY("info.telemetry", 1, MessageType.TELEMETRY, MessageHandler.INTERNAL, false);
45+
46+
final String messageKey;
4447
final int argCount;
4548
final MessageType messageType;
4649
final MessageHandler messageHandler;

cli-messaging/src/main/java/com/salesforce/messaging/Message.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ enum MessageHandler {
5757
}
5858

5959
enum MessageType {
60+
TELEMETRY,
6061
INFO,
6162
WARNING,
6263
ERROR

messages/EventKeyTemplates.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module.exports = {
1515
"sfgeFinishedBuildingGraph": "Added all compilation units to graph.",
1616
"sfgePathEntryPointsIdentified": "Identified %s path entry point(s).",
1717
"sfgeViolationsInPathProgress": "Detected %s violation(s) from %s path(s) on %s/%s entry point(s).",
18-
"sfgeCompletedPathAnalysis": "Overall, analyzed %s path(s) from %s entry point(s). Detected %s violation(s)."
18+
"sfgeCompletedPathAnalysis": "Overall, analyzed %s path(s) from %s entry point(s). Detected %s violation(s).",
19+
"telemetry": "This message is unused."
1920
},
2021
"warning": {
2122
"invalidCategorySkipped": "Cataloger: Skipping invalid PMD Category file '%s'.",

package.json

Lines changed: 1 addition & 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.5.0",
4+
"version": "3.5.1",
55
"author": "ISV SWAT",
66
"bugs": "https://github.com/forcedotcom/sfdx-scanner/issues",
77
"dependencies": {

retire-js/RetireJsVulns.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,7 @@
25922592
},
25932593
{
25942594
"below": "2.29.2",
2595-
"severity": "medium",
2595+
"severity": "high",
25962596
"identifiers": {
25972597
"summary": "This vulnerability impacts npm (server) users of moment.js, especially if user provided locale string, eg fr is directly used to switch moment locale.",
25982598
"CVE": [
@@ -2606,7 +2606,7 @@
26062606
{
26072607
"below": "2.29.4",
26082608
"atOrAbove": "2.18.0",
2609-
"severity": "medium",
2609+
"severity": "high",
26102610
"identifiers": {
26112611
"summary": "Regular Expression Denial of Service (ReDoS), Affecting moment package, versions >=2.18.0 <2.29.4",
26122612
"CVE": [
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.salesforce;
2+
3+
import com.salesforce.telemetry.TelemetryUtil;
4+
import java.io.Serializable;
5+
import org.apache.logging.log4j.Level;
6+
import org.apache.logging.log4j.core.*;
7+
import org.apache.logging.log4j.core.appender.AbstractAppender;
8+
import org.apache.logging.log4j.core.config.plugins.Plugin;
9+
import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
10+
import org.apache.logging.log4j.core.config.plugins.PluginElement;
11+
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
12+
import org.apache.logging.log4j.core.layout.PatternLayout;
13+
14+
/**
15+
* Custom log4j2 appender to send logs as telemetry events through {@link
16+
* com.salesforce.telemetry.TelemetryUtil}. This helps us capture telemetry events in response to
17+
* unsupported/pathological scenarios. Invoked from log4j2.xml
18+
*/
19+
@Plugin(
20+
name = "TelemetryAppender",
21+
category = Core.CATEGORY_NAME,
22+
elementType = Appender.ELEMENT_TYPE)
23+
public class TelemetryAppender extends AbstractAppender {
24+
@PluginFactory
25+
public static TelemetryAppender createAppender(
26+
@PluginAttribute("name") String name,
27+
@PluginElement("Layout") Layout<? extends Serializable> layout,
28+
@PluginElement("Filter") final Filter filter) {
29+
if (name == null) {
30+
// Assign default name to avoid complaining
31+
name = "TelemetryAppender";
32+
}
33+
if (layout == null) {
34+
layout = PatternLayout.createDefaultLayout();
35+
}
36+
return new TelemetryAppender(name, filter, layout, true);
37+
}
38+
39+
protected TelemetryAppender(
40+
String name,
41+
Filter filter,
42+
Layout<? extends Serializable> layout,
43+
final boolean ignoreExceptions) {
44+
super(name, filter, layout, ignoreExceptions, null);
45+
}
46+
47+
@Override
48+
public void append(LogEvent event) {
49+
Level level = event.getLevel();
50+
if (Level.WARN.equals(level)) {
51+
String eventMessage = event.getMessage().getFormattedMessage();
52+
if (eventMessage.toLowerCase().startsWith("todo:")) {
53+
TelemetryUtil.postWarningTelemetry(
54+
this.getLayout().toSerializable(event).toString(), event.getThrown());
55+
}
56+
}
57+
}
58+
}

sfge/src/main/java/com/salesforce/apex/jorje/JorjeUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static void visitComments(JorjeNode wrapper, CommentVisitor visitor) {
129129
}
130130
}
131131

132-
public static class JorjeCompilationException extends SfgeRuntimeException {
132+
public static final class JorjeCompilationException extends SfgeRuntimeException {
133133
JorjeCompilationException(String message) {
134134
super(message);
135135
}

sfge/src/main/java/com/salesforce/exception/DuplicateKeyException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.salesforce.exception;
22

33
/** Indicates a developer error where the same key was added to a map twice */
4-
public class DuplicateKeyException extends SfgeRuntimeException {
4+
public final class DuplicateKeyException extends SfgeRuntimeException {
55
public DuplicateKeyException(Object key, Object previousEntry, Object newEntry) {
66
super("Duplicate keys. key=" + key + ", previous=" + previousEntry + ", new=" + newEntry);
77
}

sfge/src/main/java/com/salesforce/exception/ProgrammingException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.salesforce.exception;
22

33
/** Indicates a programming logic error, such as an item being initialized more than once. */
4-
public class ProgrammingException extends SfgeRuntimeException {
4+
public final class ProgrammingException extends SfgeRuntimeException {
55
public ProgrammingException(String message) {
66
super(message);
77
}

sfge/src/main/java/com/salesforce/exception/SfgeInterruptedException.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
* stop. Any long running methods should periodically invoke {@link Thread#interrupted()} and throw
66
* this exception if appropriate.
77
*/
8-
public final class SfgeInterruptedException extends SfgeRuntimeException {}
8+
public final class SfgeInterruptedException extends SfgeRuntimeException {
9+
public SfgeInterruptedException() {
10+
super();
11+
}
12+
}

0 commit comments

Comments
 (0)