Skip to content

File.join gets confused with collection join #616

@corneliuhoffman

Description

@corneliuhoffman

In the case of ruby there is a confusion between the Class method File.join and collection object method x.join. In particular the following failed:

def test(user_input)
  # ruleid: test-file-join
  sink(File.join("base", user_input))
end

with rule:

rules:
  - id: test-file-join
    message: taint
    languages: [ruby]
    severity: ERROR
    mode: taint
    pattern-sources:
      - patterns:
          - pattern: File.$Z(...)
          - metavariable-regex:
              metavariable: $Z
              regex: ^join$
    pattern-sinks:
      - pattern: sink($EXPR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions