-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from joernio/andrei/owasp-downloader
[datasets] Added `OWASP`
- Loading branch information
Showing
5 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -44,6 +44,8 @@ jobs: | |
mv workspace/ichnaea.zip ichnaea.zip | ||
mv workspace/securibench-micro-JAVA.zip securibench-micro-JAVA.zip | ||
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 | ||
- name: Set next release version | ||
id: taggerFinal | ||
uses: anothrNick/[email protected] | ||
|
@@ -57,4 +59,6 @@ jobs: | |
files: | | ||
ichnaea.zip | ||
securibench-micro-JAVA.zip | ||
securibench-micro-JAVASRC.zip | ||
securibench-micro-JAVASRC.zip | ||
OWASP-BenchmarkJava-JAVA.zip | ||
OWASP-BenchmarkJava-JAVASRC.zip |
This file contains 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 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
47 changes: 47 additions & 0 deletions
47
src/main/scala/io/joern/benchmarks/datasets/runner/OWASPJavaDownloader.scala
This file contains 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,47 @@ | ||
package io.joern.benchmarks.datasets.runner | ||
|
||
import better.files.File | ||
import io.joern.benchmarks.* | ||
import io.joern.benchmarks.datasets.JavaCpgTypes | ||
import org.slf4j.LoggerFactory | ||
|
||
import java.net.{URI, URL} | ||
import scala.util.{Failure, Success, Try} | ||
|
||
class OWASPJavaDownloader(datasetDir: File, cpgCreatorType: JavaCpgTypes.Value) | ||
extends DatasetDownloader(datasetDir) | ||
with SingleFileDownloader { | ||
|
||
private val logger = LoggerFactory.getLogger(getClass) | ||
|
||
override val benchmarkName = s"OWASP Java v1.2" | ||
|
||
override protected val benchmarkUrl: URL = URI( | ||
"https://github.com/OWASP-Benchmark/BenchmarkJava/archive/refs/tags/1.2beta.zip" | ||
).toURL | ||
override protected val benchmarkFileName: String = "BenchmarkJava-1.2beta" | ||
override protected val benchmarkBaseDir: File = datasetDir / benchmarkFileName | ||
|
||
private val apacheJdo = URI("https://repo1.maven.org/maven2/javax/jdo/jdo-api/3.1/jdo-api-3.1.jar").toURL | ||
|
||
override def initialize(): Try[File] = Try { | ||
downloadBenchmarkAndUnarchive(CompressionTypes.ZIP) | ||
|
||
val datasetLabel = | ||
if cpgCreatorType == JavaCpgTypes.JAVA then JavaCpgTypes.JAVA.toString | ||
else JavaCpgTypes.JAVASRC.toString | ||
|
||
compressBenchmark( | ||
benchmarkBaseDir, | ||
Option(File(s"${datasetDir.pathAsString}/OWASP-BenchmarkJava-$datasetLabel.zip")) | ||
) | ||
} | ||
|
||
override def run(): Unit = { | ||
initialize() match { | ||
case Failure(exception) => | ||
logger.error(s"Unable to initialize benchmark '$getClass'", exception) | ||
case Success(benchmarkDir) => | ||
} | ||
} | ||
} |
This file contains 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