cleanunicorn / mythos

CLI client for the MythX API
https://mythx.io/
20 stars 6 forks source link

Bug Fix: Wrong issues count #23

Closed tagomaru closed 5 years ago

tagomaru commented 5 years ago

I found probally bug regarding counting the number of issues.

Issues (vulnerabilities) are included like below.

{
    "issues": [
        {
            "issues": [
                {
                    "swcID": "SWC-106",
                    "swcTitle": "Unprotected SELFDESTRUCT Instruction",
                    "description": {
                        "head": "The contract can be killed by anyone.",
                        "tail": "Arbitrary senders can kill this contract and withdraw its balance to their own account."
                    },
                    "severity": "High",
                    "locations": [
                        {
                            "sourceMap": "112:24:0"
                        }
                    ],
                    "extra": {
                        "testCase": {
                            "initialState": {
                                "accounts": null
                            },
                            "steps": null
                        }
                    }
                },
                {
                    "swcID": "SWC-103",
                    "swcTitle": "Floating Pragma",
                    "description": {
                        "head": "A floating pragma is set.",
                        "tail": "It is recommended to make a conscious choice on what version of Solidity is used for compilation. Currently any version equal or greater than \"0.5.3\" is allowed."
                    },
                    "severity": "Medium",
                    "locations": [
                        {
                            "sourceMap": "0:23:1"
                        }
                    ],
                    "extra": {
                        "testCase": {
                            "initialState": {
                                "accounts": null
                            },
                            "steps": null
                        }
                    }
                }
            ],
            "sourceType": "solidity-file",
            "sourceFormat": "text",
            "sourceList": [
                "test/contracts/vulnerable.sol",
                "/test/contracts/vulnerable.sol"
            ],
            "meta": {
                "coveredInstructions": 96,
                "coveredPaths": 6,
                "selectedCompiler": "0.5.3"
            }
        }
    ],
    "uuid": "54972960-1dc2-45f7-8f64-6fafcb46b39b"
}

That is why it should get the number with issues.issues[0].issues.length.

cleanunicorn commented 5 years ago

This looks good