gosec/testutils
czechbol eaedce9a8b
Improvement the int conversion overflow logic to handle bound checks (#1194)
* add test cases

Signed-off-by: czechbol <adamludes@gmail.com>

* fix bounds check logic

Signed-off-by: czechbol <adamludes@gmail.com>

* tweak test cases

Signed-off-by: czechbol <adamludes@gmail.com>

* fix codestyle

Signed-off-by: czechbol <adamludes@gmail.com>

* improve bounds check logic

Signed-off-by: czechbol <adamludes@gmail.com>

* max recursion depth

Signed-off-by: czechbol <adamludes@gmail.com>

* add test case for len function

Signed-off-by: czechbol <adamludes@gmail.com>

* relax len function bounds checks

Co-authored-by: Ben Krieger <ben.krieger@intel.com>

* handle cases when convert instruction is after the if blocks

Signed-off-by: czechbol <adamludes@gmail.com>

* improve range check discovery, add tests

Signed-off-by: czechbol <adamludes@gmail.com>

* refactor for readability

Signed-off-by: czechbol <adamludes@gmail.com>

* add cap function test

Signed-off-by: czechbol <adamludes@gmail.com>

* calculate signed min without throwing overflow warnings

Signed-off-by: czechbol <adamludes@gmail.com>

* perform bounds checks int size calculations

Signed-off-by: czechbol <adamludes@gmail.com>

* basic equal operator logic

Signed-off-by: czechbol <adamludes@gmail.com>

* uintptr -> unsafe.Pointer test case

Signed-off-by: czechbol <adamludes@gmail.com>

* fix review comments

Signed-off-by: czechbol <adamludes@gmail.com>

* Rebase and fix go module

Change-Id: I8da6495eaaf25b1739389aa98492bd7df338085b
Signed-off-by: Cosmin Cojocar <ccojocar@google.com>

* fix false positive for negated value

Signed-off-by: czechbol <adamludes@gmail.com>

* fix range conditions

Signed-off-by: czechbol <adamludes@gmail.com>

* Ignore the golangci/gosec G115 warning

Change-Id: I0db56cb0a5f9ab6e815e2480ec0b66d7061b23d3
Signed-off-by: Cosmin Cojocar <ccojocar@google.com>

---------

Signed-off-by: czechbol <adamludes@gmail.com>
Signed-off-by: Cosmin Cojocar <ccojocar@google.com>
Co-authored-by: Ben Krieger <ben.krieger@intel.com>
Co-authored-by: Cosmin Cojocar <ccojocar@google.com>
2024-09-04 16:09:54 +02:00
..
cgo_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g101_samples.go Fix nosec when applied to a block 2024-05-28 12:54:05 +02:00
g102_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g103_samples.go Allow excluding analyzers globally (#1180) 2024-08-20 10:43:40 +02:00
g104_samples.go chore: Refactor Sample Code to Separate Files 2023-12-08 14:46:36 +01:00
g106_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g107_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g108_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g109_samples.go Allow excluding analyzers globally (#1180) 2024-08-20 10:43:40 +02:00
g110_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g111_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g112_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g113_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g114_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g115_samples.go Improvement the int conversion overflow logic to handle bound checks (#1194) 2024-09-04 16:09:54 +02:00
g201_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g202_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g203_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g204_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g301_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g302_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g303_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g304_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g305_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g306_samples.go Add a unit test to detect the false negative in rule G306 for os.ModePerm permissions 2024-05-14 15:33:23 +02:00
g307_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g401_samples.go Split the G401 rule into two separate ones 2024-06-24 15:25:54 +02:00
g402_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g403_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g404_samples.go Add support for math/rand/v2 added in Go 1.22 2024-03-07 16:33:18 +01:00
g405_samples.go Fixed coverage workflow 2024-06-24 15:25:54 +02:00
g406_samples.go Added more rules 2024-06-25 13:18:27 +02:00
g407_samples.go Added another test case in order to increase code coverage 2024-08-30 19:35:07 +02:00
g501_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g502_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g503_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g504_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g505_samples.go Fix lint warnings by properly formatting the files 2023-12-08 14:46:36 +01:00
g506_samples.go Added more rules 2024-06-25 13:18:27 +02:00
g507_samples.go Added more rules 2024-06-25 13:18:27 +02:00
g601_samples.go chore: Refactor Sample Code to Separate Files 2023-12-08 14:46:36 +01:00
g602_samples.go fix: G602 support for nested conditionals with bounds check (#1201) 2024-09-04 11:07:42 +02:00
log.go Major rework of codebase 2017-07-19 15:17:00 -06:00
pkg.go Refactor how ignored issues are tracked 2023-10-13 14:11:08 +02:00
sample_types.go chore: Refactor Sample Code to Separate Files 2023-12-08 14:46:36 +01:00
visitor.go Handle properly the gosec module version v2 2020-04-06 09:06:23 -07:00