Skip to content

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

Open
@JLLeitschuh

Description

@JLLeitschuh

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions