Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@
<artifactId>proto-google-common-protos</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.33</version>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

/**
* Parses preprocessor rules (organized by listening port)
Expand Down Expand Up @@ -211,7 +212,7 @@ public void loadFile(String filename) throws FileNotFoundException {
void loadFromStream(InputStream stream) {
totalValidRules = 0;
totalInvalidRules = 0;
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, ReportableEntityPreprocessor> portMap = new HashMap<>();
lockMetricsFilter.clear();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.junit.Assert;
import org.junit.Test;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import wavefront.report.ReportPoint;
import wavefront.report.Span;

Expand All @@ -25,7 +26,7 @@ public void testReportPointPreprocessorComparisonOps() {
InputStream stream =
PreprocessorRulesTest.class.getResourceAsStream("preprocessor_rules_predicates.yaml");
PreprocessorConfigManager config = new PreprocessorConfigManager();
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, Object> rulesByPort = yaml.load(stream);
ReportPoint point = null;
for (String comparisonOp : COMPARISON_OPS) {
Expand Down Expand Up @@ -91,7 +92,7 @@ public void testReportPointPreprocessorComparisonOpsList() {
InputStream stream =
PreprocessorRulesTest.class.getResourceAsStream("preprocessor_rules_predicates.yaml");
PreprocessorConfigManager config = new PreprocessorConfigManager();
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, Object> rulesByPort = (Map<String, Object>) yaml.load(stream);
ReportPoint point = null;
for (String comparisonOp : COMPARISON_OPS) {
Expand Down Expand Up @@ -157,7 +158,7 @@ public void testSpanPreprocessorComparisonOpsList() {
InputStream stream =
PreprocessorRulesTest.class.getResourceAsStream("preprocessor_rules_predicates.yaml");
PreprocessorConfigManager config = new PreprocessorConfigManager();
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, Object> rulesByPort = (Map<String, Object>) yaml.load(stream);
String spanLine =
"testSpanName source=spanSourceName spanId=4217104a-690d-4927-baff-d9aa779414c2 "
Expand Down Expand Up @@ -237,7 +238,7 @@ public void testSpanPreprocessorComparisonOps() {
InputStream stream =
PreprocessorRulesTest.class.getResourceAsStream("preprocessor_rules_predicates.yaml");
PreprocessorConfigManager config = new PreprocessorConfigManager();
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, Object> rulesByPort = (Map<String, Object>) yaml.load(stream);
String spanLine =
"testSpanName source=spanSourceName spanId=4217104a-690d-4927-baff-d9aa779414c2 "
Expand Down Expand Up @@ -317,7 +318,7 @@ public void testPreprocessorReportPointLogicalOps() {
InputStream stream =
PreprocessorRulesTest.class.getResourceAsStream("preprocessor_rules_predicates.yaml");
PreprocessorConfigManager config = new PreprocessorConfigManager();
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, Object> rulesByPort = yaml.load(stream);
List<Map<String, Object>> rules =
(List<Map<String, Object>>) rulesByPort.get("logicalop-reportpoint");
Expand Down Expand Up @@ -380,7 +381,7 @@ public void testPreprocessorSpanLogicalOps() {
InputStream stream =
PreprocessorRulesTest.class.getResourceAsStream("preprocessor_rules_predicates.yaml");
PreprocessorConfigManager config = new PreprocessorConfigManager();
Yaml yaml = new Yaml();
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, Object> rulesByPort = (Map<String, Object>) yaml.load(stream);
List<Map<String, Object>> rules = (List<Map<String, Object>>) rulesByPort.get("logicalop-span");
Assert.assertEquals("Expected rule size :: ", 1, rules.size());
Expand Down