Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

solium-plugin-security

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solium-plugin-security

Official Solium Plugin for Security-related lint rules

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
901
decreased by-58.09%
Maintainers
1
Weekly downloads
 
Created
Source

The official Security Plugin for Solium

This Plugin provides security-focused lint rules for Solium.

The rules have been taken from Consensys' Recommended Smart Contract Practices and Solium's Rule Wishlist.

Installation

NOTE: If you're using Solium v1.0.1 or above, this plugin comes pre-installed as a local dependency and you can skip this section.

npm install -g solium-plugin-security

Usage

NOTE: If you've installed Solium v1.0.1 or above and created soliumrc.json using solium --init, you can skip this step since solium automatically applies the security plugin for you.

Add security to your soliumrc.json's plugins array. Your configuration file should look like:

{
    "extends": "solium:all",
    "plugins": ["security"],
    "rules": {
        ...
    }
}

Developer Setup

  • git clone <URL-of-this-repo>
  • cd solium-plugin-security
  • npm install --dev
  • npm test

List of rules

Below are the rules supplied by this plugin and the information on passing options to them and their auto-fixing capabilities.

NameDescriptionOptionsDefaultsFixes
no-throwDiscourage use of 'throw' statement for error flagging.YES
no-sha3Encourage use of 'keccak256()' over 'sha3()' function.YES
no-tx-originDiscourage use of 'tx.origin' global variable.
no-low-level-callsDiscourage the use of low-level functions - call(), callcode() & delegatecall().List of functions to warn against["call", "callcode", "delegatecall"]
no-inline-assemblyDiscourage use of inline assembly.
no-call-valueDiscourage use of .call.value()()
no-block-membersDiscourage use of members 'blockhash' & 'timestamp' (and alias 'now') of 'block' global variableList of members to warn against["blockhash", "timestamp"]
enforce-explicit-visibilityEncourage user to explicitly specify visibility of functionYES

An example soliumrc.json configuring and applying this plugin is:

{
    "plugins": ["security"],
    "rules": {
        "some-other-solium-rule": 1,
        "security/no-low-level-calls": ["error", ["call", "delegatecall"]],
        "security/no-block-members": [1, ["timestamp"]],
        "security/no-throw": "off"
    }
}

This tells solium to apply the 3 security/ rules with special configuration provided and apply the remaining rules of the plugin with their default configurations. If you want to disable a plugin rule, you have to explicitly disable it inside rules.

Lint normally using solium -d contracts/ or solium -d contracts/ --fix to apply fixes as well.

Roadmap

  • Add automated tests
  • Refine rule enforce-explicit-visibility
  • Add more security rules

Security rules to be implemented

  • no-multiple-send-calls
  • check-send-result

...And many more from the sources listed above

Keywords

FAQs

Package last updated on 06 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc