Skip to content

Script to show Secret Scanning progress#15

Merged
felickz merged 5 commits intomainfrom
copilot/implement-paradigm-in-python-harness
Apr 7, 2026
Merged

Script to show Secret Scanning progress#15
felickz merged 5 commits intomainfrom
copilot/implement-paradigm-in-python-harness

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

This pull request introduces new functionality for retrieving and summarizing secret scanning scan history progress across repositories, organizations, or enterprises. It adds a script for concurrent querying of the scan history API, updates documentation with usage instructions and examples, and extends the githubapi.py module with helper methods for listing repos and organizations.

Secret scanning scan history progress retrieval:

  • Added a new script (get_secret_scanning_scan_history_progress.py) to retrieve and summarize secret scanning scan history for repositories at the repo, org, or enterprise level, with support for concurrent API calls and optional detailed markdown output.
  • Updated README.md with a new section describing the scan history progress script, its usage, options, and example invocations.

API helper enhancements in githubapi.py:

  • Added list_org_repos to enumerate all repositories in a given organization.
  • Added list_enterprise_orgs to enumerate all organizations in a given enterprise using the GitHub GraphQL API.
  • Added get_secret_scanning_scan_history to fetch the secret scanning scan history for a single repository.

Copilot AI and others added 3 commits April 7, 2026 18:19
Implements the paradigm from Get-GHSecretScanningHistoryProgress.ps1 in
Python. Adds:
- Enterprise/org/repo resolution with GraphQL for enterprise orgs
- Concurrent scan history API calls via ThreadPoolExecutor
- Summary progress bars for backfill/incremental/pattern_update scans
- Detailed markdown table output option
- Error reporting for repos with disabled secret scanning

Also adds list_org_repos, list_enterprise_orgs, and
get_secret_scanning_scan_history methods to githubapi.py.

Agent-Logs-Url: https://github.com/advanced-security/ghas-api-python-scripts/sessions/f6a777a1-48ca-4999-ba66-76934aa82818

Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
The method was using query_once which defaults to cursor-based
pagination. The scan-history endpoint returns a single JSON object
(not a paginated list), so pagination params were incorrect and HTTP
errors were silently swallowed.

Now uses _get directly so:
- No spurious per_page/before query params
- HTTP errors (e.g. 403) properly propagate to callers

Agent-Logs-Url: https://github.com/advanced-security/ghas-api-python-scripts/sessions/7fb48030-50b4-4f88-bce8-1e571af0e38b

Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
@felickz felickz marked this pull request as ready for review April 7, 2026 21:35
@felickz felickz requested a review from a team as a code owner April 7, 2026 21:35
@felickz felickz requested review from adrienpessu, Copilot and felickz and removed request for a team April 7, 2026 21:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects how secret scanning scan-history is fetched by switching from paginated querying to a direct GET (so HTTP errors surface properly), and adds a new CLI script to summarize scan-history progress across repo/org/enterprise scopes.

Changes:

  • Add get_secret_scanning_scan_history() that performs a direct _get() call (no pagination params) and propagates HTTP errors.
  • Add helpers to enumerate repos (org) and orgs (enterprise via GraphQL), plus a new get_secret_scanning_scan_history_progress.py reporting script.
  • Update README documentation and ignore .venv/.
Show a summary per file
File Description
README.md Documents the new scan-history progress script and usage examples.
githubapi.py Adds org repo listing, enterprise org listing (GraphQL), and direct scan-history GET helper.
get_secret_scanning_scan_history_progress.py New CLI to concurrently fetch scan-history per repo and render progress/table output.
.gitignore Adds .venv/ and fixes .pyc ignore formatting.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/4 changed files
  • Comments generated: 3

@felickz felickz changed the title Fix scan-history API call to use direct GET instead of cursor pagination Script to show Secret Scanning progress Apr 7, 2026
Copy link
Copy Markdown
Contributor

@felickz felickz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:octocat: 👍

@felickz felickz merged commit f0f5969 into main Apr 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants