Skip to main content

CLI tool to fetch, display, and manage GitHub security alerts

Project description

ghsec — GitHub Security Alerts CLI

CI Publish to PyPI PyPI version

A command-line tool that wraps the gh CLI to fetch, display, and manage GitHub security alerts (CodeQL/code scanning, Dependabot, secret scanning).

Prerequisites

  • Python >= 3.10
  • gh CLI installed and authenticated (gh auth login)
  • uv for package management (recommended)

Installation

uv pip install .

Or for development:

uv sync

Usage

Run ghsec from inside a cloned GitHub repo (it auto-detects the repo from git remote), or specify --repo OWNER/REPO.

ghsec <subcommand> [options]

Global options:
  --repo OWNER/REPO    Override repo (default: auto-detect from git remote)
  --json               Output raw JSON instead of formatted tables

List alerts

# All security alert types
ghsec list

# Specific types
ghsec list-code          # Code scanning (CodeQL) only
ghsec list-deps          # Dependabot only
ghsec list-secrets       # Secret scanning only

# Filter by state or severity
ghsec list-code --state open --severity high

Show alert details

ghsec show code 1        # Code scanning alert #1
ghsec show dep 5         # Dependabot alert #5
ghsec show secret 3      # Secret scanning alert #3

Dismiss an alert

# Code scanning reasons: false_positive, wont_fix, used_in_tests
ghsec dismiss code 1 --reason wont_fix

# Dependabot reasons: fix_started, inaccurate, no_bandwidth, not_used, tolerable_risk
ghsec dismiss dep 5 --reason tolerable_risk --comment "low priority"

# Secret scanning reasons: false_positive, wont_fix, revoked, used_in_tests
ghsec dismiss secret 3 --reason revoked

Reopen a dismissed alert

ghsec reopen dep 5

JSON output

ghsec --json list-deps
ghsec --json show code 1

Running tests

bash test/run_tests.sh

Project structure

├── pyproject.toml          # Package metadata, dependencies, entry point
├── src/
│   └── ghsec/
│       ├── __init__.py     # Version string
│       ├── cli.py          # argparse setup, main entry point
│       ├── api.py          # gh api wrapper functions
│       └── display.py      # Rich table/detail formatting
└── test/
    ├── run_tests.sh        # Test runner script
    ├── fixtures.py         # Canned API responses
    ├── test_api.py         # API module tests
    ├── test_display.py     # Display formatting tests
    └── test_cli.py         # CLI argument & command handler 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

ghsec-0.1.2.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

ghsec-0.1.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ghsec-0.1.2.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghsec-0.1.2.tar.gz
Algorithm Hash digest
SHA256 19eedac1e5589a38680a516165bfd45597836ba30c4e1c20a500a550ecf7df56
MD5 f127c3897444be0a02216518c81ec182
BLAKE2b-256 ec84b7788b79ecfbabfe8216c4c6a5061de2127029d95f57ed035388b42bf4fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghsec-0.1.2.tar.gz:

Publisher: publish.yml on garland3/github-security-issues

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: ghsec-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghsec-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1e40431546f02e1bae3f3f748b0a250b5e5145216e72f7add0a007dc4284bd05
MD5 bf7fd9a84b8e30e183ac3a1e76ab395f
BLAKE2b-256 e5bed20f1dc38a10e5b824f1bcb9d5f080461cf432a4dd01f4cf4e6d07711b26

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghsec-0.1.2-py3-none-any.whl:

Publisher: publish.yml on garland3/github-security-issues

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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