Skip to content

Commit

Permalink
feat: added trufflehog support (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
janniclas authored Nov 25, 2024
1 parent ee1a0ae commit a11c440
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apache-commoms = "3.17.0"
junit = "5.11.3"
ktfmt = "0.21.0"
versions = "0.51.0"
sphaVersion = "0.0.4"
sphaVersion = "0.0.5"
semver = "0.12.11"

[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ package de.fraunhofer.iem.spha.cli.transformer
import de.fraunhofer.iem.spha.adapter.AdapterResult
import de.fraunhofer.iem.spha.adapter.tools.osv.OsvAdapter
import de.fraunhofer.iem.spha.adapter.tools.trivy.TrivyAdapter
import de.fraunhofer.iem.spha.adapter.tools.trufflehog.TrufflehogAdapter
import de.fraunhofer.iem.spha.cli.StrictModeConstraintFailed
import de.fraunhofer.iem.spha.model.adapter.osv.OsvScannerDto
import de.fraunhofer.iem.spha.model.adapter.trivy.TrivyDto
import de.fraunhofer.iem.spha.model.adapter.trufflehog.TrufflehogReportDto
import de.fraunhofer.iem.spha.model.kpi.RawValueKpi
import io.github.oshai.kotlinlogging.KotlinLogging
import java.io.InputStream
Expand Down Expand Up @@ -58,6 +60,14 @@ internal class Tool2RawKpiTransformer : RawKpiTransformer, KoinComponent {
return@use OsvAdapter.transformDataToKpi(adapterInput)
}
}
"trufflehog" -> {
getSingleInputStreamFromInputFile(options.inputFiles, strictMode).use {
_logger.info { "Selected supported tool: Trufflehog" }
val adapterInput: List<TrufflehogReportDto> =
TrufflehogAdapter.dtoFromJson(it)
return@use TrufflehogAdapter.transformDataToKpi(adapterInput)
}
}

else -> throw ToolNotFoundException("Tool ${options.tool} is not yet supported.")
}
Expand Down

0 comments on commit a11c440

Please sign in to comment.