Skip to main content

Security-focused command line tool to scan Git repositories for potentially malicious code patterns

Project description

Insect Security Scanner

Insect is a security-focused command line tool designed to scan Git repositories for potentially malicious code patterns before execution. It uses a combination of static analysis, configuration checks, and metadata examination to identify security risks in code.

Insect Logo

Features

  • Multi-language support: Python, JavaScript, and Shell scripts
  • Deep static analysis: Detects suspicious patterns and security vulnerabilities
  • External tool integration: Works with Bandit, Semgrep, and ShellCheck
  • Detailed reporting: Text, JSON, and interactive HTML outputs
  • Performance optimization: Caching for faster re-scanning
  • Flexible configuration: Customize analysis based on project needs
  • Containerized scanning: Safe scanning of untrusted repositories in Docker containers

Installation

pip install insect

Or using pipenv:

pipenv install insect

Quick Start

Scan a Git repository and display findings:

insect scan /path/to/repository

Check status of external dependencies:

insect deps

Generate a detailed HTML report:

insect scan /path/to/repository -f html -o report.html

Safely scan a repository in a container before cloning:

insect clone https://github.com/example/repository

Development

Setup

# Clone the repository
git clone https://github.com/yourusername/insect.git
cd insect

# Setup development environment
pipenv install --dev
pipenv shell

# Install pre-commit hooks
pre-commit install

Testing

# Run tests
pytest

# Run tests with coverage
pytest --cov=insect

# Run tox to test across different Python versions
tox

Code Quality

# Format code
black .
isort .

# Lint code
ruff .

# Type checking
mypy .

Documentation

For comprehensive documentation, see our documentation index or explore:

Security Issues Insect Can Detect

Insect can detect a wide range of security issues, including:

  • Command Injection: Unsafe command execution in Python, JavaScript, and Shell scripts
  • Cross-Site Scripting (XSS): DOM manipulation vulnerabilities in JavaScript
  • SQL Injection: Unsafe SQL query construction
  • Hardcoded Secrets: API keys, tokens, and credentials in code
  • Insecure Deserialization: Unsafe deserialization of untrusted data
  • Path Traversal: Directory traversal vulnerabilities
  • Obfuscated Code: Base64 encoded payloads and suspicious patterns
  • Configuration Issues: Insecure default settings and misconfigurations

For examples of each type, see the Security Examples documentation.

Development

Insect uses tox for managing development environments and running tests. The project uses pipenv for dependency management.

Setup

  1. Clone the repository:

    git clone https://github.com/somasays/insect.git
    cd insect
    
  2. Install pipenv and dependencies:

    pip install pipenv
    pipenv install --dev
    

Available Tox Environments

  • tox -e all - Run all checks and tests (used in CI/CD)
  • tox -e lint - Run only linting checks (ruff, black, isort)
  • tox -e typecheck - Run only type checking (mypy)
  • tox -e test - Run only tests with coverage
  • tox -e dev - Quick development checks (lint + tests with fast failure)
  • tox -e format - Auto-format code (black, isort)

Development Workflow

  1. Quick feedback during development:

    pipenv run tox -e dev
    
  2. Format code:

    pipenv run tox -e format
    
  3. Run full test suite before committing:

    pipenv run tox -e all
    
  4. Run specific tests:

    pipenv run tox -e test -- tests/unit/test_specific.py
    

Manual Commands (if needed)

If you prefer to run individual commands:

# Install dependencies
pipenv install --dev

# Run tests
pipenv run pytest tests/ --cov=insect

# Run linting
pipenv run ruff check src tests
pipenv run black --check src tests
pipenv run isort --check-only src tests

# Type checking
pipenv run mypy src tests

# Format code
pipenv run black src tests
pipenv run isort src tests

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

insect-0.1.2.tar.gz (109.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

insect-0.1.2-py3-none-any.whl (122.4 kB view details)

Uploaded Python 3

File details

Details for the file insect-0.1.2.tar.gz.

File metadata

  • Download URL: insect-0.1.2.tar.gz
  • Upload date:
  • Size: 109.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for insect-0.1.2.tar.gz
Algorithm Hash digest
SHA256 be9593e0cecf98ab3277b35f330a0342b8fd21bb0ba57c55550db5c469f37b15
MD5 b4d0f6b2db9bc045e37c70e4bcbe6da7
BLAKE2b-256 a5c625143e4e13415c4ab2306f5c567b6bd617c84dbc1372060806bd1a44ac18

See more details on using hashes here.

File details

Details for the file insect-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: insect-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 122.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for insect-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a1f840ff8c89513964ebe6997498792ab201af08306b3a9aff1b71061375f8
MD5 2b9b170b12d067a670921f17bc2a5ea6
BLAKE2b-256 c31fdca510c12d4f33c8575568e8eef0a2e018b4d79d953436096175e0efb168

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page