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

Fix the rule G304 to handle the case when the input is cleaned as a variable assignment #513

Merged
merged 2 commits into from
Aug 19, 2020

Conversation

ccojocar
Copy link
Member

fixes #506

@ccojocar ccojocar requested a review from gcmurphy August 17, 2020 19:06
…ariable assignment

Signed-off-by: Cosmin Cojocar <ccojocar@cloudbees.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2020

Codecov Report

Merging #513 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #513   +/-   ##
=======================================
  Coverage   72.70%   72.70%           
=======================================
  Files           9        9           
  Lines         674      674           
=======================================
  Hits          490      490           
  Misses        163      163           
  Partials       21       21           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b60ddc2...654ca97. Read the comment docs.

Copy link
Member

@gcmurphy gcmurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also look at adding filepath.Rel here?

…the G304 rule

Signed-off-by: Cosmin Cojocar <ccojocar@cloudbees.com>
@ccojocar
Copy link
Member Author

@gcmurphy I added also the filepath.Rel to the methods accepted for sanitation. Please could you have a look again over this pull request? Thanks!

@ccojocar ccojocar merged commit f13b8bc into securego:master Aug 19, 2020
ChristoWolf added a commit to ChristoWolf/go-progress that referenced this pull request Jul 5, 2021
…s containing that action in fimage](https://github.com/ChristoWolf/fimage/actions).

Namely:
- `io.Discard` is not recognized.
- Using `filepath.Clean` outside of the `os.Open` call still yields the [G304](https://securego.io/docs/rules/g304.html) false positive, which has been [fixed already](securego/gosec#513).

Resolves #12
@ccojocar ccojocar deleted the improve-g304 branch May 13, 2024 16:14
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.

G304: error persists after running filePath.Clean on a separate line from os.OpenFile
3 participants