-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Liftric/feat/risk_score_check
Add Risk Score & Generate Sbom
- Loading branch information
Showing
20 changed files
with
214 additions
and
13,832 deletions.
There are no files selected for viewing
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
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
33 changes: 33 additions & 0 deletions
33
src/integrationTest/kotlin/com/liftric/dtcp/IntegrationTestBase.kt
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,33 @@ | ||
package com.liftric.dtcp | ||
|
||
import com.liftric.dtcp.model.VexComponent | ||
import com.liftric.dtcp.model.VexVulnerability | ||
|
||
/** | ||
* This base class provides common resources for integration tests. | ||
* By using this base class, resources don't need to be recreated for each individual test, | ||
* thus preventing duplication of code and unnecessary instantiation of resources in each test. | ||
*/ | ||
|
||
abstract class IntegrationTestBase { | ||
val dependencyTrackApiEndpoint = "http://localhost:8081" | ||
|
||
val vexComponent = VexComponent( | ||
purl = "pkg:maven/org.jetbrains.kotlin/kotlin-stdlib-jdk8@1.8.21?type=jar", | ||
vulnerability = VexVulnerability( | ||
id = "CVE-2023-26048", | ||
source = "NVD", | ||
analysis = "Vulnerability.Analysis.State.FALSE_POSITIVE", | ||
analysisValue = "FALSE_POSITIVE", | ||
detail = null, | ||
) | ||
) | ||
|
||
val vexVulnerability = VexVulnerability( | ||
id = "CVE-2020-8908", | ||
source = "NVD", | ||
analysis = "Vulnerability.Analysis.State.RESOLVED", | ||
analysisValue = "RESOLVED", | ||
detail = "This is resolved", | ||
) | ||
} |
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
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,45 @@ | ||
package com.liftric.dtcp.extensions | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.Optional | ||
import kotlin.time.Duration | ||
import kotlin.time.ExperimentalTime | ||
|
||
data class RiskScore @OptIn(ExperimentalTime::class) constructor( | ||
val projectName: String, | ||
val projectVersion: String, | ||
val maxRiskScore: Double?, | ||
val timeout: Duration?, | ||
) | ||
|
||
@Suppress("MemberVisibilityCanBePrivate") | ||
@ConfigDsl | ||
class RiskScoreBuilder(@get:Internal val proj: Project) { | ||
@get:Input | ||
@get:Optional | ||
val projectName: Property<String> = proj.objects.property(String::class.java) | ||
|
||
@get:Input | ||
@get:Optional | ||
val projectVersion: Property<String> = proj.objects.property(String::class.java) | ||
|
||
@get:Input | ||
@get:Optional | ||
val maxRiskScore: Property<Double> = proj.objects.property(Double::class.java) | ||
|
||
@OptIn(ExperimentalTime::class) | ||
@get:Input | ||
@get:Optional | ||
val timeout: Property<Duration> = proj.objects.property(Duration::class.java) | ||
|
||
@OptIn(ExperimentalTime::class) | ||
fun build(): RiskScore = RiskScore( | ||
projectName = this.projectName.get(), | ||
projectVersion = this.projectVersion.get(), | ||
maxRiskScore = this.maxRiskScore.orNull, | ||
timeout = this.timeout.orNull, | ||
) | ||
} |
Oops, something went wrong.