Fixed minor typos in comments

pull/174/head
rajeevgopalakrishna 6 years ago
parent 8344c4edf3
commit fe997e7030
  1. 3
      slither/detectors/erc20/incorrect_interface.py
  2. 2
      slither/detectors/erc20/unindexed_event_parameters.py
  3. 4
      slither/detectors/statements/deprecated_calls.py
  4. 2
      slither/detectors/statements/incorrect_strict_equality.py
  5. 6
      slither/detectors/statements/tx_origin.py
  6. 8
      slither/detectors/variables/uninitialized_local_variables.py
  7. 8
      slither/detectors/variables/uninitialized_storage_variables.py

@ -1,7 +1,6 @@
""" """
Detect incorrect erc20 interface. Detect incorrect erc20 interface.
Some contracts do not return a bool on transfer/transferFrom/approve, which may lead to prevent Some contracts do not return a bool on transfer/transferFrom/approve, which may lead to preventing the contract to be used with contracts compiled with recent solc (>0.4.22)
the contract to be used with contracts compiled with recent solc (>0.4.22)
""" """
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification

@ -17,7 +17,7 @@ class UnindexedERC20EventParameters(AbstractDetector):
WIKI = 'https://github.com/trailofbits/slither/wiki/Detectors-Documentation#unindexed-erc20-event-parameters' WIKI = 'https://github.com/trailofbits/slither/wiki/Detectors-Documentation#unindexed-erc20-event-parameters'
WIKI_TITLE = 'Unindexed ERC20 Event Parameters' WIKI_TITLE = 'Unindexed ERC20 Event Parameters'
WIKI_DESCRIPTION = 'Detects that events defined by the ERC20 specification which are meant to have some parameters as `indexed`, are not missing the `indexed` keyword.' WIKI_DESCRIPTION = 'Detects that events defined by the ERC20 specification which are meant to have some parameters as `indexed`, are missing the `indexed` keyword.'
WIKI_EXPLOIT_SCENARIO = ''' WIKI_EXPLOIT_SCENARIO = '''
```solidity ```solidity
contract ERC20Bad { contract ERC20Bad {

@ -144,7 +144,7 @@ contract ContractWithDeprecatedReferences {
return results return results
def _detect(self): def _detect(self):
""" Detect shadowing local variables """ Detects if an expression makes use of any deprecated standards.
Recursively visit the calls Recursively visit the calls
Returns: Returns:
@ -165,7 +165,7 @@ contract ContractWithDeprecatedReferences {
recommended_disc) recommended_disc)
# Generate relevant JSON data for this shadowing definition. # Generate relevant JSON data for this deprecated standard.
json = self.generate_json_result(info) json = self.generate_json_result(info)
if isinstance(source_object, StateVariableSolc) or isinstance(source_object, StateVariable): if isinstance(source_object, StateVariableSolc) or isinstance(source_object, StateVariable):
self.add_variable_to_json(source_object, json) self.add_variable_to_json(source_object, json)

@ -26,7 +26,7 @@ class IncorrectStrictEquality(AbstractDetector):
WIKI = 'https://github.com/trailofbits/slither/wiki/Detectors-Documentation#dangerous-strict-equalities' WIKI = 'https://github.com/trailofbits/slither/wiki/Detectors-Documentation#dangerous-strict-equalities'
WIKI_TITLE = 'Dangerous strict equalities' WIKI_TITLE = 'Dangerous strict equalities'
WIKI_DESCRIPTION = 'Use of strick equalities that can be easily manipulated by an attacker.' WIKI_DESCRIPTION = 'Use of strict equalities that can be easily manipulated by an attacker.'
WIKI_EXPLOIT_SCENARIO = ''' WIKI_EXPLOIT_SCENARIO = '''
```solidity ```solidity
contract Crowdsale{ contract Crowdsale{

@ -27,14 +27,14 @@ contract TxOrigin {
require(tx.origin == owner); require(tx.origin == owner);
} }
``` ```
Bob is the owner of `TxOrigin`. Bob calls Eve's contract. Eve's contact calls `TxOrigin` and bypass the `tx.origin` protection.''' Bob is the owner of `TxOrigin`. Bob calls Eve's contract. Eve's contract calls `TxOrigin` and bypasses the `tx.origin` protection.'''
WIKI_RECOMMENDATION = 'Do not use `tx.origin` for authentification.' WIKI_RECOMMENDATION = 'Do not use `tx.origin` for authorization.'
@staticmethod @staticmethod
def _contains_incorrect_tx_origin_use(node): def _contains_incorrect_tx_origin_use(node):
""" """
Check if the node read tx.origin and dont read msg.sender Check if the node reads tx.origin and doesn't read msg.sender
Avoid the FP due to (msg.sender == tx.origin) Avoid the FP due to (msg.sender == tx.origin)
Returns: Returns:
(bool) (bool)

@ -1,8 +1,8 @@
""" """
Module detecting state uninitialized local variables Module detecting uninitialized local variables
Recursively explore the CFG to only report uninitialized local variables that are Recursively explore the CFG to only report uninitialized local variables that are
written before being read read before being written
""" """
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
@ -77,11 +77,11 @@ Bob calls `transfer`. As a result, the ethers are sent to the address 0x0 and ar
def _detect(self): def _detect(self):
""" Detect uninitialized state variables """ Detect uninitialized local variables
Recursively visit the calls Recursively visit the calls
Returns: Returns:
dict: [contract name] = set(state variable uninitialized) dict: [contract name] = set(local variable uninitialized)
""" """
results = [] results = []

@ -1,5 +1,5 @@
""" """
Module detecting state uninitialized storage variables Module detecting uninitialized storage variables
Recursively explore the CFG to only report uninitialized storage variables that are Recursively explore the CFG to only report uninitialized storage variables that are
written before being read written before being read
@ -58,7 +58,7 @@ Bob calls `func`. As a result, `owner` is override to 0.
if self.key in father.context: if self.key in father.context:
fathers_context += father.context[self.key] fathers_context += father.context[self.key]
# Exclude path that dont bring further information # Exclude paths that dont bring further information
if node in self.visited_all_paths: if node in self.visited_all_paths:
if all(f_c in self.visited_all_paths[node] for f_c in fathers_context): if all(f_c in self.visited_all_paths[node] for f_c in fathers_context):
return return
@ -84,11 +84,11 @@ Bob calls `func`. As a result, `owner` is override to 0.
def _detect(self): def _detect(self):
""" Detect uninitialized state variables """ Detect uninitialized storage variables
Recursively visit the calls Recursively visit the calls
Returns: Returns:
dict: [contract name] = set(state variable uninitialized) dict: [contract name] = set(storage variable uninitialized)
""" """
results = [] results = []

Loading…
Cancel
Save