Skip to main content

A toolkit for scanning configs, secrets, and permissions.

Project description

Safeguard Toolkit

Safeguard Toolkit is a Python package for scanning and analyzing project configurations, dependencies, permissions, and secrets to detect security risks, version conflicts, and sensitive data exposure. It supports multiple file types and generates detailed reports to help maintain secure and compliant codebases.

Features

  • Secrets Scanner: Detects hardcoded secrets, API keys, tokens, and high-entropy strings in source code and config files.
  • Config Scanner: Scans .env, .yaml, .yml, and .json files for risky configurations and potential secrets.
  • Dependency Checker: Parses requirements.txt, Pipfile, and pyproject.toml to check for outdated, vulnerable, or license-incompatible dependencies.
  • Permissions Checker: Identifies files and directories with unsafe permissions (e.g., world-writable, group-writable, or unreadable by owner).
  • Eval/Exec Scanner: Finds dangerous usage of eval(), exec(), and similar functions in Python code.

Installation

Install the latest release from PyPI:

pip install safeguard_toolkit

Or, for development:

git clone https://github.com/purvi1508/Safeguard.git
cd Safeguard
pip install -e .

Usage

Each scanner can be run independently. Example usage for each module is provided in the src/safeguard_toolkit/examples/ directory.

Secrets Scanner

from safeguard_toolkit.core.secrets_scanner import SecretScanner

scanner = SecretScanner(base_path="path/to/scan")
scanner.scan_path("path/to/scan")
# Access scanner.results or implement your own reporting

Config Scanner

from safeguard_toolkit.core.config_scanner import ConfigScanner

scanner = ConfigScanner(path="path/to/configs")
scanner.scan()
issues = scanner.get_issues()
for issue in issues:
    print(issue)

Dependency Checker

from safeguard_toolkit.core.dependency_checker import DependencyChecker

checker = DependencyChecker(path="path/to/project")
checker.run_all_checks()
report = checker.generate_report()
print(report)

Permissions Checker

from safeguard_toolkit.core.permissions_checker import PermissionChecker

checker = PermissionChecker(base_path="path/to/scan")
checker.scan_path("path/to/scan")
unsafe_paths = checker.get_unsafe_paths()
for path, issue in unsafe_paths:
    print(f"{issue}: {path}")

Eval/Exec Scanner

from safeguard_toolkit.core.eval_exec_scanner import EvalExecScanner

scanner = EvalExecScanner()
issues = scanner.scan("path/to/python/files")
for issue in issues:
    print(issue)

Examples

See the src/safeguard_toolkit/examples/ directory for ready-to-run scripts and sample files for each scanner.

Requirements

To clean cache and build artifacts:

make clean

Contributing

Contributions are welcome! Please open issues or pull requests on GitHub.

License

MIT License


© 2024 Purvi Verma

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

safeguard_toolkit-0.1.5.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

safeguard_toolkit-0.1.5-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file safeguard_toolkit-0.1.5.tar.gz.

File metadata

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

File hashes

Hashes for safeguard_toolkit-0.1.5.tar.gz
Algorithm Hash digest
SHA256 493e0f8e33ad829ff761b82fa81d709f62fb4539ed32970e07cb2314d6738ce9
MD5 b6c9e331e3a753736955666f4d95e1bc
BLAKE2b-256 8ce6afb4d506a343428c9667d559d3409f4e300b4d2cb2c05e1814d12dbf4bbf

See more details on using hashes here.

File details

Details for the file safeguard_toolkit-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for safeguard_toolkit-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5729104b148fa6c218a14c9e69f1d6e45e8f0a81db4ae3493851ce7fe168e641
MD5 cdf928d149140491fe70d3a1b053ef3e
BLAKE2b-256 9072fd5e9c2eea4af79627957e15ff5279e1ad520dce0ce1a8de37294cf3e64b

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