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

Evomasters #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions src/wafp/fuzzers/catalog/EvoMaster/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 1.15 release
ARG revision=a2db686a4ebfe9c626ac390f040b272e96ff51b9
ARG repository=https://github.com/EMResearch/EvoMaster.git

FROM maven:eclipse-temurin as builder
ARG repository
ARG revision

RUN git clone $repository /app

RUN cd /app \
&& git checkout $revision \
&& mvn clean install -DskipTests

FROM eclipse-temurin:17-jre-ubi9-minimal
ARG revision

LABEL name="EvoMaster" repo_url="https://github.com/EMResearch/EvoMaster" revision=$revision

COPY --from=builder /app/core/target/evomaster.jar /EvoMaster/evomaster.jar
COPY --chmod=744 entrypoint.sh /
ENTRYPOINT ["./entrypoint.sh"]
43 changes: 43 additions & 0 deletions src/wafp/fuzzers/catalog/EvoMaster/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
* Black box mode seems to generate java tests which probably should be run separately (?) or does it run it (investigate)
* results did go to `$pwd/src/em` in my experimentation
* Jar was located in `/`
* run command in `eclipse-temurin:17-jre-ubi9-minimal` based image:
* `java --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -jar /EvoMaster/evomaster.jar --blackBox true --bbSwaggerUrl https://api.apis.guru/v2/openapi.yaml --outputFormat JAVA_JUNIT_4 --maxTime 30s --ratePerMinute 60`
* add faulty target for check output

#####
Sample output:
```sh
[root@82e64cfac77e /]# java --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -jar ./EvoMaster --blackBox true --bbSwaggerUrl https://api.apis.guru/v2/openapi.yaml --outputFormat JAVA_JUNIT_4 --maxTime 30s --ratePerMinute 60
*
_____ ___ ___ _
| ___| | \/ | | |
| |____ _____ | . . | __ _ ___| |_ ___ _ __
| __\ \ / / _ \| |\/| |/ _` / __| __/ _ \ '__|
| |___\ V / (_) | | | | (_| \__ \ || __/ |
\____/ \_/ \___/\_| |_/\__,_|___/\__\___|_|


* EvoMaster version: 1.5.0
* WARNING: You are doing Black-Box testing, but you did not specify the 'problemType'. The system will default to RESTful API testing.
* Initializing...
* There are 2 usable RESTful API endpoints defined in the schema configuration
01:25:18.791 [main] WARN o.e.core.search.StructuralElement - class org.evomaster.core.problem.rest.RestCallAction should have a parent but currently it is null
01:25:18.819 [main] WARN o.e.c.p.rest.RestActionBuilderV3 - Unhandled format 'url'
01:25:18.820 [main] WARN o.e.c.p.rest.RestActionBuilderV3 - No fields for object definition: info
01:25:18.820 [main] WARN o.e.c.p.rest.RestActionBuilderV3 - No fields for object definition: externalDocs
* Starting to generate test cases
* WARNING: Schema has no info on where the API is, eg 'host' in v2 and 'servers' in v3. Going to use same location as where the schema was downloaded from
* Consumed search budget: 103.660%; covered targets: 4; time per test: 4437.1ms (4.4 actions)
* Going to save 2 tests to src/em
01:25:50.058 [main] WARN o.e.c.o.service.HttpWsTestCaseWriter - Currently no assertions are generated for response type: text/html;charset=utf-8
* Evaluated tests: 7
* Evaluated actions: 31
* Needed budget: 100%
* Passed time (seconds): 31
* Execution time per test (ms): Avg=4437.14 , min=1084.00 , max=9882.00
* Computation overhead between tests (ms): Avg=6.00 , min=2.00 , max=14.00
* Successfully executed (HTTP code 2xx) 0 endpoints out of 2 (0%)
* EvoMaster process has completed successfully
* Use --help and visit http://www.evomaster.org to learn more about available options
```
21 changes: 21 additions & 0 deletions src/wafp/fuzzers/catalog/EvoMaster/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from typing import Dict, List

from wafp.fuzzers import BaseFuzzer, FuzzerContext


class Default(BaseFuzzer):
def get_entrypoint_args(
self,
context: FuzzerContext,
schema: str,
base_url: str,
headers: Dict[str, str],
ssl_insecure: bool = False,
) -> List[str]:
return [
"--blackBox=true",
f"--bbSwaggerUrl={schema}",
"--outputFormat=JAVA_JUNIT_4",
"--maxTime=30s",
"--ratePerMinute=60",
]
6 changes: 6 additions & 0 deletions src/wafp/fuzzers/catalog/EvoMaster/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'
services:
fuzzer:
build: .
init: true
network_mode: host
3 changes: 3 additions & 0 deletions src/wafp/fuzzers/catalog/EvoMaster/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

java --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -jar /EvoMaster/evomaster.jar "$@"