Skip to content

Commit cfbc781

Browse files
committed
Update usage.md & tests
1 parent 7da9005 commit cfbc781

File tree

3 files changed

+42
-10
lines changed

3 files changed

+42
-10
lines changed

casr/src/bin/casr-js.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ fn main() -> Result<()> {
137137
let re = Regex::new(r"^(?:.*Error:(?:\s+.*)?|Thrown at:)$").unwrap();
138138
if let Some(start) = js_stderr_list.iter().position(|x| re.is_match(x)) {
139139
report.js_report = js_stderr_list[start..].to_vec();
140-
report.js_report.retain(|x| !x.is_empty());
140+
report
141+
.js_report
142+
.retain(|x| !x.is_empty() && (x.trim().starts_with("at") || x.contains("Error")));
141143
let report_str = report.js_report.join("\n");
142144
report.stacktrace = JsStacktrace::extract_stacktrace(&report_str)?;
143145
if let Some(exception) = JsException::parse_exception(&report.js_report[0]) {

casr/tests/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn abs_path(rpath: &str) -> String {
4444
fn npm_init(npm_path: &PathBuf, path: &str) {
4545
let mut npm = Command::new(npm_path)
4646
.stdin(Stdio::piped())
47-
.stdout(Stdio::piped())
47+
.stdout(Stdio::null())
4848
.current_dir(path)
4949
.arg("init")
5050
.arg("-y")

docs/usage.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ ASAN reports or `casr-ubsan` to analyze UBSAN reports. Try `casr-gdb` to get
66
reports from gdb. Use `casr-python` to analyze python reports and get report
77
from [Atheris](https://github.com/google/atheris). Use `casr-java` to analyze
88
java reports and get report from
9-
[Jazzer](https://github.com/CodeIntelligenceTesting/jazzer). `casr-afl` is used
9+
[Jazzer](https://github.com/CodeIntelligenceTesting/jazzer). Use `casr-js`
10+
to analyze JavaScript reports and get report from
11+
[Jazzer.js](https://github.com/CodeIntelligenceTesting/jazzer.js) or
12+
[jsfuzz](https://github.com/fuzzitdev/jsfuzz). `casr-afl` is used
1013
to triage crashes found by [AFL++](https://github.com/AFLplusplus/AFLplusplus).
1114
`casr-libfuzzer` can triage crashes found by
1215
[libFuzzer](https://www.llvm.org/docs/LibFuzzer.html) (libFuzzer, go-fuzz,
13-
Atheris, Jazzer). `casr-dojo` allows to upload new and unique CASR reports to
14-
[DefectDojo](https://github.com/DefectDojo/django-DefectDojo). `casr-cli` is
15-
meant to provide TUI for viewing reports and converting them into SARIF report.
16-
Reports triage (deduplication, clustering) is done by `casr-cluster`.
16+
Atheris, Jazzer, Jazzer.js, jsfuzz). `casr-dojo` allows to upload new and
17+
unique CASR reports to [DefectDojo](https://github.com/DefectDojo/django-DefectDojo).
18+
`casr-cli` is meant to provide TUI for viewing reports and converting them into
19+
SARIF report. Reports triage (deduplication, clustering) is done by `casr-cluster`.
1720

1821
## casr-gdb
1922

@@ -165,6 +168,31 @@ Run casr-java:
165168

166169
$ casr-java -o java.casrep -- java casr/tests/casr_tests/java/Test1.java
167170

171+
## casr-js
172+
173+
Create CASR reports (.casrep) from JavaScript reports
174+
175+
Usage: casr-js [OPTIONS] <--stdout|--output <REPORT>> [-- <ARGS>...]
176+
177+
Arguments:
178+
[ARGS]... Add "-- <path> <arguments>" to run
179+
180+
Options:
181+
-o, --output <REPORT> Path to save report. Path can be a directory, then report
182+
name is generated
183+
--stdout Print CASR report to stdout
184+
--stdin <FILE> Stdin file for program
185+
-t, --timeout <SECONDS> Timeout (in seconds) for target execution, 0 value means
186+
that timeout is disabled [default: 0]
187+
--ignore <FILE> File with regular expressions for functions and file paths
188+
that should be ignored
189+
-h, --help Print help
190+
-V, --version Print version
191+
192+
Run casr-js:
193+
194+
$ casr-js -o js.casrep -- node casr/tests/casr_tests/js/test_casr_js.js
195+
168196
## casr-core
169197

170198
Analyze coredump for security goals and provide detailed report with severity estimation
@@ -345,7 +373,7 @@ Convert reports to SARIF report:
345373

346374
$ casr-cli --sarif out.sarif --tool libfuzzer --source-root /xlnt casr/tests/casr_tests/casrep/test_clustering_san
347375

348-
### Screnshots
376+
### Screenshots
349377

350378
![casrep](/docs/images/casr_report.png)
351379

@@ -463,7 +491,8 @@ variable may be used by [casr-san](#casr-san).
463491

464492
## casr-libfuzzer
465493

466-
Triage crashes found by libFuzzer based fuzzer (C/C++/go-fuzz/Atheris/Jazzer)
494+
Triage crashes found by libFuzzer based fuzzer
495+
(C/C++/go-fuzz/Atheris/Jazzer/Jazzer.js/jsfuzz)
467496

468497
Usage: casr-libfuzzer [OPTIONS] --output <OUTPUT_DIR> [-- <ARGS>...]
469498

@@ -498,7 +527,8 @@ Triage crashes found by libFuzzer based fuzzer (C/C++/go-fuzz/Atheris/Jazzer)
498527
`casr-libfuzzer` provides integration with
499528
[libFuzzer](https://www.llvm.org/docs/LibFuzzer.html) based fuzzers
500529
(C/C++/[go-fuzz](https://github.com/dvyukov/go-fuzz)/[Atheris](https://github.com/google/atheris)/
501-
[Jazzer](https://github.com/CodeIntelligenceTesting/jazzer)).
530+
[Jazzer](https://github.com/CodeIntelligenceTesting/jazzer)/[Jazzer.js](https://github.com/CodeIntelligenceTesting/jazzer.js)/
531+
[jsfuzz](https://github.com/fuzzitdev/jsfuzz)).
502532
It is pretty much like `casr-afl`.
503533

504534
libFuzzer example:

0 commit comments

Comments
 (0)