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

SEC0112 false positive #31

Open
ericwscott opened this issue Aug 10, 2017 · 3 comments
Open

SEC0112 false positive #31

ericwscott opened this issue Aug 10, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@ericwscott
Copy link

ericwscott commented Aug 10, 2017

Any use of a variable in the File API appears to trigger this warning. The only way I can find to satisfy the analyzer is to use a hard coded string for the file path. Even the secure example code from the documentation triggers the warning:

[HttpPost]
public HttpResponseMessage Delete(Guid fileId)
{
    string path = Path.Combine(ConfigurationManager.AppSettings["DownloadPath"], fileId.ToString());
    File.Delete(path);
    return Request.CreateResponse(HttpStatusCode.OK);
}

Is the only way prevent this warning hard coding the path or manual suppression?

@ejohn20
Copy link
Member

ejohn20 commented Aug 11, 2017

Correct, the rule in its current state is more of a dangerous function. We'll add this to the list of rules to improve the taint analysis within the new code block once this is ready.

FYI - You can suppress the rule by right clicking the warning and adding it to a suppression file.

@ericwscott
Copy link
Author

Thanks for the explanation. I'll leave it up to you if you want to close the issue or use it to track the enhancement you were discussing.

@ejohn20
Copy link
Member

ejohn20 commented Aug 11, 2017

No problem. Thanks for the feedback, there are a couple of rules that are similar to this that we can't "fix" in their current state via code changes. This is not ideal. I will leave this issue open so we remember to enhance this rule when the code block analyzer is ready.

@ejohn20 ejohn20 added the bug label Aug 11, 2017
@ejohn20 ejohn20 self-assigned this Aug 11, 2017
@ejohn20 ejohn20 added this to the 1.0.7 milestone Aug 11, 2017
@ejohn20 ejohn20 modified the milestones: 1.0.7, 2.0 Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants