-
Notifications
You must be signed in to change notification settings - Fork 17
Initial backend support for managing vulnerability resolutions on the server #3846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lamppu
wants to merge
12
commits into
eclipse-apoapsis:main
Choose a base branch
from
doubleopen-project:vulnerability-resolutions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
aace8a0
refactor: Move `UserDisplayName` to shared `api-model`
lamppu 96d93e4
feat: Allow to mark runs as outdated
lamppu 5d295da
feat: Add table for saving user-performed change events
lamppu c6219be
feat: Add table for storing vulnerability resolution definitions
lamppu 54670d4
feat: Add component for resolutions
lamppu 0b9c1f3
feat: Allow to add vulnerability resolutions
lamppu 43a7d27
feat(dao): Inject vulnerability resolutions to repository configuration
lamppu dbcd7d8
feat: Edit returning resolutions for vulnerabilities
lamppu 62cf249
feat: Return new matching vulnerability resolution definitions
lamppu 0bec11a
feat: Allow to archive vulnerability resolutions
lamppu bb383f2
feat: Allow to restore vulnerability resolutions
lamppu 91f0ce9
feat: Allow to update vulnerability resolutions
lamppu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| /* | ||
| * Copyright (C) 2025 The ORT Server Authors (See <https://github.com/eclipse-apoapsis/ort-server/blob/main/NOTICE>) | ||
| * | ||
| * 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 | ||
| * | ||
| * https://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. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| plugins { | ||
| id("ort-server-kotlin-multiplatform-conventions") | ||
| id("ort-server-publication-conventions") | ||
|
|
||
| // Apply third-party plugins. | ||
| alias(libs.plugins.kotlinSerialization) | ||
| } | ||
|
|
||
| group = "org.eclipse.apoapsis.ortserver.components.resolutions" | ||
|
|
||
| kotlin { | ||
| linuxX64() | ||
| macosArm64() | ||
| macosX64() | ||
| mingwX64() | ||
|
|
||
| sourceSets { | ||
| commonMain { | ||
| dependencies { | ||
| api(projects.shared.apiModel) | ||
|
|
||
| implementation(libs.kotlinxSerializationJson) | ||
| } | ||
| } | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
components/resolutions/api-model/src/commonMain/kotlin/PatchVulnerabilityResolution.kt
This file contains hidden or 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,42 @@ | ||
| /* | ||
| * Copyright (C) 2025 The ORT Server Authors (See <https://github.com/eclipse-apoapsis/ort-server/blob/main/NOTICE>) | ||
| * | ||
| * 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 | ||
| * | ||
| * https://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. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| package org.eclipse.apoapsis.ortserver.components.resolutions | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| import org.eclipse.apoapsis.ortserver.shared.apimodel.OptionalValue | ||
| import org.eclipse.apoapsis.ortserver.shared.apimodel.VulnerabilityResolutionReason | ||
|
|
||
| /** | ||
| * The request object for updating a vulnerability resolution. | ||
| */ | ||
| @Serializable | ||
| data class PatchVulnerabilityResolution( | ||
| /** | ||
| * The list of vulnerability ID matchers (regular expressions) to match the ids of the vulnerabilities to resolve. | ||
| */ | ||
| val idMatchers: OptionalValue<List<String>> = OptionalValue.Absent, | ||
|
|
||
| /** The reason why the vulnerability is resolved. */ | ||
| val reason: OptionalValue<VulnerabilityResolutionReason> = OptionalValue.Absent, | ||
|
|
||
| /** A comment to further explain why the [reason] is applicable here. */ | ||
| val comment: OptionalValue<String> = OptionalValue.Absent | ||
| ) |
44 changes: 44 additions & 0 deletions
44
components/resolutions/api-model/src/commonMain/kotlin/PostVulnerabilityResolution.kt
Etsija marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,44 @@ | ||
| /* | ||
| * Copyright (C) 2025 The ORT Server Authors (See <https://github.com/eclipse-apoapsis/ort-server/blob/main/NOTICE>) | ||
| * | ||
| * 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 | ||
| * | ||
| * https://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. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| package org.eclipse.apoapsis.ortserver.components.resolutions | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| import org.eclipse.apoapsis.ortserver.shared.apimodel.VulnerabilityResolutionReason | ||
|
|
||
| /** | ||
| * The request object for creating a vulnerability resolution. | ||
| */ | ||
| @Serializable | ||
| data class PostVulnerabilityResolution( | ||
| /** The ID of the run in which context the vulnerability resolution is made in. */ | ||
| val contextRunId: Long, | ||
|
|
||
| /** | ||
| * The list of vulnerability ID matchers (regular expressions) to match the ids of the vulnerabilities to resolve. | ||
| */ | ||
| val idMatchers: List<String>, | ||
|
|
||
| /** The reason why the vulnerability is resolved. */ | ||
| val reason: VulnerabilityResolutionReason, | ||
|
|
||
| /** A comment to further explain why the [reason] is applicable here. */ | ||
| val comment: String | ||
| ) |
This file contains hidden or 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,59 @@ | ||
| /* | ||
| * Copyright (C) 2025 The ORT Server Authors (See <https://github.com/eclipse-apoapsis/ort-server/blob/main/NOTICE>) | ||
| * | ||
| * 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 | ||
| * | ||
| * https://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. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * License-Filename: LICENSE | ||
| */ | ||
|
|
||
| plugins { | ||
| id("ort-server-kotlin-component-backend-conventions") | ||
| id("ort-server-publication-conventions") | ||
| } | ||
|
|
||
| group = "org.eclipse.apoapsis.ortserver.components.resolutions" | ||
|
|
||
| dependencies { | ||
| api(projects.model) | ||
| api(projects.services.ortRunService) | ||
|
|
||
| api(libs.exposedCore) | ||
|
|
||
| implementation(projects.dao) | ||
|
|
||
| routesImplementation(projects.components.authorizationKeycloak.backend) | ||
| routesImplementation(projects.components.resolutions.apiModel) | ||
| routesImplementation(projects.shared.apiMappings) | ||
| routesImplementation(projects.shared.apiModel) | ||
| routesImplementation(projects.shared.ktorUtils) | ||
|
|
||
| routesImplementation(ktorLibs.http) | ||
| routesImplementation(ktorLibs.server.auth) | ||
| routesImplementation(ktorLibs.server.core) | ||
| routesImplementation(libs.kotlinxDatetime) | ||
| routesImplementation(libs.ktorOpenApi) | ||
|
|
||
| testImplementation(testFixtures(projects.dao)) | ||
| testImplementation(testFixtures(projects.shared.ktorUtils)) | ||
|
|
||
| testImplementation(ktorLibs.client.core) | ||
| testImplementation(ktorLibs.http) | ||
| testImplementation(ktorLibs.server.auth) | ||
| testImplementation(ktorLibs.server.core) | ||
| testImplementation(ktorLibs.server.testHost) | ||
| testImplementation(libs.kotestAssertionsCore) | ||
| testImplementation(libs.kotestAssertionsKtor) | ||
| testImplementation(libs.kotestFrameworkEngine) | ||
| testImplementation(libs.mockk) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both
outdatedandoutdatedMessage? Theoretically, we could define that a run is outdated ifoutdatedMessageis non-null, and never allowoutdatedMessageto benullfor and outdated run (i.e. outdated runs always need to provide a message, which is probably good practice anyway).On the other hand, being explicit with
outdatedalso has its advantages, but complicates the logic a bit, I guess.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, this was something I was wondering about too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume there is a limited list of reasons why a run can get outdated so I would suggest to create an enum for that, then it could be
outdated: List<OutdatedReason>with, for example,OutdatedReason.ISSUE_RESOLUTIONS_CHANGED.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What your opinion @mnonnenmacher about having both these properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion but I have a tendency to only have one property with the list of reasons and if it is empty or null it means the run is not outdated.