Vulnerability.kt

1
package com.depanalyzer.report
2
3
import com.depanalyzer.parser.Ecosystem
4
import com.fasterxml.jackson.annotation.JsonInclude
5
import com.fasterxml.jackson.annotation.JsonProperty
6
import java.time.Instant
7
8
enum class VulnerabilitySource {
9
    OSS_INDEX,
10
    NVD,
11
    BOTH,
12
    UNKNOWN
13
}
14
15
data class AffectedDependency(
16
    val groupId: String,
17
    val artifactId: String,
18
    val version: String,
19
    val ecosystem: Ecosystem = Ecosystem.MAVEN
20
)
21
22
@JsonInclude(JsonInclude.Include.NON_NULL)
23
data class Vulnerability(
24
    @JsonProperty("cveId")
25 1 1. getCveId : replaced return value with "" for com/depanalyzer/report/Vulnerability::getCveId → KILLED
    val cveId: String,
26
27
    val severity: VulnerabilitySeverity,
28
29 1 1. getCvssScore : replaced Double return value with 0 for com/depanalyzer/report/Vulnerability::getCvssScore → KILLED
    val cvssScore: Double?,
30
31 1 1. getDescription : replaced return value with "" for com/depanalyzer/report/Vulnerability::getDescription → KILLED
    val description: String?,
32
33
    val affectedDependency: AffectedDependency,
34
35
    val source: VulnerabilitySource,
36
37 1 1. getRetrievedAt : replaced return value with null for com/depanalyzer/report/Vulnerability::getRetrievedAt → KILLED
    val retrievedAt: Instant?,
38
39
    @JsonProperty("referenceUrl")
40 1 1. getReferenceUrl : replaced return value with "" for com/depanalyzer/report/Vulnerability::getReferenceUrl → KILLED
    val referenceUrl: String?
41
)
42
43
enum class VulnerabilitySeverity {
44
    CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN;
45
46
    companion object {
47
        fun fromCvssScore(score: Double?): VulnerabilitySeverity {
48
            return when {
49 1 1. fromCvssScore : negated conditional → KILLED
                score == null -> UNKNOWN
50 2 1. fromCvssScore : changed conditional boundary → KILLED
2. fromCvssScore : negated conditional → KILLED
                score >= 9.0 -> CRITICAL
51 2 1. fromCvssScore : changed conditional boundary → KILLED
2. fromCvssScore : negated conditional → KILLED
                score >= 7.0 -> HIGH
52 2 1. fromCvssScore : negated conditional → KILLED
2. fromCvssScore : changed conditional boundary → KILLED
                score >= 4.0 -> MEDIUM
53 2 1. fromCvssScore : changed conditional boundary → KILLED
2. fromCvssScore : negated conditional → KILLED
                score > 0 -> LOW
54
                else -> UNKNOWN
55
            }
56
        }
57
    }
58
}

Mutations

25

1.1
Location : getCveId
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testCreateVulnerabilityWithMinimalFields()]
replaced return value with "" for com/depanalyzer/report/Vulnerability::getCveId → KILLED

29

1.1
Location : getCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testCreateVulnerabilityWithMinimalFields()]
replaced Double return value with 0 for com/depanalyzer/report/Vulnerability::getCvssScore → KILLED

31

1.1
Location : getDescription
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testCreateVulnerabilityWithMinimalFields()]
replaced return value with "" for com/depanalyzer/report/Vulnerability::getDescription → KILLED

37

1.1
Location : getRetrievedAt
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testCreateVulnerabilityWithAllFields()]
replaced return value with null for com/depanalyzer/report/Vulnerability::getRetrievedAt → KILLED

40

1.1
Location : getReferenceUrl
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testCreateVulnerabilityWithMinimalFields()]
replaced return value with "" for com/depanalyzer/report/Vulnerability::getReferenceUrl → KILLED

49

1.1
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationUnknown()]
negated conditional → KILLED

50

1.1
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationCritical()]
changed conditional boundary → KILLED

2.2
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationCritical()]
negated conditional → KILLED

51

1.1
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationHigh()]
changed conditional boundary → KILLED

2.2
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationMedium()]
negated conditional → KILLED

52

1.1
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationMedium()]
negated conditional → KILLED

2.2
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationMedium()]
changed conditional boundary → KILLED

53

1.1
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationZeroScore()]
changed conditional boundary → KILLED

2.2
Location : fromCvssScore
Killed by : com.depanalyzer.report.VulnerabilityTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.VulnerabilityTest]/[method:testSeverityCalculationLow()]
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1