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
    NPM_AUDIT,
12
    BOTH,
13
    UNKNOWN
14
}
15
16
data class AffectedDependency(
17
    val groupId: String,
18
    val artifactId: String,
19
    val version: String,
20
    val ecosystem: Ecosystem = Ecosystem.MAVEN
21
)
22
23
@JsonInclude(JsonInclude.Include.NON_NULL)
24
data class Vulnerability(
25
    @JsonProperty("cveId")
26 1 1. getCveId : replaced return value with "" for com/depanalyzer/report/Vulnerability::getCveId → KILLED
    val cveId: String,
27
28
    val severity: VulnerabilitySeverity,
29
30 1 1. getCvssScore : replaced Double return value with 0 for com/depanalyzer/report/Vulnerability::getCvssScore → KILLED
    val cvssScore: Double?,
31
32 1 1. getDescription : replaced return value with "" for com/depanalyzer/report/Vulnerability::getDescription → KILLED
    val description: String?,
33
34
    val affectedDependency: AffectedDependency,
35
36
    val source: VulnerabilitySource,
37
38 1 1. getRetrievedAt : replaced return value with null for com/depanalyzer/report/Vulnerability::getRetrievedAt → KILLED
    val retrievedAt: Instant?,
39
40
    @JsonProperty("referenceUrl")
41 1 1. getReferenceUrl : replaced return value with "" for com/depanalyzer/report/Vulnerability::getReferenceUrl → KILLED
    val referenceUrl: String?,
42
43 1 1. getAdvisoryId : replaced return value with "" for com/depanalyzer/report/Vulnerability::getAdvisoryId → KILLED
    val advisoryId: String? = null,
44
45 1 1. getTitle : replaced return value with "" for com/depanalyzer/report/Vulnerability::getTitle → KILLED
    val title: String? = null,
46
47 1 1. getCwes : replaced return value with Collections.emptyList for com/depanalyzer/report/Vulnerability::getCwes → SURVIVED
    val cwes: List<String> = emptyList(),
48
49 1 1. getAliases : replaced return value with Collections.emptyList for com/depanalyzer/report/Vulnerability::getAliases → SURVIVED
    val aliases: List<String> = emptyList()
50
)
51
52
enum class VulnerabilitySeverity {
53
    CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN;
54
55
    companion object {
56
        fun fromCvssScore(score: Double?): VulnerabilitySeverity {
57
            return when {
58 1 1. fromCvssScore : negated conditional → KILLED
                score == null -> UNKNOWN
59 2 1. fromCvssScore : changed conditional boundary → KILLED
2. fromCvssScore : negated conditional → KILLED
                score >= 9.0 -> CRITICAL
60 2 1. fromCvssScore : changed conditional boundary → KILLED
2. fromCvssScore : negated conditional → KILLED
                score >= 7.0 -> HIGH
61 2 1. fromCvssScore : negated conditional → KILLED
2. fromCvssScore : changed conditional boundary → KILLED
                score >= 4.0 -> MEDIUM
62 2 1. fromCvssScore : changed conditional boundary → KILLED
2. fromCvssScore : negated conditional → KILLED
                score > 0 -> LOW
63
                else -> UNKNOWN
64
            }
65
        }
66
    }
67
}

Mutations

26

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

30

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

32

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

38

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

41

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

43

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

45

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

47

1.1
Location : getCwes
Killed by : none
replaced return value with Collections.emptyList for com/depanalyzer/report/Vulnerability::getCwes → SURVIVED
Covering tests

49

1.1
Location : getAliases
Killed by : none
replaced return value with Collections.emptyList for com/depanalyzer/report/Vulnerability::getAliases → SURVIVED
Covering tests

58

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

59

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

60

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

61

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

62

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