Skip to content

Conversation

@matoous
Copy link
Contributor

@matoous matoous commented Feb 18, 2021

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: #576

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: securego#576
@ccojocar ccojocar merged commit 1fce461 into securego:master Feb 22, 2021
sthagen added a commit to sthagen/securego-gosec that referenced this pull request Feb 23, 2021
fix: WriteParams rule to work also with golang 1.16 (securego#577)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: File permissions check breaks with go1.16

2 participants