-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0e3402
commit a5b3c18
Showing
6 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
8 changes: 6 additions & 2 deletions
8
src/main/java/io/jenkins/plugins/coverage/CompatibleObjectInputStream.java
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
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,4 @@ | ||
gnu.trove.impl.hash.THash | ||
gnu.trove.impl.hash.TIntHash | ||
gnu.trove.impl.hash.TPrimitiveHash | ||
gnu.trove.map.hash.TIntObjectHashMap |
24 changes: 24 additions & 0 deletions
24
src/test/java/io/jenkins/plugins/coverage/Security2376Test.java
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,24 @@ | ||
package io.jenkins.plugins.coverage; | ||
|
||
import hudson.model.FreeStyleProject; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import org.jvnet.hudson.test.recipes.LocalData; | ||
|
||
import java.io.IOException; | ||
|
||
public class Security2376Test { | ||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
|
||
@LocalData | ||
@Test(expected = SecurityException.class) | ||
public void testDeserialization() throws IOException, ClassNotFoundException { | ||
// coverage-report is just a serialized empty IdentityHashMap, not on the serialization allowlist as of Jenkins 2.303 | ||
final FreeStyleProject fs = (FreeStyleProject) j.jenkins.getItemByFullName("fs"); | ||
CoverageProcessor.recoverCoverageResult(fs.getBuild("1")); | ||
// Without the fix, this fails with: | ||
// Caused by: java.lang.ClassCastException: java.util.IdentityHashMap cannot be cast to io.jenkins.plugins.coverage.targets.CoverageResult | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/test/resources/io/jenkins/plugins/coverage/Security2376Test/jobs/fs/builds/1/build.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,29 @@ | ||
<?xml version='1.1' encoding='UTF-8'?> | ||
<build> | ||
<actions> | ||
<hudson.model.CauseAction> | ||
<causeBag class="linked-hash-map"> | ||
<entry> | ||
<hudson.model.Cause_-UserIdCause> | ||
<userId>admin</userId> | ||
</hudson.model.Cause_-UserIdCause> | ||
<int>1</int> | ||
</entry> | ||
</causeBag> | ||
</hudson.model.CauseAction> | ||
</actions> | ||
<queueId>2</queueId> | ||
<timestamp>1627289739464</timestamp> | ||
<startTime>1627289739514</startTime> | ||
<result>SUCCESS</result> | ||
<duration>52</duration> | ||
<charset>UTF-8</charset> | ||
<keepLog>false</keepLog> | ||
<builtOn></builtOn> | ||
<workspace>/var/jenkins_home/workspace/fs</workspace> | ||
<hudsonVersion>2.303</hudsonVersion> | ||
<scm class="hudson.scm.NullChangeLogParser"/> | ||
<culprits class="java.util.Collections$UnmodifiableSet"> | ||
<c class="sorted-set"/> | ||
</culprits> | ||
</build> |
Binary file added
BIN
+64 Bytes
...t/resources/io/jenkins/plugins/coverage/Security2376Test/jobs/fs/builds/1/coverage-report
Binary file not shown.
17 changes: 17 additions & 0 deletions
17
src/test/resources/io/jenkins/plugins/coverage/Security2376Test/jobs/fs/config.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,17 @@ | ||
<?xml version='1.1' encoding='UTF-8'?> | ||
<project> | ||
<actions/> | ||
<description></description> | ||
<keepDependencies>false</keepDependencies> | ||
<properties/> | ||
<scm class="hudson.scm.NullSCM"/> | ||
<canRoam>true</canRoam> | ||
<disabled>false</disabled> | ||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> | ||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> | ||
<triggers/> | ||
<concurrentBuild>false</concurrentBuild> | ||
<builders/> | ||
<publishers/> | ||
<buildWrappers/> | ||
</project> |