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 report missing physical location information #1281

Closed
ghost opened this issue Sep 4, 2020 · 3 comments · Fixed by #1352
Closed

SARIF report missing physical location information #1281

ghost opened this issue Sep 4, 2020 · 3 comments · Fixed by #1352
Labels
bug sarif Issues related to the SARIF report

Comments

@ghost
Copy link

ghost commented Sep 4, 2020

A SARIF report from SpotBugs 4.1.2 contains SARIF results with no physical location information, only logical location information. For example:

      "results": [
        {
          "ruleIndex": 0,
          "level": "note",
          "locations": [
            {
              "logicalLocations": [
                {
                  "kind": "type",
                  "name": "ClassReader",
                  "fullyQualifiedName": "aj/org/objectweb/asm/ClassReader.java:[line 3072]"
                }
              ]
            }
          ],
          "ruleId": "UC_USELESS_CONDITION",
          "message": {
            "arguments": [
              "frameType >= 248 (0xf8)"
            ],
            "id": "default"
          }
        },

When I was working with @KengoTODA on validating the SARIF report, the sample I saw did have physical location information, for example:

      "results": [
        {
          "ruleIndex": 0,
          "level": "note",
          "locations": [
            {
              "physicalLocation": {
                "region": {
                  "endLine": 166,
                  "startLine": 166
                },
                "artifactLocation": {
                  "uri": "edu/umd/cs/findbugs/AnalysisError.java",
                  "uriBaseId": "-176137563"
                }
              },
              "logicalLocation": [
                {
                  "kind": "type",
                  "name": "AnalysisError",
                  "fullyQualifiedName": "edu/umd/cs/findbugs/AnalysisError.java:[line 166]"
                }
              ]
            }
          ],

Is this a regression? Is full SARIF support scheduled for a later version than 4.1.2?

Thanks,
Larry

@boAndron @michaelcfanning @lukadlet

@welcome
Copy link

welcome bot commented Sep 4, 2020

Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.

@ghost
Copy link
Author

ghost commented Sep 15, 2020

@KengoTODA, we have a team that is blocked on this issue. Could you please let me know if there is a workaround, or an ETA to address it? Can we help in any way?

Thanks,
Larry

@boAndron @michaelcfanning @lukadlet

@michaelcfanning
Copy link

Definitely, there should be a physical location to express the startLine. Note that it isn't required (but it also doesn't hurt) to include an endLine value when it matches the startLine. Fixing this would only help with log size.

More of a concern is that you shouldn't be encoding the start line in a logical name. The identify of this thing, logically, is a type but if you burn the line location into its name, you may break SARIF result matchers that are operating against the fully qualified name for matches. i.e., one of the core ways the baseline works is to lower the priority of line locations (because these can change run over over) and to raise the priority of logical names (because they tend to be more resilient/stable as code churns).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug sarif Issues related to the SARIF report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants