scitex_security.github
GitHub Security Alerts Module
Fetches and processes security alerts from GitHub.
Collaborator injection
Per the SciTeX no-mocks rule (PA-306), the production callables that
talk to external collaborators (the subprocess module, and the
in-module _run_gh_command/check_gh_auth/get_*_alerts
helpers) accept keyword-only overrides defaulting to the real module
globals. Tests pass real hand-rolled fakes; production code does not
pass anything.
Functions
|
Check if GitHub CLI is authenticated. |
|
Check all GitHub security alerts. |
|
Format alerts into a readable text report. |
|
Get code scanning alerts. |
|
Get Dependabot vulnerability alerts. |
|
Get path to the latest security alerts file. |
|
Get secret scanning alerts. |
|
Save alerts to a timestamped file. |
Exceptions
Raised when GitHub security operations fail. |
- exception scitex_security.github.GitHubSecurityError[source]
Raised when GitHub security operations fail.
- scitex_security.github.get_secret_alerts(repo=None, *, gh_runner=None)[source]
Get secret scanning alerts.
- scitex_security.github.get_dependabot_alerts(repo=None, *, gh_runner=None)[source]
Get Dependabot vulnerability alerts.
- scitex_security.github.get_code_scanning_alerts(repo=None, *, gh_runner=None)[source]
Get code scanning alerts.
- scitex_security.github.check_github_alerts(repo=None, *, auth_check=None, secrets_fn=None, dependabot_fn=None, code_scanning_fn=None)[source]
Check all GitHub security alerts.
- Parameters:
repo (
Optional[str]) – Repository in format ‘owner/repo’. If None, uses current repo.auth_check (
Optional[Callable[[],bool]]) –check_gh_auth-shaped callable. Override in tests.secrets_fn (
Optional[Callable]) –get_secret_alerts-shaped callable. Override in tests.dependabot_fn (
Optional[Callable]) –get_dependabot_alerts-shaped callable. Override in tests.code_scanning_fn (
Optional[Callable]) –get_code_scanning_alerts-shaped callable. Override in tests.
- Returns:
‘secrets’, ‘dependabot’, ‘code_scanning’
- Return type:
Dictionary with keys
- Raises:
GitHubSecurityError – If GitHub CLI is not installed or not authenticated
- scitex_security.github.format_alerts_report(alerts)[source]
Format alerts into a readable text report.
- scitex_security.github.save_alerts_to_file(alerts, output_dir=None, create_symlink=True)[source]
Save alerts to a timestamped file.