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

Generated SARIF file is not valid SARIF #38

Closed
v-homsi opened this issue Sep 14, 2022 · 5 comments
Closed

Generated SARIF file is not valid SARIF #38

v-homsi opened this issue Sep 14, 2022 · 5 comments

Comments

@v-homsi
Copy link

v-homsi commented Sep 14, 2022

Summary

Generated SARIF file is not considered valid as per upload-sarif github action.

This is due to the duplicate ids of some of the rules generated in the SARIF file.

Steps to reproduce the behavior

To reproduce the error, you will need to run a github action similar to this. You can also check out the error in this run.

To reproduce the SARIF file, you can run:

git clone https://github.com/v-homsi/evmos.git
git checkout fix/gosec
go install github.com/cosmos/gosec/v2/cmd/gosec
gosec --no-fail -fmt sarif -out results.sarif ./...

gosec version

Master branch

Go version (output of 'go version')

go1.18.4

Operating system / Environment

Ubuntu

Expected behavior

Generated SARIF is valid and can be uploaded

Actual behavior

Generated SARIF is not valid and cannot be uploaded

I cannot upload the sample file as the format is not supported by github. But here's a snippet of the SARIF file generated:

"tool": {
    "driver": {
        "name": "gosec",
        "informationUri": "https://github.com/securego/gosec/",
        "rules": [
            {
                "id": "G701 (CWE-)",
                "name": "Potential integer overflow by integer type conversion",
                "shortDescription": {
                    "text": "Potential integer overflow by integer type conversion"
                },
                "fullDescription": {
                    "text": "Potential integer overflow by integer type conversion"
                },
                "help": {
                    "text": "Potential integer overflow by integer type conversion\nSeverity: HIGH\nConfidence: MEDIUM\nCWE: "
                },
                "properties": {
                    "tags": [
                        "CWE-",
                        "HIGH"
                    ]
                }
            },
            {
                "id": "G701 (CWE-)",
                "name": "Potential integer overflow by integer type conversion",
                "shortDescription": {
                    "text": "Potential integer overflow by integer type conversion"
                },
                "fullDescription": {
                    "text": "Potential integer overflow by integer type conversion"
                },
                "help": {
                    "text": "Potential integer overflow by integer type conversion\nSeverity: HIGH\nConfidence: MEDIUM\nCWE: "
                },
                "properties": {
                    "tags": [
                        "CWE-",
                        "HIGH"
                    ]
                }
            },
            {
                "id": "G701 (CWE-)",
                "name": "Potential integer overflow by integer type conversion",
                "shortDescription": {
                    "text": "Potential integer overflow by integer type conversion"
                },
                "fullDescription": {
                    "text": "Potential integer overflow by integer type conversion"
                },
                "help": {
                    "text": "Potential integer overflow by integer type conversion\nSeverity: HIGH\nConfidence: MEDIUM\nCWE: "
                },
                "properties": {
                    "tags": [
                        "CWE-",
                        "HIGH"
                    ]
                }
            }
        ]
    }
},
@odeke-em
Copy link
Collaborator

Thank you for the report @v-homsi! Kindly tagging my colleague @kirbyquerby to take a look.

kirbyquerby added a commit to orijtech/gosec that referenced this issue Sep 15, 2022
This change is based on securego/gosec#565 .

Fixes include:
* add a version field to the driver
* report start and end line of issues
* report correct sarif level based on the issue's reported severity rather than always warning
* avoid duplicate entries in rules

Updates cosmos#38
@kirbyquerby
Copy link
Collaborator

It looks like this was previously fixed in the upstream securego/gosec in securego/gosec#565

I've made #39 to pull in those changes, which should hopefully solve the issue. This repo is based on a pretty old version of gosec (almost 2 years old, I believe). Since this repository is primarily just additional rules on top of what securego/gosec provides, we would probably benefit a lot from figuring out a way to just add our rules to the latest version of gosec, rather than maintaining an entire fork. This will let us benefit from bug fixes, features, etc from upstream instead of having to discover and fix them separately ourselves.

@odeke-em
Copy link
Collaborator

Roger that @kirbyquerby and thank you for investigating!

kirbyquerby added a commit that referenced this issue Sep 15, 2022
This change is based on securego/gosec#565 .

Fixes include:
* add a version field to the driver
* report start and end line of issues
* report correct sarif level based on the issue's reported severity rather than always warning
* avoid duplicate entries in rules

Updates #38
@kirbyquerby
Copy link
Collaborator

@v-homsi this has hopefully been fixed by #39. I've released v0.0.4.

I'm closing this as the action now succeeds in my fork: https://github.com/kirbyquerby/evmos/actions/runs/3063781539/jobs/4946236000

Feel free to reopen if something's still not working.

@v-homsi
Copy link
Author

v-homsi commented Sep 20, 2022

@kirbyquerby @odeke-em Works perfectly! Thanks for the help on this! Much appreciated :)

v-homsi added a commit to v-homsi/evmos that referenced this issue Sep 20, 2022
fedekunze added a commit to evmos/evmos that referenced this issue Sep 20, 2022
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
SuperVenus0725 added a commit to loveFeynman/cascadia_evm_chain that referenced this issue Jan 9, 2023
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
SuperVenus0725 pushed a commit to loveFeynman/cascadia_evm_chain that referenced this issue Jan 9, 2023
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
SuperVenus0725 pushed a commit to SuperVenus0725/evm_chain that referenced this issue Jan 9, 2023
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
T0psecurity added a commit to T0psecurity/cascadia-chain that referenced this issue May 10, 2023
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
supersenior017 added a commit to supersenior017/evm_chain that referenced this issue Aug 16, 2023
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
niceDeve added a commit to niceDeve/cascadia-chain that referenced this issue Sep 2, 2023
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
jacksonmori755 added a commit to jacksonmori755/cascadia-chain that referenced this issue Sep 13, 2023
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
kingpig-dev added a commit to kingpig-dev/cascadia-chain that referenced this issue Feb 19, 2024
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
slickcharmer added a commit to slickcharmer/evmos that referenced this issue Mar 20, 2024
Uncomment upload sarif step in security workflow

- Uncomment upload sarif as cosmos/gosec#38 is fixed

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
ChrisChan1117 added a commit to ChrisChan1117/cosmos_gosec that referenced this issue May 24, 2024
This change is based on securego/gosec#565 .

Fixes include:
* add a version field to the driver
* report start and end line of issues
* report correct sarif level based on the issue's reported severity rather than always warning
* avoid duplicate entries in rules

Updates cosmos/gosec#38
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

No branches or pull requests

3 participants