@eurekadevsecops/radar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +61 -0
- package/LICENSE +674 -0
- package/README.md +43 -0
- package/cli.js +15 -0
- package/package.json +36 -0
- package/scanners/depscan/run.sh +8 -0
- package/scanners/depscan/sarif.j2 +90 -0
- package/scanners/gitleaks/run.sh +7 -0
- package/scanners/opengrep/rules.yaml +69031 -0
- package/scanners/opengrep/run.sh +7 -0
- package/scanners/scanners.toml +20 -0
- package/src/commands/index.js +5 -0
- package/src/commands/scan.js +237 -0
- package/src/commands/scanners.js +15 -0
- package/src/index.js +21 -0
- package/src/plugins/scanners.js +12 -0
- package/src/util/humanize.js +23 -0
- package/src/util/sarif/display_findings.js +6 -0
- package/src/util/sarif/display_totals.js +5 -0
- package/src/util/sarif/index.js +6 -0
- package/src/util/sarif/levels.js +32 -0
- package/src/util/sarif/merge.js +52 -0
- package/src/util/sarif/summarize.js +40 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Scanners
|
|
2
|
+
|
|
3
|
+
Scanner manifest file is located in `scanners/scanners.toml`. Every scanner has a section that looks a lot like this:
|
|
4
|
+
|
|
5
|
+
```toml
|
|
6
|
+
[[scanners]]
|
|
7
|
+
name = "opengrep"
|
|
8
|
+
title = "Opengrep"
|
|
9
|
+
description = "Ultra-fast static analysis tool."
|
|
10
|
+
categories = [ "SAST" ]
|
|
11
|
+
cmd = "${assets}/run.sh ${target} ${assets} ${output}"
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The `name` field contains the scanner identifier that radarctl uses internally. Any command-line arguments or options for radarctl that take in a scanner always expect this scanner identifier. The `categories` field is an array of categories that the scanner can be part of. Usually takes on one or more values of SCA, SAST, and DAST. The `cmd` field is the command to run to launch the scanner.
|
|
16
|
+
|
|
17
|
+
Each scanner has its own subfolder with the `scanners` directory with the shell script that launches the scanner and any other files needed for scanner operation. An example shell script looks like this:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Parameters:
|
|
21
|
+
# $1 - Path to the source code folder that should be scanned
|
|
22
|
+
# $2 - Path to the assets folder
|
|
23
|
+
# $3 - Path to the output folder where scan results should be stored
|
|
24
|
+
|
|
25
|
+
set -e
|
|
26
|
+
docker run --rm -t -v $1:/app -v $2:/input -v $3:/home/output radar/opengrep:latest /app 2>&1
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The assets folder is the scanner's subfolder within the `scanners` directory. The output folder is a system temporary folder that is deleted when the scan terminates, successfully or not.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Development flow
|
|
33
|
+
|
|
34
|
+
## Linting
|
|
35
|
+
|
|
36
|
+
With the trifecta of the development process nearly complete, let's talk about linting. The linter we run is [golangci-lint](https://golangci-lint.run/). It helps with finding potential bugs in programs, as well as helping you follow standard go conventions. To run it locally, just run `golangci-lint --path-prefix=. run`. If you'd like to run all of our [pre-commit lints](https://pre-commit.com/), then run `pre-commit run --all-files`
|
|
37
|
+
|
|
38
|
+
# Cutting a release
|
|
39
|
+
|
|
40
|
+
If you have write access to this repo, you can ship ...
|
|
41
|
+
|
|
42
|
+
a patch release with:
|
|
43
|
+
|
|
44
|
+
`npm version patch && npm publish`
|
|
45
|
+
|
|
46
|
+
a minor release with:
|
|
47
|
+
|
|
48
|
+
`npm version minor && npm publish`
|
|
49
|
+
|
|
50
|
+
or a major release with:
|
|
51
|
+
|
|
52
|
+
`npm version major && npm publish`
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# Committing to radarctl
|
|
56
|
+
|
|
57
|
+
When committing to `radarctl`, there are a few important things to keep in mind:
|
|
58
|
+
|
|
59
|
+
- Keep commits small and focused, it helps greatly when reviewing larger PRs
|
|
60
|
+
- Make sure to use descriptive messages in your commit messages, it also helps future people understand why a change was made.
|
|
61
|
+
- PRs are squash merged, so please make sure to use descriptive titles
|