Skip to content

Commit

Permalink
[Security] Add configuration for running OWASP Dependency Check for a…
Browse files Browse the repository at this point in the history
…ll modules (apache#10288)

* Add owasp dependency check config

Example report:
mvn -Pskip-all,core-modules,owasp-dependency-check -pl distribution/server verify

* Make it possible to skip shading

* Make it possible to skip nar file creation

* Skip license and rat checks in skip-all profile

* Skip Docker too

* Skip tests completely

* Skip requirement of tar.gz dependency in presto-distribution

* Add bash function for running the dependency check

* Remove leftover from experiment
  • Loading branch information
lhotari authored Apr 21, 2021
1 parent d1a439b commit 350fdab
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 20 deletions.
10 changes: 10 additions & 0 deletions build/pulsar_ci_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ function ci_print_thread_dumps() {
return 0
}

function _ci_mvn() {
mvn -B -ntp "$@"
}

# runs OWASP Dependency Check for all projects
function ci_dependency_check() {
_ci_mvn -Pmain,skip-all,skipDocker,owasp-dependency-check initialize verify -pl '!pulsar-client-tools-test' "$@"
}


if [ -z "$1" ]; then
echo "usage: $0 [ci_tool_function_name]"
echo "Available ci tool functions:"
Expand Down
2 changes: 1 addition & 1 deletion jclouds-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion kafka-connect-avro-converter-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
102 changes: 100 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ flexible messaging model and an intuitive client API.</description>
<docker.organization>apachepulsar</docker.organization>
<skipSourceReleaseAssembly>false</skipSourceReleaseAssembly>
<skipBuildDistribution>false</skipBuildDistribution>
<shadePluginPhase>package</shadePluginPhase>
<narPluginPhase>package</narPluginPhase>

<!-- apache commons -->
<commons-compress.version>1.19</commons-compress.version>
Expand Down Expand Up @@ -236,6 +238,7 @@ flexible messaging model and an intuitive client API.</description>
<errorprone-slf4j.version>0.1.4</errorprone-slf4j.version>
<j2objc-annotations.version>1.3</j2objc-annotations.version>
<lightproto-maven-plugin.version>0.4</lightproto-maven-plugin.version>
<dependency-check-maven.version>6.1.5</dependency-check-maven.version>

<!-- Used to configure rename.netty.native. Libs -->
<rename.netty.native.libs>rename-netty-native-libs.sh</rename.netty.native.libs>
Expand Down Expand Up @@ -1601,7 +1604,7 @@ flexible messaging model and an intuitive client API.</description>
<executions>
<execution>
<id>default-nar</id>
<phase>package</phase>
<phase>${narPluginPhase}</phase>
<goals>
<goal>nar</goal>
</goals>
Expand Down Expand Up @@ -1799,8 +1802,8 @@ flexible messaging model and an intuitive client API.</description>
<rename.netty.native.libs>rename-netty-native-libs.cmd</rename.netty.native.libs>
</properties>

<!-- Primary Module profile -->
</profile>
<!-- Primary Module profile -->
<profile>
<id>main</id>
<activation>
Expand Down Expand Up @@ -2050,6 +2053,101 @@ flexible messaging model and an intuitive client API.</description>
<module>tests</module>
</modules>
</profile>
<profile>
<id>skip-all</id>
<properties>
<maven.main.skip>true</maven.main.skip>
<maven.test.skip>true</maven.test.skip>
<skipSourceReleaseAssembly>true</skipSourceReleaseAssembly>
<skipBuildDistribution>true</skipBuildDistribution>
<spotbugs.skip>true</spotbugs.skip>
<license.skip>true</license.skip>
<rat.skip>true</rat.skip>
<assembly.skipAssembly>true</assembly.skipAssembly>
<shadePluginPhase>none</shadePluginPhase>
<narPluginPhase>none</narPluginPhase>
<skipDocker>true</skipDocker>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-testCompile</id>
<goals>
<goal>testCompile</goal>
</goals>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>owasp-dependency-check</id>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${dependency-check-maven.version}</version>
<configuration>
<msbuildAnalyzerEnabled>false</msbuildAnalyzerEnabled>
<nodeAnalyzerEnabled>false</nodeAnalyzerEnabled>
<yarnAuditAnalyzerEnabled>false</yarnAuditAnalyzerEnabled>
<pyDistributionAnalyzerEnabled>false</pyDistributionAnalyzerEnabled>
<pyPackageAnalyzerEnabled>false</pyPackageAnalyzerEnabled>
<pipAnalyzerEnabled>false</pipAnalyzerEnabled>
<pipfileAnalyzerEnabled>false</pipfileAnalyzerEnabled>
<retireJsAnalyzerEnabled>false</retireJsAnalyzerEnabled>
<msbuildAnalyzerEnabled>false</msbuildAnalyzerEnabled>
<mixAuditAnalyzerEnabled>false</mixAuditAnalyzerEnabled>
<nugetconfAnalyzerEnabled>false</nugetconfAnalyzerEnabled>
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
</configuration>
<executions>
<execution>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${dependency-check-maven.version}</version>
<reportSets>
<reportSet>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</profile>
</profiles>

<repositories>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-broker-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-1x-base/pulsar-client-2x-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-admin-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion pulsar-functions/localrun-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
37 changes: 29 additions & 8 deletions pulsar-sql/presto-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@
<classifier>properties</classifier>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-presto-connector</artifactId>
<version>${project.version}</version>
<type>tar.gz</type>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
Expand Down Expand Up @@ -268,6 +260,14 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>${skipBuildDistribution}</skip>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down Expand Up @@ -338,4 +338,25 @@
</extension>
</extensions>
</build>

<profiles>
<profile>
<id>skipBuildDistributionDisabled</id>
<activation>
<property>
<name>skipBuildDistribution</name>
<value>false</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-presto-connector</artifactId>
<version>${project.version}</version>
<type>tar.gz</type>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
2 changes: 1 addition & 1 deletion pulsar-sql/presto-pulsar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down
2 changes: 1 addition & 1 deletion tests/docker-images/java-test-functions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<phase>${shadePluginPhase}</phase>
<goals>
<goal>shade</goal>
</goals>
Expand Down

0 comments on commit 350fdab

Please sign in to comment.