1
0
mirror of https://github.com/securego/gosec.git synced 2025-06-14 23:45:03 +02:00

28 Commits

Author SHA1 Message Date
399e835157 Fix typos in comments and fields 2024-11-30 10:37:42 +01:00
6fbd381238 Catch os.ModePerm permissions in os.WriteFile
Signed-off-by: Cosmin Cojocar <cosmin@cojocar.ch>
2024-05-14 15:33:23 +02:00
4def3a4eb0 Fix lint warning
Signed-off-by: Cosmin Cojocar <gcojocar@adobe.com>
2023-09-25 13:24:34 +02:00
0d332a1027 Add a new rule which detects when a file is created with os.Create but the configured permissions are less than 0666
It seems that the os.Create will create by default a file with 0666 permissions.

This should be detected when the configured permissions are less than 0666. By default will not detect this case
unless the more restrictive mode is configured.

Signed-off-by: Cosmin Cojocar <gcojocar@adobe.com>
2023-09-25 13:24:34 +02:00
de2c6a36fa Extract the issue in its own package 2023-02-16 09:45:28 +01:00
cf63541008 fileperms: bitwise permission comparison (#883)
* fileperms: extract existing mode comparison logic

* fileperms: add failing test

* fileperms: bitwise permission comparison
2022-10-20 08:48:40 +02:00
afc9903ba9 Fix use rule IDs to retrieve the rule config 2022-03-28 20:28:02 +02:00
f285d612b5 Fix formatting issues with gofumpt (#685)
Signed-off-by: Cosmin Cojocar <ccojocar@cloudbees.com>
2021-08-18 13:16:21 +02:00
1256f16f33 Fix lint and fail on error in the ci build 2021-05-31 10:44:12 +02:00
1fce46151c fix: WriteParams rule to work also with golang 1.16 (#577)
In go 1.16 the `ioutil` package was deprecated and
the functions should be replaced by their equivalents
in either `io` or `os` packages. This means,
that `ioutil.WriteFile` should be replaced by
`os.WriteFile` instead. To account for this change
and to detect incorrect permissions also for `os.WriteFile`
I changed `filePermissions` rule slightly to allows
specifying multiple packages that can contain given
function and that we should check. This workaround
can be removed after a sufficient time has passed
and after it is decided that checking `os.WriteFile`
is enough.

Fixes: https://github.com/securego/gosec/issues/576
2021-02-22 09:22:04 +01:00
c6e10af40f Handle properly the gosec module version v2
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
2020-04-06 09:06:23 -07:00
a305f10eb9 Fileperms (#442) 2020-02-28 12:48:18 +01:00
3af4ae9ddb Fix some lint warnings
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
2019-05-01 08:52:23 +02:00
893b87b343 Replace gas with gosec everywhere in the project 2018-07-19 18:42:25 +02:00
da26f64208 Rename github org (#214) 2018-07-19 17:40:28 +10:00
2115402409 Add the rule ID to issues (#188) 2018-03-12 18:18:44 +10:00
1429033aca Add support for #excluding specific rules 2018-03-02 23:44:51 +00:00
1c58cbd378 Make the folder permissions more permissive to avoid false positives (#175) 2018-02-15 19:53:01 +10:00
af25ac1f6e fix golint errors picked up by hound-ci 2017-12-13 22:35:47 +10:00
bf78d027a9 Restructure and introduce a standalone config 2017-04-28 14:46:26 -07:00
cacf21f3c0 Restructure to focus on lib rather than cli 2017-04-26 08:08:46 -07:00
6ace60b950 Address unhandled error conditions
Closes #95
2016-12-02 10:20:23 -08:00
bf103da519 Allow rules to register against multiple ast nodes
Update the AddRule interface to allow rules to register interest in
multiple ast.Nodes. Adds more flexibility to how rules can work, and was
needed to fix the hard coded credentials test specifically.
2016-11-13 12:55:31 -08:00
1d732b8ae3 Ensure os.OpenFile file permissions are checked
In addition configuration file may be used to set the permission level.

Closes #53
2016-11-12 17:57:20 -08:00
74b6633ee0 Updated imports to new repository location. 2016-11-02 16:54:20 -07:00
713949fe69 Rule selection rules
This makes the following changes:
- riles are identified by an ID
- include / exclude list now work
- rules are selected based on these lists
- blacklist rules are broken out into methods
- rule constructors now take the config map
- config file can be used to select rules
- CLI options embelish config selection options
2016-08-11 10:45:51 +01:00
cee5fad4c3 Fix incorrect regexp matches
There are some cases where the '.' character would also match any
character and could lead to incorrect results. For example the
regular expression -  `^ioutils.WriteFile$' would match
ioutils.WriteFile, but also ioutils_WriteFile.

Additionally made sure that all regexp were declared using raw
strings to avoid any unnecesary string escaping that potentially
make the regexp difficult to read.
2016-07-30 13:29:33 -07:00
4f3d620d37 Initial public release 2016-07-20 15:56:32 +01:00