V2 Crawlers: Configurable Timeout + Command-Line Execution#288
Open
TheAuditorTool wants to merge 1 commit intoOWASP-Benchmark:mainfrom
Open
V2 Crawlers: Configurable Timeout + Command-Line Execution#288TheAuditorTool wants to merge 1 commit intoOWASP-Benchmark:mainfrom
TheAuditorTool wants to merge 1 commit intoOWASP-Benchmark:mainfrom
Conversation
…port Closes OWASP-Benchmark#3 (Add Timeout to Crawlers) Closes OWASP-Benchmark#1 (Add new command line crawler and verification crawler) New files (zero changes to existing code): - CommandLineTestCaseRequest.java: CLI test case support (tcType="CLI") - BenchmarkCrawler_newv2.java: configurable -T/--timeout, CLI dispatch - BenchmarkCrawlerVerification_newv2.java: verification with timeout + CLI
6c7eeed to
fc3f61b
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
V2 Crawlers: Configurable Timeout + Command-Line Execution
Closes #3 (Add Timeout to Crawlers)
Closes #1 (Add new command line crawler and verification crawler)
Overview
This adds three new Java files alongside the existing crawlers. Nothing existing is changed — the current
run-crawlerandrun-verification-crawlerMaven goals continue to work exactly as before. The new functionality is available through separate-v2goals when you're ready to use it.What's New
Configurable Timeout (Issue #3)
The current crawlers have a hardcoded 15-second timeout. If a test case takes longer (common on slower machines), the request is dropped.
The v2 crawlers add a
-Tflag that lets you set the timeout yourself:-Tflag (the default)-T 300-T 60When a request does time out, the crawler logs it and moves on to the next test case, just as Jonathon described in the issue.
Command-Line Test Case Execution (Issue #1)
The existing crawlers work by sending HTTP requests to web endpoints. The v2 crawlers can also run test cases as command-line programs — useful for benchmarking non-web applications like Python scripts or CLI tools.
To use this, test cases in the XML file use
tcType="CLI"instead ofSERVLET,SPRINGWS, orJERSEYWS:The crawler runs the command as a subprocess, captures its output, and uses the same attack/safe verification logic that the HTTP crawler uses. The
formparamelements still switch between attack and safe values — they're passed to the command as--name valuearguments.New Files
All three are in
plugin/src/main/java/org/owasp/benchmarkutils/tools/:CommandLineTestCaseRequest.javaAbstractTestCaseRequestso it fits into the existing test suite loading and sorting infrastructure.BenchmarkCrawler_newv2.javaBenchmarkCrawler. Maven goal:run-crawler-v2.BenchmarkCrawlerVerification_newv2.javaBenchmarkCrawler_newv2. Maven goal:run-verification-crawler-v2.How to Try It
Once installed (
mvn install), you can use the new goals in place of the existing ones:All existing flags (
-f,-n,-t) still work. The-Tflag is the only addition.What's Not Changed
BenchmarkCrawler.java— untouchedBenchmarkCrawlerVerification.java— untouchedAbstractTestCaseRequest.java— untouchedDesign Notes
-Tflag). This means a server that's down still fails fast, while a slow response can take as long as needed.ResponseInfoclass: stdout goes intoresponseString, exit code goes intostatusCode, and elapsed wall-clock time goes intotimeInSeconds.RegressionTesting.verifyResponse()for CLI test cases. This is the same string-matching logic used for HTTP — checking whether the attack success indicator appears in the output.