Update solc version recommendations

pull/999/head
Josselin 3 years ago
parent 1df9486bd3
commit b587d897c7
  1. 31
      slither/detectors/attributes/incorrect_solc.py
  2. 6
      tests/detectors/solc-version/0.5.14/static.sol.0.5.14.IncorrectSolc.json

@ -51,9 +51,7 @@ Consider using the latest version of Solidity for testing."""
OLD_VERSION_TXT = "allows old versions"
LESS_THAN_TXT = "uses lesser than"
TOO_RECENT_VERSION_TXT = (
"necessitates a version too recent to be trusted. Consider deploying with 0.6.12/0.7.6"
)
TOO_RECENT_VERSION_TXT = "necessitates a version too recent to be trusted. Consider deploying with 0.6.12/0.7.6/0.8.8"
BUGGY_VERSION_TXT = (
"is known to contain severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)"
)
@ -66,6 +64,10 @@ Consider using the latest version of Solidity for testing."""
"0.6.12",
"0.7.5",
"0.7.6",
"0.8.4",
"0.8.5",
"0.8.6",
"0.8.7",
]
# Indicates the versions that should not be used.
@ -80,6 +82,8 @@ Consider using the latest version of Solidity for testing."""
"^0.5.14",
"0.6.9",
"^0.6.9",
"0.8.8",
"^0.8.8",
]
def _check_version(self, version):
@ -87,6 +91,8 @@ Consider using the latest version of Solidity for testing."""
if op and op not in [">", ">=", "^"]:
return self.LESS_THAN_TXT
version_number = ".".join(version[2:])
if version_number in self.BUGGY_VERSIONS:
return self.BUGGY_VERSION_TXT
if version_number not in self.ALLOWED_VERSIONS:
if list(map(int, version[2:])) > list(map(int, self.ALLOWED_VERSIONS[-1].split("."))):
return self.TOO_RECENT_VERSION_TXT
@ -144,11 +150,20 @@ Consider using the latest version of Solidity for testing."""
results.append(json)
if self.compilation_unit.solc_version not in self.ALLOWED_VERSIONS:
info = [
"solc-",
self.compilation_unit.solc_version,
" is not recommended for deployment\n",
]
if self.compilation_unit.solc_version in self.BUGGY_VERSIONS:
info = [
"solc-",
self.compilation_unit.solc_version,
" ",
self.BUGGY_VERSION_TXT,
]
else:
info = [
"solc-",
self.compilation_unit.solc_version,
" is not recommended for deployment\n",
]
json = self.generate_result(info)

@ -38,10 +38,10 @@
},
{
"elements": [],
"description": "solc-0.5.14 is not recommended for deployment\n",
"markdown": "solc-0.5.14 is not recommended for deployment\n",
"description": "solc-0.5.14 is known to contain severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)",
"markdown": "solc-0.5.14 is known to contain severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)",
"first_markdown_element": "",
"id": "839b9aa9c05b3f4bfeb7aefa9b7a69d82a322bf527f21bbf7080a7855f003803",
"id": "d29c07fc4fd9f7602b9f99b17646c6ce1a1c10740d60888a7a706f2537f6e59d",
"check": "solc-version",
"impact": "Informational",
"confidence": "High"

Loading…
Cancel
Save