From 93ba8eb603a2801600d96e0ff71075683fbc36f5 Mon Sep 17 00:00:00 2001 From: soad003 Date: Wed, 8 Aug 2018 11:31:42 +0200 Subject: [PATCH 1/4] StaticAnalysis: selfdestruct terminal warning --- .../solidity-analyzer/modules/selfdestruct.js | 52 ++++++++++++++----- .../modules/staticAnalysisCommon.js | 10 ++++ .../staticAnalysisIntegration-test.js | 4 +- .../analysis/test-contracts/selfdestruct.sol | 2 + 4 files changed, 53 insertions(+), 15 deletions(-) diff --git a/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js b/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js index 14b24f9e3c..e9ac8557a1 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js +++ b/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js @@ -2,25 +2,51 @@ var name = 'Selfdestruct: ' var desc = 'Be aware of caller contracts.' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var AbstractAst = require('./abstractAstView') function selfdestruct () { - this.relevantNodes = [] -} + this.abstractAst = new AbstractAst() + + this.visit = this.abstractAst.build_visit( + (node) => common.isStatement(node) || + common.isSelfdestructCall(node) + ) -selfdestruct.prototype.visit = function (node) { - if (common.isSelfdestructCall(node)) { - this.relevantNodes.push(node) - } + this.report = this.abstractAst.build_report(report) } -selfdestruct.prototype.report = function () { - return this.relevantNodes.map(function (item, i) { - return { - warning: 'Use of selfdestruct: can block calling contracts unexpectedly. Be especially careful if this contract is planned to be used by other contracts (i.e. library contracts, interactions). Selfdestruction of the callee contract can leave callers in an inoperable state.', - location: item.src, - more: 'https://paritytech.io/blog/security-alert.html' - } +selfdestruct.prototype.visit = function () { throw new Error('constantFunctions.js no visit function set upon construction') } + +selfdestruct.prototype.report = function () { throw new Error('constantFunctions.js no report function set upon construction') } + +function report (contracts, multipleContractsWithSameName) { + var warnings = [] + + contracts.forEach((contract) => { + contract.functions.forEach((func) => { + let hasSelf = false + func.relevantNodes.forEach((node) => { + if (common.isSelfdestructCall(node)) { + warnings.push({ + warning: 'Use of selfdestruct: can block calling contracts unexpectedly. Be especially careful if this contract is planned to be used by other contracts (i.e. library contracts, interactions). Selfdestruction of the callee contract can leave callers in an inoperable state.', + location: node.src, + more: 'https://paritytech.io/blog/security-alert.html' + }) + hasSelf = true + } + if (common.isStatement(node) && hasSelf) { + warnings.push({ + warning: 'Use of selfdestruct: No code after selfdestruct is executed. Selfdestruct is a terminal.', + location: node.src, + more: 'http://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html#self-destruct' + }) + hasSelf = false + } + }) + }) }) + + return warnings } module.exports = { diff --git a/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js b/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js index 51929708d0..19f7984e3b 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js +++ b/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js @@ -396,6 +396,14 @@ function isFunctionDefinition (node) { return nodeType(node, exactMatch(nodeTypes.FUNCTIONDEFINITION)) } +function isStatement (node) { + return nodeType(node, 'Statement$') || isBlock(node) +} + +function isBlock (node) { + return nodeType(node, exactMatch(nodeTypes.BLOCK)) +} + function isModifierDefinition (node) { return nodeType(node, exactMatch(nodeTypes.MODIFIERDEFINITION)) } @@ -1009,6 +1017,8 @@ module.exports = { isInlineAssembly: isInlineAssembly, isNewExpression: isNewExpression, isReturn: isReturn, + isStatement: isStatement, + isBlock: isBlock, // #################### Constants nodeTypes: nodeTypes, diff --git a/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js b/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js index 0cf349100c..b8b7cc031b 100644 --- a/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js +++ b/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js @@ -466,12 +466,12 @@ test('Integration test selfdestruct.js', function (t) { 'notReentrant.sol': 0, 'structReentrant.sol': 0, 'thisLocal.sol': 0, - 'globals.sol': 1, + 'globals.sol': 2, 'library.sol': 0, 'transfer.sol': 0, 'ctor.sol': 0, 'forgottenReturn.sol': 0, - 'selfdestruct.sol': 2, + 'selfdestruct.sol': 3, 'deleteDynamicArray.sol': 0, 'blockLevelCompare.sol': 0, 'intDivisionTruncate.sol': 1 diff --git a/remix-analyzer/test/analysis/test-contracts/selfdestruct.sol b/remix-analyzer/test/analysis/test-contracts/selfdestruct.sol index d2e31dfdb0..2f56dfc2e4 100644 --- a/remix-analyzer/test/analysis/test-contracts/selfdestruct.sol +++ b/remix-analyzer/test/analysis/test-contracts/selfdestruct.sol @@ -1,5 +1,6 @@ contract sd { + uint x = 0; function() public payable { } function c () public constant { @@ -8,5 +9,6 @@ contract sd { function b () public payable { selfdestruct(address(0xdeadbeef)); + x = 1; } } \ No newline at end of file From c19b944666aeb89c49d1000e60a898108bca4337 Mon Sep 17 00:00:00 2001 From: soad003 Date: Wed, 8 Aug 2018 11:48:29 +0200 Subject: [PATCH 2/4] StaticAnalysis: selfdestruct terminal, bugfix return, another testcase --- .../src/solidity-analyzer/modules/staticAnalysisCommon.js | 2 +- remix-analyzer/test/analysis/staticAnalysisIntegration-test.js | 2 +- .../test/analysis/test-contracts/intDivisionTruncate.sol | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js b/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js index 19f7984e3b..3f8c9953a9 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js +++ b/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.js @@ -397,7 +397,7 @@ function isFunctionDefinition (node) { } function isStatement (node) { - return nodeType(node, 'Statement$') || isBlock(node) + return nodeType(node, 'Statement$') || isBlock(node) || isReturn(node) } function isBlock (node) { diff --git a/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js b/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js index b8b7cc031b..a229770b88 100644 --- a/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js +++ b/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js @@ -474,7 +474,7 @@ test('Integration test selfdestruct.js', function (t) { 'selfdestruct.sol': 3, 'deleteDynamicArray.sol': 0, 'blockLevelCompare.sol': 0, - 'intDivisionTruncate.sol': 1 + 'intDivisionTruncate.sol': 2 } runModuleOnFiles(module, t, (file, report) => { diff --git a/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol b/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol index a7c30fbfd1..95e6dc1d0a 100644 --- a/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol +++ b/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol @@ -21,8 +21,9 @@ contract CharityCampaign { return fee; } - function endCampaign() public { + function endCampaign() public returns (bool) { require(msg.sender == processor || msg.sender == beneficiary); selfdestruct(beneficiary); + return true; } } \ No newline at end of file From d689ae61ac54af30b866a3f320b11e2c3a694003 Mon Sep 17 00:00:00 2001 From: soad003 Date: Wed, 8 Aug 2018 12:15:31 +0200 Subject: [PATCH 3/4] StaticAnalysis: another testcase --- .../test/analysis/staticAnalysisIntegration-test.js | 2 +- .../test/analysis/test-contracts/intDivisionTruncate.sol | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js b/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js index a229770b88..1ffaefecb7 100644 --- a/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js +++ b/remix-analyzer/test/analysis/staticAnalysisIntegration-test.js @@ -474,7 +474,7 @@ test('Integration test selfdestruct.js', function (t) { 'selfdestruct.sol': 3, 'deleteDynamicArray.sol': 0, 'blockLevelCompare.sol': 0, - 'intDivisionTruncate.sol': 2 + 'intDivisionTruncate.sol': 5 } runModuleOnFiles(module, t, (file, report) => { diff --git a/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol b/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol index 95e6dc1d0a..e5ed123b85 100644 --- a/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol +++ b/remix-analyzer/test/analysis/test-contracts/intDivisionTruncate.sol @@ -26,4 +26,13 @@ contract CharityCampaign { selfdestruct(beneficiary); return true; } + + // FALSE POSITIVE FOR SELFDESTRUCT TERMINAL + function endAmbiguous() public { + if(msg.sender == 0x0) { + selfdestruct(beneficiary); + } else { + selfdestruct(processor); + } + } } \ No newline at end of file From a7c83568ff4588001c56a8096136d8a81878218a Mon Sep 17 00:00:00 2001 From: soad003 Date: Thu, 9 Aug 2018 13:57:07 +0200 Subject: [PATCH 4/4] StaticAnalysis: Add Exact and heuristic classification for module --- .../src/solidity-analyzer/modules/algorithmCategories.js | 9 +++++++++ .../src/solidity-analyzer/modules/assignAndCompare.js | 2 ++ .../src/solidity-analyzer/modules/blockBlockhash.js | 2 ++ .../src/solidity-analyzer/modules/blockTimestamp.js | 2 ++ .../modules/checksEffectsInteraction.js | 2 ++ .../src/solidity-analyzer/modules/constantFunctions.js | 2 ++ .../src/solidity-analyzer/modules/deleteDynamicArrays.js | 2 ++ remix-analyzer/src/solidity-analyzer/modules/gasCosts.js | 2 ++ .../src/solidity-analyzer/modules/guardConditions.js | 2 ++ .../src/solidity-analyzer/modules/inlineAssembly.js | 2 ++ .../src/solidity-analyzer/modules/intDivisionTruncate.js | 4 +++- .../src/solidity-analyzer/modules/lowLevelCalls.js | 2 ++ remix-analyzer/src/solidity-analyzer/modules/noReturn.js | 2 ++ .../src/solidity-analyzer/modules/selfdestruct.js | 6 ++++-- .../solidity-analyzer/modules/similarVariableNames.js | 2 ++ .../src/solidity-analyzer/modules/thisLocal.js | 2 ++ remix-analyzer/src/solidity-analyzer/modules/txOrigin.js | 2 ++ 17 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 remix-analyzer/src/solidity-analyzer/modules/algorithmCategories.js diff --git a/remix-analyzer/src/solidity-analyzer/modules/algorithmCategories.js b/remix-analyzer/src/solidity-analyzer/modules/algorithmCategories.js new file mode 100644 index 0000000000..f7d5607a4f --- /dev/null +++ b/remix-analyzer/src/solidity-analyzer/modules/algorithmCategories.js @@ -0,0 +1,9 @@ +/** + * Should be used to categorize different modules, main reason is to give users feedback if the modules + * Produce exact results or have false positives and negatives in them + * A further category could be approximate if some form of approximation is used +*/ +module.exports = { + EXACT: { hasFalsePositives: false, hasFalseNegatives: false, id: 'EXACT' }, + HEURISTIC: { hasFalsePositives: true, hasFalseNegatives: true, id: 'HEURI' } +} diff --git a/remix-analyzer/src/solidity-analyzer/modules/assignAndCompare.js b/remix-analyzer/src/solidity-analyzer/modules/assignAndCompare.js index c9ec2e7820..1b827cf6a9 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/assignAndCompare.js +++ b/remix-analyzer/src/solidity-analyzer/modules/assignAndCompare.js @@ -2,6 +2,7 @@ var name = 'Result not used: ' var desc = 'The result of an operation was not used.' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function assignAndCompare () { this.warningNodes = [] @@ -24,5 +25,6 @@ module.exports = { name: name, description: desc, category: categories.MISC, + algorithm: algo.EXACT, Module: assignAndCompare } diff --git a/remix-analyzer/src/solidity-analyzer/modules/blockBlockhash.js b/remix-analyzer/src/solidity-analyzer/modules/blockBlockhash.js index 094c2d33d4..01854ba325 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/blockBlockhash.js +++ b/remix-analyzer/src/solidity-analyzer/modules/blockBlockhash.js @@ -2,6 +2,7 @@ var name = 'Block.blockhash usage: ' var desc = 'Semantics maybe unclear' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function blockBlockhash () { this.warningNodes = [] @@ -27,6 +28,7 @@ module.exports = { name: name, description: desc, category: categories.SECURITY, + algorithm: algo.EXACT, Module: blockBlockhash } diff --git a/remix-analyzer/src/solidity-analyzer/modules/blockTimestamp.js b/remix-analyzer/src/solidity-analyzer/modules/blockTimestamp.js index a91d77ff81..805505ca38 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/blockTimestamp.js +++ b/remix-analyzer/src/solidity-analyzer/modules/blockTimestamp.js @@ -2,6 +2,7 @@ var name = 'Block timestamp: ' var desc = 'Semantics maybe unclear' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function blockTimestamp () { this.warningNowNodes = [] @@ -35,6 +36,7 @@ module.exports = { name: name, description: desc, category: categories.SECURITY, + algorithm: algo.EXACT, Module: blockTimestamp } diff --git a/remix-analyzer/src/solidity-analyzer/modules/checksEffectsInteraction.js b/remix-analyzer/src/solidity-analyzer/modules/checksEffectsInteraction.js index 54a1dd051b..190a6e907b 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/checksEffectsInteraction.js +++ b/remix-analyzer/src/solidity-analyzer/modules/checksEffectsInteraction.js @@ -4,6 +4,7 @@ var categories = require('./categories') var common = require('./staticAnalysisCommon') var fcallGraph = require('./functionCallGraph') var AbstractAst = require('./abstractAstView') +var algo = require('./algorithmCategories') function checksEffectsInteraction () { this.abstractAst = new AbstractAst() @@ -84,5 +85,6 @@ module.exports = { name: name, description: desc, category: categories.SECURITY, + algorithm: algo.HEURISTIC, Module: checksEffectsInteraction } diff --git a/remix-analyzer/src/solidity-analyzer/modules/constantFunctions.js b/remix-analyzer/src/solidity-analyzer/modules/constantFunctions.js index 5da3562eb6..ec59246fbc 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/constantFunctions.js +++ b/remix-analyzer/src/solidity-analyzer/modules/constantFunctions.js @@ -4,6 +4,7 @@ var categories = require('./categories') var common = require('./staticAnalysisCommon') var fcallGraph = require('./functionCallGraph') var AbstractAst = require('./abstractAstView') +var algo = require('./algorithmCategories') function constantFunctions () { this.abstractAst = new AbstractAst() @@ -104,5 +105,6 @@ module.exports = { name: name, description: desc, category: categories.MISC, + algorithm: algo.HEURISTIC, Module: constantFunctions } diff --git a/remix-analyzer/src/solidity-analyzer/modules/deleteDynamicArrays.js b/remix-analyzer/src/solidity-analyzer/modules/deleteDynamicArrays.js index b1143d179e..c41dc95d8f 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/deleteDynamicArrays.js +++ b/remix-analyzer/src/solidity-analyzer/modules/deleteDynamicArrays.js @@ -2,6 +2,7 @@ var name = 'Delete on dynamic Array: ' var desc = 'Use require and appropriately' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function deleteDynamicArrays () { this.rel = [] @@ -25,5 +26,6 @@ module.exports = { name: name, description: desc, category: categories.GAS, + algorithm: algo.EXACT, Module: deleteDynamicArrays } diff --git a/remix-analyzer/src/solidity-analyzer/modules/gasCosts.js b/remix-analyzer/src/solidity-analyzer/modules/gasCosts.js index d9d09cfa4c..2d2c1a7a40 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/gasCosts.js +++ b/remix-analyzer/src/solidity-analyzer/modules/gasCosts.js @@ -1,6 +1,7 @@ var name = 'Gas costs: ' var desc = 'Warn if the gas requirements of functions are too high.' var categories = require('./categories') +var algo = require('./algorithmCategories') function gasCosts () { } @@ -61,5 +62,6 @@ module.exports = { name: name, description: desc, category: categories.GAS, + algorithm: algo.EXACT, Module: gasCosts } diff --git a/remix-analyzer/src/solidity-analyzer/modules/guardConditions.js b/remix-analyzer/src/solidity-analyzer/modules/guardConditions.js index a9d877c57c..8459737213 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/guardConditions.js +++ b/remix-analyzer/src/solidity-analyzer/modules/guardConditions.js @@ -2,6 +2,7 @@ var name = 'Guard Conditions: ' var desc = 'Use require and appropriately' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function guardConditions () { this.guards = [] @@ -25,5 +26,6 @@ module.exports = { name: name, description: desc, category: categories.MISC, + algorithm: algo.EXACT, Module: guardConditions } diff --git a/remix-analyzer/src/solidity-analyzer/modules/inlineAssembly.js b/remix-analyzer/src/solidity-analyzer/modules/inlineAssembly.js index ab9b6e1d03..c2a597f44d 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/inlineAssembly.js +++ b/remix-analyzer/src/solidity-analyzer/modules/inlineAssembly.js @@ -2,6 +2,7 @@ var name = 'Inline assembly: ' var desc = 'Use of Inline Assembly' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function inlineAssembly () { this.inlineAssNodes = [] @@ -26,5 +27,6 @@ module.exports = { name: name, description: desc, category: categories.SECURITY, + algorithm: algo.EXACT, Module: inlineAssembly } diff --git a/remix-analyzer/src/solidity-analyzer/modules/intDivisionTruncate.js b/remix-analyzer/src/solidity-analyzer/modules/intDivisionTruncate.js index 51a3199a99..f18bbafeb3 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/intDivisionTruncate.js +++ b/remix-analyzer/src/solidity-analyzer/modules/intDivisionTruncate.js @@ -2,6 +2,7 @@ var name = 'Data Trucated: ' var desc = 'Division on int/uint values truncates the result.' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function intDivitionTruncate () { this.warningNodes = [] @@ -14,7 +15,7 @@ intDivitionTruncate.prototype.visit = function (node) { intDivitionTruncate.prototype.report = function (compilationResults) { return this.warningNodes.map(function (item, i) { return { - warning: 'Division of integer values yields an integer value again. That means eg. a / 100 = 0 instead of 0.a since the result is an integer again. This does not hold for division of (only) literal values since those yield rational constants.', + warning: 'Division of integer values yields an integer value again. That means e.g. 10 / 100 = 0 instead of 0.1 since the result is an integer again. This does not hold for division of (only) literal values since those yield rational constants.', location: item.src } }) @@ -24,5 +25,6 @@ module.exports = { name: name, description: desc, category: categories.MISC, + algorithm: algo.EXACT, Module: intDivitionTruncate } diff --git a/remix-analyzer/src/solidity-analyzer/modules/lowLevelCalls.js b/remix-analyzer/src/solidity-analyzer/modules/lowLevelCalls.js index 6e8dd0a352..3c70ad2859 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/lowLevelCalls.js +++ b/remix-analyzer/src/solidity-analyzer/modules/lowLevelCalls.js @@ -2,6 +2,7 @@ var name = 'Low level calls: ' var desc = 'Semantics maybe unclear' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function lowLevelCalls () { this.llcNodes = [] @@ -59,6 +60,7 @@ module.exports = { name: name, description: desc, category: categories.SECURITY, + algorithm: algo.EXACT, Module: lowLevelCalls } diff --git a/remix-analyzer/src/solidity-analyzer/modules/noReturn.js b/remix-analyzer/src/solidity-analyzer/modules/noReturn.js index dbd212ead5..54187d0d64 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/noReturn.js +++ b/remix-analyzer/src/solidity-analyzer/modules/noReturn.js @@ -3,6 +3,7 @@ var desc = 'Function with return type is not returning' var categories = require('./categories') var common = require('./staticAnalysisCommon') var AbstractAst = require('./abstractAstView') +var algo = require('./algorithmCategories') function noReturn () { this.abstractAst = new AbstractAst() @@ -69,5 +70,6 @@ module.exports = { name: name, description: desc, category: categories.MISC, + algorithm: algo.EXACT, Module: noReturn } diff --git a/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js b/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js index e9ac8557a1..644a228b84 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js +++ b/remix-analyzer/src/solidity-analyzer/modules/selfdestruct.js @@ -3,6 +3,7 @@ var desc = 'Be aware of caller contracts.' var categories = require('./categories') var common = require('./staticAnalysisCommon') var AbstractAst = require('./abstractAstView') +var algo = require('./algorithmCategories') function selfdestruct () { this.abstractAst = new AbstractAst() @@ -15,9 +16,9 @@ function selfdestruct () { this.report = this.abstractAst.build_report(report) } -selfdestruct.prototype.visit = function () { throw new Error('constantFunctions.js no visit function set upon construction') } +selfdestruct.prototype.visit = function () { throw new Error('selfdestruct.js no visit function set upon construction') } -selfdestruct.prototype.report = function () { throw new Error('constantFunctions.js no report function set upon construction') } +selfdestruct.prototype.report = function () { throw new Error('selfdestruct.js no report function set upon construction') } function report (contracts, multipleContractsWithSameName) { var warnings = [] @@ -53,5 +54,6 @@ module.exports = { name: name, description: desc, category: categories.SECURITY, + algorithm: algo.HEURISTIC, Module: selfdestruct } diff --git a/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.js b/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.js index 903fbab20d..7734c091fe 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.js +++ b/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.js @@ -6,6 +6,7 @@ var AbstractAst = require('./abstractAstView') var levenshtein = require('fast-levenshtein') var remixLib = require('remix-lib') var util = remixLib.util +var algo = require('./algorithmCategories') function similarVariableNames () { this.abstractAst = new AbstractAst() @@ -82,5 +83,6 @@ module.exports = { name: name, description: desc, category: categories.MISC, + algorithm: algo.EXACT, Module: similarVariableNames } diff --git a/remix-analyzer/src/solidity-analyzer/modules/thisLocal.js b/remix-analyzer/src/solidity-analyzer/modules/thisLocal.js index 2ca7a5975c..cdf2aa468f 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/thisLocal.js +++ b/remix-analyzer/src/solidity-analyzer/modules/thisLocal.js @@ -2,6 +2,7 @@ var name = 'This on local calls: ' var desc = 'Invocation of local functions via this' var categories = require('./categories') var common = require('./staticAnalysisCommon') +var algo = require('./algorithmCategories') function thisLocal () { this.warningNodes = [] @@ -25,5 +26,6 @@ module.exports = { name: name, description: desc, category: categories.GAS, + algorithm: algo.EXACT, Module: thisLocal } diff --git a/remix-analyzer/src/solidity-analyzer/modules/txOrigin.js b/remix-analyzer/src/solidity-analyzer/modules/txOrigin.js index 46834e4f8e..512fe579f7 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/txOrigin.js +++ b/remix-analyzer/src/solidity-analyzer/modules/txOrigin.js @@ -1,6 +1,7 @@ var name = 'Transaction origin: ' var desc = 'Warn if tx.origin is used' var categories = require('./categories') +var algo = require('./algorithmCategories') function txOrigin () { this.txOriginNodes = [] @@ -31,5 +32,6 @@ module.exports = { name: name, description: desc, category: categories.SECURITY, + algorithm: algo.EXACT, Module: txOrigin }