Skip to content

remove G113. It only affects old/unsupported versions of Go #1328

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

Merged
merged 5 commits into from
Apr 3, 2025
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ directory you can supply `./...` as the input argument.
- G110: Potential DoS vulnerability via decompression bomb
- G111: Potential directory traversal
- G112: Potential slowloris attack
- G113: Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114: Use of net/http serve function that has no support for setting timeouts
- G115: Potential integer overflow when converting between integer types
- G201: SQL query construction using format string
Expand Down Expand Up @@ -172,6 +171,7 @@ directory you can supply `./...` as the input argument.
### Retired rules

- G105: Audit the use of math/big.Int.Exp - [CVE is fixed](https://github.com/golang/go/issues/15184)
- G113: Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772). This affected Go <1.16.14 and Go <1.17.7, which are no longer supported by gosec.
- G307: Deferring a method which returns an error - causing more inconvenience than fixing a security issue, despite the details from this [blog post](https://www.joeshaw.org/dont-defer-close-on-writable-files/)

### Selecting rules
Expand Down
1 change: 0 additions & 1 deletion issue/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ var ruleToCWE = map[string]string{
"G110": "409",
"G111": "22",
"G112": "400",
"G113": "190",
"G114": "676",
"G115": "190",
"G201": "89",
Expand Down
39 changes: 34 additions & 5 deletions report/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,40 @@ var _ = Describe("Formatter", func() {
})
Context("When using different report formats", func() {
grules := []string{
"G101", "G102", "G103", "G104", "G106", "G107", "G109",
"G110", "G111", "G112", "G113", "G201", "G202", "G203",
"G204", "G301", "G302", "G303", "G304", "G305", "G401",
"G402", "G403", "G404", "G405", "G406", "G407", "G501",
"G502", "G503", "G504", "G505", "G506", "G507", "G601",
"G101",
"G102",
"G103",
"G104",
"G106",
"G107",
"G109",
"G110",
"G111",
"G112",
"G201",
"G202",
"G203",
"G204",
"G301",
"G302",
"G303",
"G304",
"G305",
"G401",
"G402",
"G403",
"G404",
"G405",
"G406",
"G407",
"G501",
"G502",
"G503",
"G504",
"G505",
"G506",
"G507",
"G601",
}

It("csv formatted report should contain the CWE mapping", func() {
Expand Down
45 changes: 0 additions & 45 deletions rules/math_big_rat.go

This file was deleted.

1 change: 0 additions & 1 deletion rules/rulelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func Generate(trackSuppressions bool, filters ...RuleFilter) RuleList {
{"G110", "Detect io.Copy instead of io.CopyN when decompression", NewDecompressionBombCheck},
{"G111", "Detect http.Dir('/') as a potential risk", NewDirectoryTraversal},
{"G112", "Detect ReadHeaderTimeout not configured as a potential risk", NewSlowloris},
{"G113", "Usage of Rat.SetString in math/big with an overflow", NewUsingOldMathBig},
{"G114", "Use of net/http serve function that has no support for setting timeouts", NewHTTPServeWithoutTimeouts},

// injection
Expand Down
4 changes: 0 additions & 4 deletions rules/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ var _ = Describe("gosec rules", func() {
runner("G112", testutils.SampleCodeG112)
})

It("should detect potential uncontrolled memory consumption in Rat.SetString", func() {
runner("G113", testutils.SampleCodeG113)
})

It("should detect uses of net/http serve functions that have no support for setting timeouts", func() {
runner("G114", testutils.SampleCodeG114)
})
Expand Down
22 changes: 0 additions & 22 deletions testutils/g113_samples.go

This file was deleted.

Loading