Skip to content

Commit

Permalink
fix(advisors): Make configuration properties secrets
Browse files Browse the repository at this point in the history
Fix some advisor plugin options to be secrets. This is a fixup for
848e666.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
  • Loading branch information
mnonnenmacher committed Aug 30, 2024
1 parent cf72d14 commit 5d11ab0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plugins/advisors/nexus-iq/src/main/kotlin/NexusIq.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class NexusIq(override val descriptor: PluginDescriptor, private val config: Nex
private val service by lazy {
NexusIqService.create(
config.serverUrl,
config.username,
config.password,
config.username?.value,
config.password?.value,
OkHttpClientHelper.buildClient {
readTimeout(READ_TIMEOUT)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package org.ossreviewtoolkit.plugins.advisors.nexusiq

import org.ossreviewtoolkit.plugins.api.Secret

/**
* The configuration for Nexus IQ as a security vulnerability provider.
*/
Expand All @@ -37,11 +39,11 @@ data class NexusIqConfiguration(
* The username to use for authentication. If not both [username] and [password] are provided, authentication is
* disabled.
*/
val username: String?,
val username: Secret?,

/**
* The password to use for authentication. If not both [username] and [password] are provided, authentication is
* disabled.
*/
val password: String?
val password: Secret?
)
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class VulnerableCode(override val descriptor: PluginDescriptor, config: Vulnerab
if (config.readTimeout != null) readTimeout(config.readTimeout, TimeUnit.SECONDS)
}

VulnerableCodeService.create(config.serverUrl, config.apiKey, client)
VulnerableCodeService.create(config.serverUrl, config.apiKey?.value, client)
}

override suspend fun retrievePackageFindings(packages: Set<Package>): Map<Package, AdvisorResult> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package org.ossreviewtoolkit.plugins.advisors.vulnerablecode

import org.ossreviewtoolkit.clients.vulnerablecode.VulnerableCodeService
import org.ossreviewtoolkit.plugins.api.OrtPluginOption
import org.ossreviewtoolkit.plugins.api.Secret

/**
* The configuration for VulnerableCode as security vulnerability provider.
Expand All @@ -35,7 +36,7 @@ data class VulnerableCodeConfiguration(
/**
* The optional API key to use.
*/
val apiKey: String?,
val apiKey: Secret?,

/**
* The read timeout for the server connection in seconds. Defaults to whatever is the HTTP client's default value.
Expand Down

0 comments on commit 5d11ab0

Please sign in to comment.