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

False positive: Ruby: Kernel Open when File existence guard is present #16943

Open
JLLeitschuh opened this issue Jul 9, 2024 · 3 comments
Open

Comments

@JLLeitschuh
Copy link
Contributor

Description of the false positive

When IO.read is guarded by a check like File.exists?, isn't that a valid guard against injecting the | character into Kernel.open? I don't imagine that many systems out there have files lying around named |.txt.

Code samples or links to source code

https://github.com/github/codeql/blob/81593ece5aa7701ec0b103932f84ff65ae506e0b/ruby/ql/lib/codeql/ruby/security/KernelOpenQuery.qll#L83C1-L87

URL to the alert on GitHub code scanning (optional)

@ginsbach
Copy link
Contributor

Thank you for the report!
We do not prioritise false positives at the moment, but we track them internally and will keep them in mind for future work.

@JLLeitschuh
Copy link
Contributor Author

JLLeitschuh commented Jul 10, 2024

Seems like an interesting choice, given that, from what I've heard, many orgs purchase SAST tools based upon the FP rate compared to other SAST tools.

Perhaps at least updating the documentation stating that a File.exists? check is a valid guard, but doing so won't resolve the alert?

@ginsbach
Copy link
Contributor

Apologies if I sounded dismissive, that wasn't my intention. We do value false positive reports, but for now we have other product priorities. Therefore, we do not immediately act on false positive reports but instead track them for later consideration.

That being said, I have forwarded your documentation suggestion to the relevant team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants