A modular Python CLI tool for auditing GitHub security posture at organization and repository level.
gitsec helps you secure your GitHub environment at scale. It checks all key security configurations at both organization and repository level, scans for hardcoded secrets and vulnerable, deprecated, or unpinned dependencies, and gives you one comprehensive report with everything you need to fix.
gitsec provides comprehensive security auditing for GitHub repositories and organizations through three main modules:
Detect hardcoded secrets and credentials in your codebase using the detect-secrets library with custom plugins.
- API keys (AWS, Google Cloud, Azure, OpenAI, Anthropic, etc.)
- Database connection strings
- Private keys and certificates
- OAuth tokens and webhook secrets
Identify vulnerabilities in your project dependencies using the deps.dev API.
- Known CVEs and security advisories
- CVSS severity scoring
- Deprecated packages detection
- Unpinned dependencies identification
- Support for multiple ecosystems (npm, pip, Maven, Go, etc.)
Audit GitHub security configurations at organization and repository level.
Organization-level checks:
- MFA requirement status
- SSO/SAML configuration
- Commit signing enforcement
- Pull request requirements
- Push protection
- Tag deletion protection
- Secrets and runners scope
- User access analysis
Repository-level checks:
- Commit signing requirements
- Pull request requirements
- Push protection
- Tag deletion protection
- Runners scope
pip install gitsecpipx install gitsec- Clone the repository:
git clone https://github.com/yourusername/gitsec.git
cd gitsec- Install dependencies:
poetry installSet your GitHub token:
export GITHUB_TOKEN=your_github_personal_access_tokenRun a comprehensive audit on an organization:
gitsec audit-all --org your-org --out-folder resultsRun a comprehensive audit on a single repository:
gitsec audit-all --repo owner/repo --out-folder resultsThe audit-all command runs all three security modules and generates a single Excel report.
# Organization
gitsec audit-all --org myorg
# Single repository
gitsec audit-all --repo owner/repo
# Local repository
gitsec audit-all --local-repo /path/to/repo
# GitHub Enterprise Server
gitsec audit-all --org myorg --base-url https://github.mycorp.comOutput: Single Excel file (audit_all_<target>.xlsx) with all findings and a combined summary sheet.
Note: Security checks are not available for local repositories.
# Single repository
gitsec scan-secrets --repo owner/repo
# Organization
gitsec scan-secrets --org myorg
# Local repository
gitsec scan-secrets --local-repo /path/to/repo
# Choose output format (csv, xls, or csv,xls)
gitsec scan-secrets --repo owner/repo --format csv,xls --out-folder reports# Single repository
gitsec scan-dependencies --repo owner/repo
# Organization
gitsec scan-dependencies --org myorg
# Local repository
gitsec scan-dependencies --local-repo /path/to/repo
# Choose output format (csv, xls, or csv,xls)
gitsec scan-dependencies --repo owner/repo --format xlsRun all checks or specific modules:
# All organization-level checks
gitsec security-checks all-org --org myorg
# All repository-level checks
gitsec security-checks all-repo --repo owner/repo
# Specific checks (can combine multiple)
gitsec security-checks org-mfa org-sso --org myorg
gitsec security-checks repo-commit-signing repo-pr-required --repo owner/repoorg-mfa- Check if MFA is required for all organization membersorg-sso- Check if SSO/SAML is configuredorg-commit-signing- Check commit signing enforcement across all repositoriesorg-pr-required- Check PR requirements across all repositoriesorg-push-protection- Check push protection across all repositoriesorg-tag-deletion-protection- Check tag deletion protection across all repositoriesorg-secrets-scope- Audit organization secrets visibility and scopeorg-runners-scope- Audit self-hosted runners scope and visibilityorg-user-access- Analyze user access patterns and permissions
repo-commit-signing- Check if commit signing is requiredrepo-pr-required- Check if PRs are required on default branchrepo-push-protection- Check if direct pushes to default branch are blockedrepo-tag-deletion-protection- Check if tag deletion is protectedrepo-runners-scope- Audit self-hosted runners scope
All commands generate reports in the specified output directory:
- CSV format: Individual CSV files for each finding type
- Excel format: Comprehensive Excel workbook with multiple sheets and summary
- Combined format: Both CSV and Excel (use
--format csv,xls)
The audit-all command generates a single Excel file containing all findings with a summary sheet.
Here's some examples of what the output looks like:
All commands support GitHub Enterprise Server via the --base-url flag:
gitsec audit-all --org myorg --base-url https://github.mycorp.comThe GitHub personal access token requires the following scopes:
repo- Full control of private repositoriesread:org- Read organization dataadmin:org- Read organization security settings
For GitHub Enterprise Server, ensure the token has equivalent permissions.
MIT
Contributions are welcome! Please feel free to submit a Pull Request.



