Skip to content

Commit

Permalink
Merge pull request #5 from joernio/andrei/thorat-downloader
Browse files Browse the repository at this point in the history
[datasets] added THORAT for PYSRC and SEMGREP
  • Loading branch information
AndreiDreyer authored Jun 12, 2024
2 parents 18ff0ed + 01ee186 commit a0ba2f9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
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) =>
}
}
}

0 comments on commit a0ba2f9

Please sign in to comment.