cleanunicorn / mythos

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

[BUG] on Windows: Mythos doesn't respect relative paths in import statements #40

Closed ghost closed 5 years ago

ghost commented 5 years ago

Describe the bug With the MetaCoin project, I run the following in the root of the project:

$ mythos analyze contracts\MetaCoin.sol MetaCoin

The error returned is:

Reading contract contracts\MetaCoin.sol... done
Compiling with Solidity version: v0.5.6+commit.b259423e
 »   Error: contracts\MetaCoin.sol:3:1: ParserError: Source "ConvertLib.sol" not found: ENOENT: no such file or directory, stat 'ConvertLib.sol'
 »   import "./ConvertLib.sol";
 »   ^------------------------^
 »
Compiling contract contracts\MetaCoin.sol... failed

But when I move into the contracts directory and run:

$ mythos analyze MetaCoin.sol MetaCoin

The run succeeds:

Reading contract MetaCoin.sol... done
Compiling with Solidity version: v0.5.6+commit.b259423e
Compiling contract MetaCoin.sol... done
Analyzing contract MetaCoin... done

UUID: 6218bf94-3ecf-459b-93ef-ec66bae11c17
API Version: v1.4.14
Harvey Version: 0.0.18
Maestro Version: 1.2.10
Maru Version: 0.4.4
Mythril Version: 0.20.4

Report found 1 issues
Meta:
Covered instructions: 410
Covered paths: 10
Selected compiler version: vUnknown

Title: (SWC-111) Use of Deprecated Solidity Functions
Severity: Medium
Head: Use of tx.origin is deprecated.
Description: The smart contract retrieves the transaction origin (tx.origin) using msg.origin. Use of msg.origin is deprecated and the instruction may be removed in the  future. Use msg.sender instead.
See also: https://solidity.readthedocs.io/en/develop/security-considerations.html#tx-origin
Source code:

MetaCoin.sol 16:10
--------------------------------------------------
[tx.origi
--------------------------------------------------

==================================================

Done

Presumably the tool is not seeing that the ./ConvertLib.sol is relative to the MetaCoin.col, not the directory that Mythos is running in. That should be fixed.

cleanunicorn commented 5 years ago

Thanks for the heads-up!

Marked as duplicate, continued in https://github.com/cleanunicorn/mythos/issues/38