Skip to content

πŸ” Ready-to-use GitHub Actions workflow for automated Python dependency security auditing with pip-audit. Weekly scans, smart issue management, and comprehensive reporting.

License

Notifications You must be signed in to change notification settings

trivedi-vatsal/pysec-recipes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 Python Security Audit Recipe πŸ”

License: MIT GitHub Actions pip-audit Recipe Documentation

Automated, Zero-Config Security for Your Python Projects πŸš€

This production-ready GitHub Actions recipe is your secret weapon for a security-first codebase. It automatically scans your project's dependencies for vulnerabilities, creates intelligent GitHub issues, and keeps your team in the loopβ€”all with a one-command setup.

πŸš€ Why This Recipe?

Security shouldn't be an afterthought. Manual security audits are slow, error-prone, and often forgotten. This recipe solves that by making automated security as simple as copying a file.

What You Get Out of the Box

  • πŸ›‘οΈ Instant Security: Set up in less than a minute. Just copy, paste, and commit.
  • 🧠 Intelligent Automation: Automatically creates, updates, and closes security issues.
  • 🚨 Real-Time Alerts: Get notified the moment a vulnerability is found.
  • πŸ‘₯ Team Collaboration: Shared visibility and a clear action plan for every security risk.

πŸ“– Quick Start: Secure Your Project in 30 Seconds

Getting started is as easy as running a single command in your project's root directory.

# One command to add security automation to your project
curl -sSL https://raw.githubusercontent.com/trivedi-vatsal/pysec-recipes/main/setup.py | python3

This command automatically creates a new workflow file at .github/workflows/security-audit.yml and essential issue templates, instantly securing your project.

πŸ“– Full Installation Guide - Detailed steps and troubleshooting.

🎯 Features at a Glance

πŸš€ Instant & Effortless

  • Zero Configuration: Works right out of the box with sensible defaults.
  • Zero Maintenance: Runs automatically on a schedule, with no manual upkeep required.
  • Comprehensive: Scans requirements.txt and a full dependency tree.

🧠 Smart & Actionable

  • Smart Issue Management: When a vulnerability is found, the recipe creates a detailed GitHub issue with fix instructions. It also closes issues when a vulnerability is resolved.
  • Rich Reporting: Every scan generates detailed JSON, Markdown, and text reports for easy review.
  • Scheduled & On-Demand: Scans run automatically every week and can be triggered manually.
  • Artifact Storage: Stores audit reports for 90 days for full audit trail and compliance.

πŸ›‘οΈ Enterprise-Grade

  • Multiple Databases: Leverages PyPI Advisory, OSV, and Python Packaging Advisory for robust coverage.
  • Fix Guidance: Each issue includes direct pip-audit fix commands.
  • CI/CD Integration: Can be configured to fail builds on critical vulnerabilities, ensuring no risky code gets deployed.

πŸ“‹ What the Recipe Adds

Running the quick start command creates the following structure in your repository:

your-repo/
β”œβ”€β”€ .github/
β”‚ Β  β”œβ”€β”€ workflows/
β”‚ Β  β”‚ Β  └── security-audit.yml Β  Β  Β  Β  Β  # The main security workflow
β”‚ Β  └── ISSUE_TEMPLATE/
β”‚ Β  Β  Β  β”œβ”€β”€ security-vulnerability-report.md # Template for vulnerability issues
β”‚ Β  Β  Β  └── clean-security-audit-report.md Β  # Template for clean reports
β”œβ”€β”€ requirements.txt Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  # Your project's dependencies
└── [your project files]

How the Workflow Works

The security-audit.yml workflow is designed to run automatically on a weekly schedule, on every push to the main branch, or when triggered manually. It does the following:

  1. Sets up a Python environment and pip-audit.
  2. Scans your requirements.txt file for known vulnerabilities.
  3. Generates easy-to-read reports.
  4. Creates, updates, or closes a GitHub issue based on the scan results.
  5. Uploads the detailed reports as artifacts for long-term storage.

πŸ“Š Examples & Use Cases

This recipe is versatile and can be customized for many project types.

Example Description Use Case
πŸ”§ Basic Example A single-file security audit. Small projects, quick setup.
🌍 Multi-Environment Scans separate dev, test, and prod requirements files. Complex projects with different dependencies.
🐍 Django Project Specifically tailored for Django applications. Securing web applications.
πŸ“¦ Monorepo Audits multiple projects within a single repository. Enterprise setups.

πŸ“– View All Examples - Explore configurations for different project types.

πŸ’‘ Troubleshooting & Support

Have questions or need help? The documentation is here for you.

This recipe is a open effort. Your contributions are welcome! If you have ideas for new features, better reporting, or bug fixes

Made with ❀️ for the Python Security

Star this repository to show your support and help others discover it. Let's make Python security simple and accessible for everyone

GitHub stars GitHub forks GitHub watchers

About

πŸ” Ready-to-use GitHub Actions workflow for automated Python dependency security auditing with pip-audit. Weekly scans, smart issue management, and comprehensive reporting.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages