-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into addUserPassForRetriveJS
- Loading branch information
Showing
6 changed files
with
222 additions
and
1 deletion.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
maven/src/it/4397-metaversion-for-transitive-dependency/dep/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
This file is part of dependency-check-maven. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
Copyright (c) 2023 Hans Aikema. All Rights Reserved. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.owasp.test</groupId> | ||
<artifactId>4397-dependency-with-meta-transitive</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>4397-dependency-with-meta-transitive</name> | ||
<description>Helper-project to play the role of dependency with transitive dependendencies | ||
that use Maven's LATEST or RELEASE meta-versions. | ||
|
||
An integration test similar to IT 3721-metaversion-dependencies, but with the RELEASE/LATEST meta-version | ||
inside the pom of a transitive dependency | ||
</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-compress</artifactId> | ||
<version>RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-pool2</artifactId> | ||
<version>LATEST</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
20 changes: 20 additions & 0 deletions
20
maven/src/it/4397-metaversion-for-transitive-dependency/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# This file is part of dependency-check-maven. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Copyright (c) 2023 Hans Aikema. All Rights Reserved. | ||
# | ||
# Note: the first goals needs the -U in order to properly resolve the RELEASE / LATEST meta-versions | ||
invoker.goals.1 = install --no-transfer-progress --batch-mode -f dep/pom.xml -U | ||
invoker.goals.2 = verify --no-transfer-progress --batch-mode -Dcve.startyear=2018 -Danalyzer.ossindex.enabled=false -f main/pom.xml |
68 changes: 68 additions & 0 deletions
68
maven/src/it/4397-metaversion-for-transitive-dependency/main/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
This file is part of dependency-check-maven. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
Copyright (c) 2023 Hans Aikema. All Rights Reserved. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.owasp.test</groupId> | ||
<artifactId>4397-metaversion-transitive-dependencies</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<name>4397-metaversion-transitive-dependencies</name> | ||
<description>An integration test similar to IT 3721-metaversion-dependencies, but with the RELEASE/LATEST meta-version | ||
inside the pom of a transitive dependency | ||
</description> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.owasp.test</groupId> | ||
<artifactId>4397-dependency-with-meta-transitive</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.owasp</groupId> | ||
<artifactId>dependency-check-maven</artifactId> | ||
<version>${odc.version}</version> | ||
<inherited>false</inherited> | ||
<configuration> | ||
<format>XML</format> | ||
<centralAnalyzerEnabled>false</centralAnalyzerEnabled> | ||
<enableExperimental>true</enableExperimental> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
26 changes: 26 additions & 0 deletions
26
maven/src/it/4397-metaversion-for-transitive-dependency/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
This file is part of dependency-check-maven. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
Copyright (c) 2023 Hans Aikema. All Rights Reserved. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.owasp.test.aggregate</groupId> | ||
<artifactId>4397-dummy</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<description>Just an empty pom to make maven-invoker-plugin discover this integration test.</description> | ||
</project> |
46 changes: 46 additions & 0 deletions
46
maven/src/it/4397-metaversion-for-transitive-dependency/postbuild.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* This file is part of dependency-check-maven. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* Copyright (c) 2023 Hans Aikema. All Rights Reserved. | ||
*/ | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.w3c.dom.NodeList; | ||
|
||
import java.nio.charset.Charset; | ||
import javax.xml.xpath.* | ||
import javax.xml.parsers.DocumentBuilderFactory | ||
|
||
def countMatches(String xml, String xpathQuery) { | ||
def xpath = XPathFactory.newInstance().newXPath() | ||
def builder = DocumentBuilderFactory.newInstance().newDocumentBuilder() | ||
def inputStream = new ByteArrayInputStream( xml.bytes ) | ||
def records = builder.parse(inputStream).documentElement | ||
NodeList nodes = xpath.evaluate( xpathQuery, records, XPathConstants.NODESET ) as NodeList | ||
nodes.getLength(); | ||
} | ||
|
||
String log = FileUtils.readFileToString(new File(basedir, "main/target/dependency-check-report.xml"), Charset.defaultCharset().name()); | ||
int count = countMatches(log,"/analysis/dependencies/dependency/evidenceCollected/evidence[@type='product' and ./value = 'commons-compress' and ./name = 'artifactid']"); | ||
if (count != 1){ | ||
System.out.println(String.format("commons-compress was identified %s times, expected 1", count)); | ||
return false; | ||
} | ||
count = countMatches(log,"/analysis/dependencies/dependency/evidenceCollected/evidence[@type='product' and ./value = 'commons-pool2' and ./name = 'artifactid']"); | ||
if (count != 1){ | ||
System.out.println(String.format("commons-pool2 was identified %s times, expected 1", count)); | ||
return false; | ||
} | ||
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters