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

SARIF Multitool query OR logic doesn't work #2709

Closed
dotpaul opened this issue Aug 16, 2023 · 0 comments
Closed

SARIF Multitool query OR logic doesn't work #2709

dotpaul opened this issue Aug 16, 2023 · 0 comments

Comments

@dotpaul
Copy link
Collaborator

dotpaul commented Aug 16, 2023

With this example SARIF:

{
  "version": "2.1.0",
  "$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4",
  "runs": [
    {
      "tool": {
        "driver": {
          "name": "ESLint",
          "informationUri": "https://eslint.org",
          "rules": [
            {
              "id": "no-eval",
              "shortDescription": {
                "text": "disallow the use of `eval()`"
              },
              "helpUri": "https://eslint.org/docs/rules/no-eval",
              "properties": {
                "category": "Best Practices"
              }
            },
            {
              "id": "no-unused-vars",
              "shortDescription": {
                "text": "disallow unused variables"
              },
              "helpUri": "https://eslint.org/docs/rules/no-unused-vars",
              "properties": {
                "category": "Variables"
              }
            }
          ]
        }
      },
      "artifacts": [
        {
          "location": {
            "uri": "file:///C:/dev/sarif/sarif-tutorials/samples/Introduction/simple-example.js"
          }
        }
      ],
      "results": [
        {
          "level": "error",
          "message": {
            "text": "eval can be harmful."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "file:///C:/dev/sarif/sarif-tutorials/samples/Introduction/simple-example.js",
                  "index": 0
                },
                "region": {
                  "startLine": 500,
                  "startColumn": 4
                }
              }
            }
          ],
          "ruleId": "no-eval",
          "ruleIndex": 0
        },
        {
          "level": "error",
          "message": {
            "text": "'x' is assigned a value but never used."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "file:///C:/dev/sarif/sarif-tutorials/samples/Introduction/simple-example.js",
                  "index": 0
                },
                "region": {
                  "startLine": 1,
                  "startColumn": 5
                }
              }
            }
          ],
          "ruleId": "no-unused-vars",
          "ruleIndex": 1
        }
      ]
    }
  ]
}

Expected behavior

These two queries should be equivalent and include both results:

  • Message.Text : assigned OR Message.Text : eval
  • Message.Text : eval OR Message.Text : assigned

Actual behavior

C:\>sarif query simple-example2.sarif -w -e "Message.Text : assigned OR Message.Text : eval"
C:\dev\sarif\sarif-tutorials\samples\Introduction\simple-example.js(500,4): error no-eval: eval can be harmful.
Found 1 of 2 results matched in 0.2s.

C:\>sarif query simple-example2.sarif -w -e "Message.Text : eval OR Message.Text : assigned"
C:\dev\sarif\sarif-tutorials\samples\Introduction\simple-example.js(1,5): error no-unused-vars: 'x' is assigned a value but never used.
Found 1 of 2 results matched in 0.2s.
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 a pull request may close this issue.

1 participant