Skip to content
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

feat: add os.ReadFile to G304 #706

Merged
merged 1 commit into from Oct 14, 2021
Merged

feat: add os.ReadFile to G304 #706

merged 1 commit into from Oct 14, 2021

Conversation

Juneezee
Copy link
Contributor

@Juneezee Juneezee commented Oct 6, 2021

In Go 1.16 or higher, the io/ioutil has been deprecated and the ioutil.ReadFile function now calls os.ReadFile.

This PR adds the os.ReadFile function into the G304: Potential file inclusion via variable rule.

In Go 1.16 or higher, the `io/ioutil` has been deprecated and the
`ioutil.ReadFile` function now calls `os.ReadFile`.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
jkowalski pushed a commit to kopia/kopia that referenced this pull request Oct 6, 2021
* refactor: move from io/ioutil to io and os package

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* chore: remove //nolint:gosec for os.ReadFile

At the time of this commit, the G304 rule of gosec does not include the
`os.ReadFile` function. We remove `//nolint:gosec` temporarily until
securego/gosec#706 is merged.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@ccojocar ccojocar merged commit 7fd4aef into securego:master Oct 14, 2021
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.

None yet

2 participants