Git Product home page Git Product logo

secomlint's Introduction

SECOMlint Build Status

Linter to measure compliance against SECOM convention. SECOM is a convention for making security commit messages more readable and structured. Check the CONFIG.md file to know how to configure the template in your repository.

Installation

pip install secomlint
python -m spacy download en_core_web_lg

From the source code:

git clone https://github.com/TQRG/secomlint.git
cd secomlint
pip install .
python -m spacy download en_core_web_lg

Usage

secomlint --help
Usage: secomlint [OPTIONS]

  Linter to check compliance against SECOM (https://tqrg.github.io/secom/).

Options:
  --no-compliance        Show missing compliance.
  --is-body-informative  Checks body for security information.
  --score                Show compliance score.
  --config TEXT          Rule configuration file path name.
  --help                 Show this message and exit.

Run tool

git log -1 --pretty=%B | secomlint where git log -1 --pretty=%B gets the commit message of the local commit.

  • Check only the rules that are not in compliance: git log -1 --pretty=%B | secomlint --no-compliance
  • Calculate compliance score: git log -1 --pretty=%B | secomlint --no-compliance --score

Configuration

The linter has a default configuration that can be overridden with a .yml file using the following syntax:

rule_name:
    active: {true | false}
    type: {0 - warning | 1 - error}
    value: {string | regex}

An example would be:

header_starts_with_type:
  active: true
  type: 0
  value: 'fix'
metadata_has_detection:
  active: false

(The rule header_starts_with_type is active, outputs warnings and checks if header starts with type fix. The rule metadata_has_detection was deactivated.)

git log -1 --pretty=%B | secomlint --config=config.yml

Check if the message's body is informative enough

It is important that the body of security commit messages are somehow informative; SECOMlint checks the message's body for security-related keywords.

git log -1 --pretty=%B | secomlint --is-body-informative
๐Ÿ‘ Good to go! Extractor found the following security related words in the message's body:
   - protocols

secomlint's People

Contributors

sofiaoreis avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

claudiarmamede

secomlint's Issues

Issue reading from CSV files

I'm trying to run secomlint on a CSV file with commit messages.

The CSV file (sample.csv) is in the following format:

message
"Fix bug CVE-123-4567"
"Fix bug CVE-123-7654"

From the command line I execute the following:

secomlint --from-file sample.csv

I receive the following error:

Traceback (most recent call last):
  File ".venv/bin/secomlint", line 8, in <module>
    sys.exit(main())
  File ".venv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File ".venv/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File ".venv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File ".venv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File ".venv/lib/python3.8/site-packages/secomlint/__main__.py", line 92, in main
    entities += section.entities
TypeError: 'NoneType' object is not iterable

Any insight to resolve this issue would be highly appreciated :) Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.