Skip to content

Commit 0e34d82

Browse files
authored
Merge pull request #60 from scalyr/log4JUpdate
Address Log4J Arbitrary Code Execution Exploit
2 parents 048a7c2 + eb56a62 commit 0e34d82

File tree

7 files changed

+54
-52
lines changed

7 files changed

+54
-52
lines changed

.circleci/config.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ version: 2.1
66
parameters:
77
scalyr_sink_version: # scalyr_sink_version needs to be updated on every new version release.
88
type: string
9-
default: "1.3"
9+
default: "1.4"
1010

1111
jobs: # a collection of steps
1212
build: # runs not using Workflows must have a `build` job as entry point
1313

1414
working_directory: ~/circleci-kafka-connect-scalyr # directory where steps will run
1515

1616
docker: # run the steps with Docker
17-
- image: circleci/openjdk:8-jdk-stretch # ...with this image as the primary container; this is where all `steps` will run
17+
- image: cimg/openjdk:11.0 # ...with this image as the primary container; this is where all `steps` will run
1818

1919
steps: # a collection of executable commands
2020

@@ -39,14 +39,6 @@ jobs: # a collection of steps
3939

4040
- setup_remote_docker
4141

42-
- run: # Python dependencies for System Test
43-
name: Python Dependencies
44-
command: |
45-
set -x
46-
sudo apt update
47-
sudo apt install python-pip
48-
pip install requests
49-
5042
- run:
5143
name: System Test
5244
command: |
@@ -61,10 +53,10 @@ jobs: # a collection of steps
6153
.circleci/configure_scalyr_connector.sh
6254
6355
# Verify logs are in Scalyr
64-
python .circleci/verify_scalyr_events.py dataset=\'accesslog\'
65-
python .circleci/verify_scalyr_events.py app=\'customApp\'
66-
python .circleci/verify_scalyr_events.py tag=\'fluentd-apache\'
67-
python .circleci/verify_scalyr_events.py tag=\'fluentbit-cpu\' 50
56+
python3 .circleci/verify_scalyr_events.py dataset=\'accesslog\'
57+
python3 .circleci/verify_scalyr_events.py app=\'customApp\'
58+
python3 .circleci/verify_scalyr_events.py tag=\'fluentd-apache\'
59+
python3 .circleci/verify_scalyr_events.py tag=\'fluentbit-cpu\' 50
6860
6961
- store_test_results: # uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard.
7062
# Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/

.circleci/verify_scalyr_events.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Copyright 2014-2020 Scalyr Inc.
1+
#!/usr/bin/env python3
2+
# Copyright 2014-2021 Scalyr Inc.
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
45
# you may not use this file except in compliance with the License.
@@ -106,10 +107,10 @@ def check_scalyr_events(additional_filter, expected_num_events):
106107

107108
print("Query returned {0} Scalyr events".format(matches))
108109
if not has_expected_session_attrs:
109-
print "Session attributes incorrect!"
110+
print("Session attributes incorrect!")
110111

111112
if not has_expected_event_attrs:
112-
print "Event attributes incorrect!"
113+
print("Event attributes incorrect!")
113114

114115
return matches == expected_num_events and has_expected_session_attrs and has_expected_event_attrs
115116

CHANGELOG.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
# Kafka Connect Scalyr Sink Connector Changes by Release
22

3+
## 1.4
4+
5+
* Address Log4J Arbitrary Code Execution exploit by upgrading to log4j v2.15.0. For more information on the vulnerability
6+
see upstream log4j CVE https://nvd.nist.gov/vuln/detail/CVE-2021-44228.
7+
8+
## 1.3
9+
10+
Features
11+
* Regular expression support for custom application event mapping `matcher.value`.
12+
* `matchAll` support for custom application event mapping matcher.
13+
14+
## 1.2
15+
16+
* Allow not specifying application attribute fields in custom application event mappings when `send_entire_record` is `true`.
17+
* Change default `batch_send_size_bytes` to 5 MB.
18+
19+
## 1.1
20+
Performance improvements for JSON serialization.
21+
322
## 1.0
23+
424
Initial Release
525

626
Features:
727
* Supports Elastic Filebeat log messages with automatic conversion of Filebeat log messages to Scalyr log events.
828
* Supports custom application log messages using user defined conversion of message fields to Scalyr log event attributes.
929
* Supports Fluentd and Fluent Bit using custom application event mappings.
1030
* Exactly once delivery using the topic, partition, and offset to uniquely identify events and prevent duplicate delivery.
11-
12-
## 1.1
13-
Performance improvements for JSON serialization.
14-
15-
## 1.2
16-
* Allow not specifying application attribute fields in custom application event mappings when `send_entire_record` is `true`.
17-
* Change default `batch_send_size_bytes` to 5 MB.
18-
19-
## 1.3
20-
Features
21-
* Regular expression support for custom application event mapping `matcher.value`.
22-
* `matchAll` support for custom application event mapping matcher.

docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
version: '3'
99
services:
1010
zookeeper:
11-
image: confluentinc/cp-zookeeper:5.4.3
11+
image: confluentinc/cp-zookeeper:6.1.0
1212
container_name: zookeeper
1313
environment:
1414
ZOOKEEPER_CLIENT_PORT: 2181
1515
ZOOKEEPER_TICK_TIME: 2000
1616

1717
kafka:
18-
image: confluentinc/cp-kafka:5.4.3
18+
image: confluentinc/cp-kafka:6.1.0
1919
container_name: kafka
2020
depends_on:
2121
- zookeeper
@@ -30,14 +30,14 @@ services:
3030
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
3131

3232
kafka-setup:
33-
image: confluentinc/cp-kafka:5.4.3
33+
image: confluentinc/cp-kafka:6.1.0
3434
depends_on:
3535
- kafka
3636
command: "bash -c 'echo Waiting for Kafka to be ready... && \
3737
cub kafka-ready -z zookeeper:2181 1 30 && \
38-
kafka-topics --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic connect-config-storage && \
39-
kafka-topics --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic connect-offset-storage && \
40-
kafka-topics --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic connect-status-storage && \
38+
kafka-topics --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --config cleanup.policy=compact --topic connect-config-storage && \
39+
kafka-topics --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --config cleanup.policy=compact --topic connect-offset-storage && \
40+
kafka-topics --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --config cleanup.policy=compact --topic connect-status-storage && \
4141
kafka-topics --create --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 --topic logs'"
4242
environment:
4343
KAFKA_BROKER_ID: 1

pom.xml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
<groupId>com.scalyr.integrations.kafka</groupId>
66
<artifactId>kafka-connect-scalyr-sink</artifactId>
7-
<version>1.3</version>
7+
<version>1.4</version>
88
<packaging>jar</packaging>
99

1010
<name>kafka-connect-scalyr-sink</name>
1111

1212
<properties>
1313
<kafka.version>2.4.1</kafka.version>
14-
<junit.version>4.13.1</junit.version>
14+
<junit.version>4.13.2</junit.version>
1515
<sonar.projectKey>scalyr_kafka-connect-scalyr</sonar.projectKey>
1616
<sonar.organization>scalyr</sonar.organization>
1717
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
@@ -44,7 +44,7 @@
4444
<dependency>
4545
<groupId>com.google.guava</groupId>
4646
<artifactId>guava</artifactId>
47-
<version>29.0-jre</version>
47+
<version>31.0.1-jre</version>
4848
</dependency>
4949
<dependency>
5050
<groupId>com.github.luben</groupId>
@@ -76,21 +76,22 @@
7676
<scope>test</scope>
7777
</dependency>
7878
<dependency>
79-
<groupId>org.slf4j</groupId>
80-
<artifactId>slf4j-api</artifactId>
81-
<version>1.7.32</version>
79+
<groupId>org.apache.logging.log4j</groupId>
80+
<artifactId>log4j-core</artifactId>
81+
<version>2.15.0</version>
8282
</dependency>
8383
<dependency>
84-
<groupId>org.slf4j</groupId>
85-
<artifactId>slf4j-log4j12</artifactId>
86-
<version>1.7.32</version>
84+
<groupId>org.apache.logging.log4j</groupId>
85+
<artifactId>log4j-slf4j-impl</artifactId>
86+
<version>2.15.0</version>
8787
</dependency>
8888
</dependencies>
8989
<build>
9090
<plugins>
9191
<plugin>
9292
<groupId>org.apache.maven.plugins</groupId>
9393
<artifactId>maven-jar-plugin</artifactId>
94+
<version>3.2.0</version>
9495
<configuration>
9596
<archive>
9697
<manifest>
@@ -106,13 +107,13 @@
106107
<version>2.5.1</version>
107108
<inherited>true</inherited>
108109
<configuration>
109-
<source>8</source>
110-
<target>8</target>
110+
<source>11</source>
111+
<target>11</target>
111112
</configuration>
112113
</plugin>
113114
<plugin>
114115
<artifactId>maven-assembly-plugin</artifactId>
115-
<version>2.5.3</version>
116+
<version>3.3.0</version>
116117
<configuration>
117118
<descriptors>
118119
<descriptor>src/main/assembly/package.xml</descriptor>
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Create Kafka Connect image with Scalyr Sink Connector
2-
#FROM confluentinc/cp-kafka-connect-base:latest # latest build doesn't even start correctly without our connector
3-
FROM confluentinc/cp-kafka-connect:5.5.1-1-ubi8
2+
FROM confluentinc/cp-kafka-connect:6.1.0-1-ubi8
43
RUN mkdir -p /etc/kafka-connect/jars/kafka-connect-scalyr-sink
54
COPY target/kafka-connect-scalyr-sink-latest-package/share/java/kafka-connect-scalyr-sink /etc/kafka-connect/jars/kafka-connect-scalyr-sink

src/test/java/com/scalyr/integrations/kafka/AddEventsClientTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import okhttp3.mockwebserver.MockResponse;
2727
import okhttp3.mockwebserver.MockWebServer;
2828
import okhttp3.mockwebserver.RecordedRequest;
29-
import org.apache.log4j.Level;
30-
import org.apache.log4j.LogManager;
29+
import org.apache.logging.log4j.Level;
30+
import org.apache.logging.log4j.core.config.Configurator;
3131
import org.asynchttpclient.AsyncHttpClient;
3232
import org.junit.After;
3333
import org.junit.Before;
@@ -47,6 +47,7 @@
4747
import java.util.UUID;
4848
import java.util.concurrent.CompletableFuture;
4949
import java.util.concurrent.TimeUnit;
50+
5051
import java.util.stream.Collectors;
5152
import java.util.stream.IntStream;
5253
import java.util.stream.Stream;
@@ -103,7 +104,7 @@ public void setup() {
103104
this.deflateCompressor = CompressorFactory.getCompressor(CompressorFactory.DEFLATE, 3);
104105

105106
// We disable payload logging so we don't get very large raw payload messages in the log output
106-
LogManager.getLogger("com.scalyr.integrations.kafka.eventpayload").setLevel(Level.OFF);
107+
Configurator.setLevel("com.scalyr.integrations.kafka.eventpayload", Level.OFF);
107108
}
108109

109110
@After

0 commit comments

Comments
 (0)