Skip to content

Commit 99170e0

Browse files
authored
Update the README with some details about the CWE mapping (#407)
* Fix some typos in the README file Signed-off-by: Cosmin Cojocar <[email protected]> * Update the README with some details about the CWE mapping Signed-off-by: Cosmin Cojocar <[email protected]>
1 parent 53be8dd commit 99170e0

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Inspects source code for security problems by scanning the Go AST.
77

88
## License
99

10-
Licensed under the Apache License, Version 2.0 (the "License");
11-
you may not use this file except in compliance with the License.
10+
Licensed under the Apache License, Version 2.0 (the "License").
11+
You may not use this file except in compliance with the License.
1212
You may obtain a copy of the License [here](http://www.apache.org/licenses/LICENSE-2.0).
1313

1414
## Project status
@@ -59,7 +59,7 @@ go get github.com/securego/gosec/cmd/gosec
5959
Gosec can be configured to only run a subset of rules, to exclude certain file
6060
paths, and produce reports in different formats. By default all rules will be
6161
run against the supplied input files. To recursively scan from the current
62-
directory you can supply './...' as the input argument.
62+
directory you can supply `./...` as the input argument.
6363

6464

6565
### Available rules
@@ -96,8 +96,8 @@ directory you can supply './...' as the input argument.
9696

9797
### Selecting rules
9898

99-
By default gosec will run all rules against the supplied file paths. It is however possible to select a subset of rules to run via the '-include=' flag,
100-
or to specify a set of rules to explicitly exclude using the '-exclude=' flag.
99+
By default, gosec will run all rules against the supplied file paths. It is however possible to select a subset of rules to run via the `-include=` flag,
100+
or to specify a set of rules to explicitly exclude using the `-exclude=` flag.
101101

102102
```bash
103103
# Run a specific set of rules
@@ -106,6 +106,9 @@ $ gosec -include=G101,G203,G401 ./...
106106
# Run everything except for rule G303
107107
$ gosec -exclude=G303 ./...
108108
```
109+
### CWE Mapping
110+
111+
Every issue detected by `gosec` is mapped to a [CWE (Common Weakness Enumeration)](http://cwe.mitre.org/data/index.html) which describes in more generic terms the vulnerability. The exact mapping can be found [here](https://github.com/securego/gosec/blob/53be8dd8644ee48802114178cff6eb7e29757414/issue.go#L49).
109112

110113
### Configuration
111114

@@ -140,7 +143,7 @@ of functions which will be skipped when auditing the not checked errors:
140143

141144
### Dependencies
142145

143-
gosec will fetch automatically the dependencies of the code which is being analyzed when go modules are turned on (e.g.` GO111MODULE=on`). If this is not the case,
146+
gosec will fetch automatically the dependencies of the code which is being analyzed when go module is turned on (e.g.` GO111MODULE=on`). If this is not the case,
144147
the dependencies need to be explicitly downloaded by running the `go get -d` command before the scan.
145148

146149
### Excluding test files and folders
@@ -162,7 +165,8 @@ Also additional folders can be excluded as follows:
162165

163166
### Annotating code
164167

165-
As with all automated detection tools there will be cases of false positives. In cases where gosec reports a failure that has been manually verified as being safe it is possible to annotate the code with a '#nosec' comment.
168+
As with all automated detection tools, there will be cases of false positives. In cases where gosec reports a failure that has been manually verified as being safe,
169+
it is possible to annotate the code with a `#nosec` comment.
166170

167171
The annotation causes gosec to stop processing any further nodes within the
168172
AST so can apply to a whole block or more granularly to a single expression.
@@ -183,10 +187,12 @@ func main(){
183187

184188
```
185189

186-
When a specific false positive has been identified and verified as safe, you may wish to suppress only that single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the `#nosec` annotation, e.g: `/* #nosec G401 */` or `// #nosec G201 G202 G203 `
190+
When a specific false positive has been identified and verified as safe, you may wish to suppress only that single rule (or a specific set of rules)
191+
within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within
192+
the `#nosec` annotation, e.g: `/* #nosec G401 */` or `// #nosec G201 G202 G203`
187193

188-
In some cases you may also want to revisit places where #nosec annotations
189-
have been used. To run the scanner and ignore any #nosec annotations you
194+
In some cases you may also want to revisit places where `#nosec` annotations
195+
have been used. To run the scanner and ignore any `#nosec` annotations you
190196
can do the following:
191197

192198
```bash
@@ -244,7 +250,7 @@ The released version of the tool is available in the `dist` folder. The build in
244250
gosec - Golang security checker
245251

246252
gosec analyzes Go source code to look for common programming mistakes that
247-
can lead to security problems.
253+
248254

249255
VERSION: 1.0.0
250256
GIT TAG: v1.0.0
@@ -262,7 +268,7 @@ make image
262268
```
263269

264270
You can run the `gosec` tool in a container against your local Go project. You just have to mount the project
265-
into a volume as follow:
271+
into a volume as follows:
266272

267273
```bash
268274
docker run -it -v <YOUR PROJECT PATH>/<PROJECT>:/<PROJECT> securego/gosec /<PROJECT>/...
@@ -284,4 +290,4 @@ You can invoke now the `go generate` in the root of the project:
284290
go generate ./...
285291
```
286292

287-
This will generate the `rules/tls_config.go` file with will contain the current ciphers recommendation from Mozilla.
293+
This will generate the `rules/tls_config.go` file which will contain the current ciphers recommendation from Mozilla.

0 commit comments

Comments
 (0)