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 merger do not considering uriBaseId #122

Open
DenisYelkin opened this issue Dec 26, 2023 · 1 comment
Open

Sarif report merger do not considering uriBaseId #122

DenisYelkin opened this issue Dec 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@DenisYelkin
Copy link

SarifReportMerger.kt - merging only results. Without considering uriBaseId and originalUriBaseIds. It leads to inability to parse actual artifact location for particular result.

Example:

{
    "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
    "version": "2.1.0",
    "runs": [
        {
            "originalUriBaseIds": {
                "%SRCROOT%": {
                    "uri": "file:///Users/user/projects/android/modules/second/"
                }
            },
            "results": [
                {
                    "level": "warning",
                    "locations": [
                        {
                            "physicalLocation": {
                                "artifactLocation": {
                                    "uri": "src/main/kotlin/my/module/first/Utils.kt",
                                    "uriBaseId": "%SRCROOT%"
                                },
                ...

originalUriBaseIds - has only one reference to module second. Meanwhile results uriBaseId linked to wrong uri (Utils.kt located in another module).

  • Version of detekt used: 1.23.4
@DenisYelkin DenisYelkin added the bug Something isn't working label Dec 26, 2023
@BraisGabin BraisGabin transferred this issue from detekt/detekt May 8, 2024
@BraisGabin
Copy link
Member

No idea how we didn't pick up this PR earliear. In the meantime we changed that part of the code a lot. Basically we move the responsability of merging two different reports to sarif4k. Can you check if this issue is still present in the new implementation? To be honest I don't use sarif that much so I don't understand completely the issue.

If it is still there, do you want to create a PR fixing it? The merge code is kind of simple so it shouldn't be difficult to implement: https://github.com/detekt/sarif4k/blob/main/src/commonMain/kotlin/io/github/detekt/sarif4k/Merging.kt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants