Skip to content
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

[datasets] added THORAT for PYSRC and SEMGREP #5

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
mv workspace/securibench-micro-JAVASRC.zip securibench-micro-JAVASRC.zip
mv workspace/OWASP-BenchmarkJava-JAVA.zip OWASP-BenchmarkJava-JAVA.zip
mv workspace/OWASP-BenchmarkJava-JAVASRC.zip OWASP-BenchmarkJava-JAVASRC.zip
mv workspace/THORAT.zip THORAT.zip
- name: Set next release version
id: taggerFinal
uses: anothrNick/[email protected]
Expand All @@ -62,3 +63,4 @@ jobs:
securibench-micro-JAVASRC.zip
OWASP-BenchmarkJava-JAVA.zip
OWASP-BenchmarkJava-JAVASRC.zip
THORAT.zip
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import io.joern.benchmarks.datasets.runner.{
DatasetDownloader,
IchnaeaDownloader,
OWASPJavaDownloader,
SecuribenchMicroDownloader
SecuribenchMicroDownloader,
ThoratDownloader
}
import org.slf4j.LoggerFactory
import upickle.default.*
Expand Down Expand Up @@ -50,7 +51,9 @@ object BenchmarkDataset {
x => new SecuribenchMicroDownloader(x.datasetDir, JavaCpgTypes.SEMGREP)
),
(AvailableBenchmarks.OWASP_SEMGREP, x => new OWASPJavaDownloader(x.datasetDir, JavaCpgTypes.SEMGREP)),
(AvailableBenchmarks.ICHNAEA_SEMGREP, x => new IchnaeaDownloader(x.datasetDir))
(AvailableBenchmarks.ICHNAEA_SEMGREP, x => new IchnaeaDownloader(x.datasetDir)),
(AvailableBenchmarks.THORAT_PYSRC, x => new ThoratDownloader(x.datasetDir)),
(AvailableBenchmarks.THORAT_SEMGREP, x => new ThoratDownloader(x.datasetDir))
)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.joern.benchmarks.datasets.runner

import better.files.File
import io.joern.benchmarks.*
import org.slf4j.LoggerFactory
import upickle.default.*

import java.net.{URI, URL}
import scala.util.{Failure, Success, Try}

class ThoratDownloader(datasetDir: File) extends DatasetDownloader(datasetDir) with SingleFileDownloader {

private val logger = LoggerFactory.getLogger(getClass)

private val version = "0.0.7"
override val benchmarkName = s"Thorat Python v$version"

override protected val benchmarkUrl: URL = URI(
s"https://github.com/DavidBakerEffendi/benchmark-for-taint-analysis-tools-for-python/archive/refs/tags/v$version.zip"
).toURL
override protected val benchmarkFileName: String = s"benchmark-for-taint-analysis-tools-for-python-$version"
override protected val benchmarkBaseDir: File = datasetDir / benchmarkFileName

override def initialize(): Try[File] = Try {
val outputFile = File(s"${datasetDir.pathAsString}/THORAT.zip")

if !outputFile.exists then
downloadBenchmarkAndUnarchive(CompressionTypes.ZIP)
compressBenchmark(benchmarkBaseDir, Option(File(s"${datasetDir.pathAsString}/THORAT.zip")))
else outputFile
}

override def run(): Unit = Try {
initialize() match {
case Failure(exception) =>
logger.error(s"Unable to initialize benchmark '$getClass'", exception)
case Success(benchmarkDir) =>
}
}
}