github-security-report 0.27.0__tar.gz → 0.28.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {github_security_report-0.27.0 → github_security_report-0.28.0}/PKG-INFO +109 -26
- {github_security_report-0.27.0 → github_security_report-0.28.0}/README.md +108 -25
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/_version.py +2 -2
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/__init__.py +6 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/app.py +24 -28
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/boundary.py +26 -3
- github_security_report-0.28.0/src/github_security_report/cli/guard.py +125 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/modes.py +7 -5
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/outputs.py +7 -4
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/preflight.py +64 -83
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/remediation.py +4 -2
- github_security_report-0.28.0/src/github_security_report/cli/token_scopes.py +223 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/repo_parser.py +8 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/writes.py +53 -7
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/workflow_runs.py +1 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/blocks.py +1 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/key_notes.py +3 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/schema.py +5 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/workflow_runs.py +3 -0
- github_security_report-0.28.0/src/github_security_report/contribution_refs.py +109 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/layout.py +2 -2
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/models.py +41 -97
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/remediate/__init__.py +76 -12
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/remediate/model.py +6 -2
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/html.py +1 -1
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/markdown.py +2 -2
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/slack.py +3 -3
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/terminal.py +1 -101
- github_security_report-0.28.0/src/github_security_report/render/terminal_remediation.py +137 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/report/tables.py +18 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/runner.py +61 -24
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/workflow_runs/tables.py +42 -5
- {github_security_report-0.27.0 → github_security_report-0.28.0}/.gitignore +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/LICENSE +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/LICENSES/Apache-2.0.txt +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/pyproject.toml +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/scripts/README.md +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/authors.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/categories/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/categories/keys.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/categories/signals.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/categories/tables.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/classify.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/__main__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/config_cmd.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/config_source.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/options.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/preflight_messages.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/progress.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/publish.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/serialise.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/cli/summary.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/accounting.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/alerts.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/analyses.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/batch_errors.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/bodies.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/codeql_parsers.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/copilot.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/endpoints.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/errors.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/events.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/failures.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/org_reads.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/paging.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/parsers.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/queries.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/reads.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/retry.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/reviews.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/transport.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/client/workflow_runs.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/code_quality.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/codeql/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/codeql/cleanup.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/codeql/facts.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/codeql/tables.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/codeql.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/context.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/exclusions.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/extras.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/graph.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/org.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/protocols.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/repo.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/run_sync.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/collect/scoping.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/dictionary.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/errors.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/loader.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/models.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/config/order.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/fuzz.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/gating.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/gitctx.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/issue_presentation.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/issues.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/malware.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/matching.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/ordering.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/posture/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/posture/enablement.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/posture/facts.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/posture/quality.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/posture/releases.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/pulls/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/pulls/columns.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/pulls/counting.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/pulls/presentation.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/pulls/table.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/py.typed +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/ranking.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/remediate/codeql.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/slack_limits.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/slack_text.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/render/terminal_notices.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/report/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/report/aggregate.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/report/display.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/report/exclusions.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/report/signals.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/rulesets.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/scope.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/secret_patterns.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/severity.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/summary.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/templates/index.html.j2 +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/templates/report.html.j2 +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/workflow_runs/__init__.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/workflow_runs/aggregate.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/workflow_runs/models.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/workflow_runs/store.py +0 -0
- {github_security_report-0.27.0 → github_security_report-0.28.0}/src/github_security_report/workflow_runs/store_codec.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: github-security-report
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.28.0
|
|
4
4
|
Summary: Security and quality reporting across GitHub organisations
|
|
5
5
|
Project-URL: Homepage, https://github.com/lfreleng-actions/github-security-report-action
|
|
6
6
|
Project-URL: Repository, https://github.com/lfreleng-actions/github-security-report-action
|
|
@@ -231,6 +231,9 @@ tables (org mode):
|
|
|
231
231
|
ones), **Retried** (runs that passed on a later attempt, a direct sign of
|
|
232
232
|
flakiness), **Workflows** (how many distinct workflows failed) and **Worst
|
|
233
233
|
workflow** (the one with the most failures, linked to its run history).
|
|
234
|
+
A display threshold, `workflow_runs.fail_rate_display_threshold`, can
|
|
235
|
+
hide the rows failing at or below a given rate; they still count in the
|
|
236
|
+
footer.
|
|
234
237
|
Slack draws the same fixed-width table narrowed to **Repository**,
|
|
235
238
|
**Failed**, **Runs** and **Fail %**, with its totals row and footer; the
|
|
236
239
|
other columns stay on the terminal, GitHub Pages and `report.json`.
|
|
@@ -387,14 +390,17 @@ signal readable: repo mode reads the alerts only after a GraphQL read
|
|
|
387
390
|
the job token can make that read has not been tested. Where it cannot, the
|
|
388
391
|
Dependabot signal reads as unknown when the response carries no repository,
|
|
389
392
|
but as **disabled** when it carries the repository without that field's value
|
|
390
|
-
(see the Dependabot bullet below)
|
|
393
|
+
(see the Dependabot bullet below). A disabled signal never fails the gate; an
|
|
394
|
+
unknown one fails it only with `fail_on_unknown` on.
|
|
391
395
|
|
|
392
396
|
No job permission covers secret-scanning alerts: GitHub serves them only to a
|
|
393
397
|
GitHub App or a personal access token, and `security-events` covers code
|
|
394
398
|
scanning. With the job token, secret scanning therefore never gates a pull
|
|
395
|
-
request; it reads as unknown or disabled.
|
|
396
|
-
|
|
397
|
-
the
|
|
399
|
+
request on leaked secrets; it reads as unknown or disabled. An unknown reading
|
|
400
|
+
fails the gate under `fail_on_unknown`, so leave that input off for a job that
|
|
401
|
+
runs with the job token. To gate on leaked secrets, pass a token that can read
|
|
402
|
+
them through the action's `token` input, and grant it the repository
|
|
403
|
+
permissions for every signal repo mode reads (see the
|
|
398
404
|
[fine-grained table](#single-organisation--fine-grained-pat)). GitHub also
|
|
399
405
|
requires the account behind a personal access token to be an administrator
|
|
400
406
|
of the repository or of its organisation; otherwise the read is refused
|
|
@@ -406,15 +412,16 @@ the default `none`.
|
|
|
406
412
|
|
|
407
413
|
On a `pull_request` run from a fork, GitHub withholds repository secrets by
|
|
408
414
|
default, so a token passed from `secrets` is empty and the action falls back
|
|
409
|
-
to the job token: secret scanning then does not gate that run
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
to the job token: secret scanning then does not gate that run on leaked
|
|
416
|
+
secrets, and the job can pass unless `fail_on_unknown` is on and the read
|
|
417
|
+
comes back unknown. A workflow that must not pass without the token should
|
|
418
|
+
fail in an earlier step when the secret is empty. Do not switch to
|
|
419
|
+
`pull_request_target` to obtain the secret: a job that then checks out the
|
|
420
|
+
pull request's code exposes the token to it. For the same reason, do not
|
|
421
|
+
enable a private or internal repository's **Send secrets to workflows from
|
|
422
|
+
pull requests** setting where untrusted contributors can open fork pull
|
|
423
|
+
requests: with it on, the token is passed to workflow code the fork controls
|
|
424
|
+
instead of falling back to the job token.
|
|
418
425
|
|
|
419
426
|
Repo mode reads the repository's code-scanning, secret-scanning and Dependabot
|
|
420
427
|
alerts. A read the token cannot make does not always surface as unknown. A
|
|
@@ -466,15 +473,34 @@ Repo mode classifies every category against its default cutoff (see
|
|
|
466
473
|
[Pass/fail severity cutoff](#passfail-severity-cutoff)) and ignores
|
|
467
474
|
`report.categories.<key>.fail_severity`. CodeQL, Scorecard findings and
|
|
468
475
|
Dependabot use `medium`, aislop `low` and zizmor `informational`, so a
|
|
469
|
-
repository whose only CodeQL alerts are `low` reads clean
|
|
470
|
-
`fail_threshold` `any` or `low`.
|
|
471
|
-
|
|
472
|
-
Classification and the gate are separate, and the gate
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
repository whose only CodeQL alerts are `low` reads clean. The gate still
|
|
477
|
+
weighs those alerts: they fail it at `fail_threshold` `any` or `low`.
|
|
478
|
+
|
|
479
|
+
Classification and the gate are separate, and the gate judges findings rather
|
|
480
|
+
than offenders. A severity threshold fails the job when any signal holds an
|
|
481
|
+
open finding at or above it, whatever the signal's state: a clean signal with
|
|
482
|
+
findings under its category's cutoff, or an unknown one with the alerts it
|
|
483
|
+
read before the read failed. `fail_threshold: any` fails the job on every
|
|
484
|
+
offender, a sub-10 Scorecard score with no findings included, and on any open
|
|
485
|
+
finding of any severity; `none` never fails on findings. With the default
|
|
486
|
+
cutoffs only `low` and `any` reach findings that are not already offenders.
|
|
487
|
+
|
|
488
|
+
A signal that could not be read fails the gate only with `fail_on_unknown`
|
|
489
|
+
(`--fail-on-unknown`) on; it does so at any `fail_threshold`, `none`
|
|
490
|
+
included. The flag covers the signals the gate reads (CodeQL, Scorecard,
|
|
491
|
+
zizmor, aislop, fuzz, Dependabot alerts and secret scanning): a disabled or
|
|
492
|
+
not-applicable signal never fails it, nor does the unknown count of a table
|
|
493
|
+
such as Workflow Failures. Without the flag a token missing a permission can
|
|
494
|
+
pass the gate: check each category's footer for its `❓` unknown count. A
|
|
495
|
+
failed gate prints one line per cause: the signals holding findings at or
|
|
496
|
+
above the threshold, and each unreadable signal with the reason it could not
|
|
497
|
+
be read.
|
|
498
|
+
|
|
499
|
+
> The flag and input are recent additions. The action passes the flag only
|
|
500
|
+
> when the input is `"true"`, so leaving it off cannot break a run; but outside
|
|
501
|
+
> pull requests the action runs the pinned release, and a release predating the
|
|
502
|
+
> flag rejects it with `No such option`. Turn the input on only once the pinned
|
|
503
|
+
> release supports it, or set `tool_version` to one that does.
|
|
478
504
|
|
|
479
505
|
Repo mode reads no issues, pull requests or organisation membership, so it
|
|
480
506
|
needs no permission for them.
|
|
@@ -602,6 +628,17 @@ every write, provided the token's account holds the access described above.
|
|
|
602
628
|
`admin:org` stays optional, exactly as for the report, except as
|
|
603
629
|
the `codeql` caveat below describes.
|
|
604
630
|
|
|
631
|
+
The pre-flight checks a classic PAT's scopes against these writes: an
|
|
632
|
+
`--apply` whose token holds neither `repo` nor `public_repo` stops with exit
|
|
633
|
+
code `2` before anything is collected, naming the token and the missing scope,
|
|
634
|
+
and one holding `public_repo` alone warns that private repositories cannot be
|
|
635
|
+
changed. `codeql_stale_configurations` deletes code scanning analyses, which
|
|
636
|
+
`security_events` also permits, but its workflow re-enables need `repo` or
|
|
637
|
+
`public_repo`, so with that scope alone the category can still write and the
|
|
638
|
+
warning names its re-enables. An apply stops only when no selected category
|
|
639
|
+
can write, and otherwise warns naming the categories that cannot. A
|
|
640
|
+
fine-grained PAT or App token reports no scopes, so this check skips it.
|
|
641
|
+
|
|
605
642
|
**Fine-grained PAT, reads:** the repository permissions Metadata, Contents,
|
|
606
643
|
Dependabot alerts, Code scanning alerts, Secret scanning alerts, Issues,
|
|
607
644
|
Administration and Actions from the report's table. Keep Issues: a failed issue
|
|
@@ -716,6 +753,8 @@ that only shape an organisation-wide run — `output_dir`, `pages_url`,
|
|
|
716
753
|
— are **rejected** with exit code 2 rather than accepted and discarded, so a
|
|
717
754
|
misconfigured workflow says so instead of quietly producing a report that
|
|
718
755
|
ignores them.
|
|
756
|
+
`fail_on_unknown` is refused the same way in org mode, which has no gate for
|
|
757
|
+
it to act on.
|
|
719
758
|
|
|
720
759
|
### Runtime isolation
|
|
721
760
|
|
|
@@ -926,7 +965,9 @@ rest stay short — set it to `0` for no limit at all:
|
|
|
926
965
|
Here Releases / Tagging lists every repository, CodeQL shows its worst three, and
|
|
927
966
|
every other category keeps the shared limit of 10. A category's `top_n` applies
|
|
928
967
|
to all four surfaces at once; combine it with `top_n_report` / `top_n_cli` /
|
|
929
|
-
`top_n_slack` to vary the fallback per surface.
|
|
968
|
+
`top_n_slack` to vary the fallback per surface. On the Workflow Failures
|
|
969
|
+
tables, `workflow_runs.fail_rate_display_threshold` applies first: the limit,
|
|
970
|
+
and its `… and N more` tally, count only the rows the threshold leaves.
|
|
930
971
|
|
|
931
972
|
The resolution order for one category on one surface, most specific first:
|
|
932
973
|
|
|
@@ -2013,6 +2054,7 @@ like every other `report` key. Every key with its default:
|
|
|
2013
2054
|
"persistent_threshold": 0.9,
|
|
2014
2055
|
"min_runs": 3,
|
|
2015
2056
|
"fail_rate_error_threshold": 0.05,
|
|
2057
|
+
"fail_rate_display_threshold": 0,
|
|
2016
2058
|
"cache": true
|
|
2017
2059
|
}
|
|
2018
2060
|
},
|
|
@@ -2061,6 +2103,23 @@ Markdown, HTML and Slack carry no cell colour, so the setting leaves them
|
|
|
2061
2103
|
unchanged. It is independent of `persistent_threshold`, which judges
|
|
2062
2104
|
single workflows.
|
|
2063
2105
|
|
|
2106
|
+
`fail_rate_display_threshold`, a number from `0` to `1`, hides the rows
|
|
2107
|
+
failing at or below that fraction of their pass-or-fail runs, so a busy
|
|
2108
|
+
organisation's handful of high failure rates is not lost among repositories
|
|
2109
|
+
failing one run in a hundred. A row is listed only when its rate is strictly
|
|
2110
|
+
above the threshold, the comparison `fail_rate_error_threshold` makes. Each
|
|
2111
|
+
table judges the rate in its own **Fail %** column: the per-repository table
|
|
2112
|
+
the repository's rate, the detail table the workflow's, so a workflow
|
|
2113
|
+
failing often stays listed when its repository as a whole falls below the
|
|
2114
|
+
threshold. The comparison uses the unrounded rate, not the percentage the
|
|
2115
|
+
cell shows: with `0.02`, a repository failing 2.4% of its runs reads `2%`
|
|
2116
|
+
and is listed, and one failing 1.6% also reads `2%` and is not. Every
|
|
2117
|
+
surface applies it, for every window. The footer's counts do not change,
|
|
2118
|
+
since a hidden repository still has failures, and a footer line says how
|
|
2119
|
+
many rows the threshold hides (`22 failing at or below 2% not listed`);
|
|
2120
|
+
when it hides every row, the table is not drawn and the footer still is.
|
|
2121
|
+
`report.json` keeps every row. The default `0` lists every failing row.
|
|
2122
|
+
|
|
2064
2123
|
`cache` and `cache_dir` govern the **run store**, a SQLite file per
|
|
2065
2124
|
organisation at
|
|
2066
2125
|
|
|
@@ -2260,6 +2319,7 @@ github-security-report config keys report.categories.code_quality
|
|
|
2260
2319
|
| `top_n_cli` | No | — | Offenders per signal in the terminal output (`0` = no limit; overrides `top_n`) |
|
|
2261
2320
|
| `top_n_slack` | No | — | Offenders per signal in the Slack digest (`0` = no limit; overrides `top_n`) |
|
|
2262
2321
|
| `fail_threshold` | No | `none` | `none`/`low`/`medium`/`high`/`critical`/`any` (repo mode) |
|
|
2322
|
+
| `fail_on_unknown` | No | `false` | Also fail the repo-mode gate when a signal could not be read (repo mode only; refused with exit code `2` in org mode). Passed to the CLI only when `"true"`; a pinned release predating the flag rejects it |
|
|
2263
2323
|
| `force_notify` | No | `false` | Post to Slack regardless of `report_day` |
|
|
2264
2324
|
| `hide` | No | `""` | Category keys to suppress on every output (space- or comma-separated). Overrides config, and is one-way: it cannot re-enable a disabled category |
|
|
2265
2325
|
| `graph_batch` | No | `""` | Repositories per batched GraphQL prefetch query (minimum `1`; default: config, else `10`). Pass a repository or organisation variable such as `${{ vars.GSR_GRAPH_BATCH }}` to adjust it from settings. A batch that still fails is halved automatically, so this sets the starting size (see [GraphQL prefetch batch size](#graphql-prefetch-batch-size)) |
|
|
@@ -2280,7 +2340,7 @@ github-security-report config keys report.categories.code_quality
|
|
|
2280
2340
|
| ---- | ----------- |
|
|
2281
2341
|
| `should_notify` | Whether today is a Slack notification day |
|
|
2282
2342
|
| `slack_payload` | Prebuilt Slack `chat.postMessage` payload (JSON) |
|
|
2283
|
-
| `failed` | Whether the repo-mode
|
|
2343
|
+
| `failed` | Whether the repo-mode gate failed (exit code `1`) |
|
|
2284
2344
|
|
|
2285
2345
|
## Running locally
|
|
2286
2346
|
|
|
@@ -2364,12 +2424,13 @@ API in the same way.
|
|
|
2364
2424
|
| Code | Meaning |
|
|
2365
2425
|
| ---- | ------- |
|
|
2366
2426
|
| `0` | The report ran. |
|
|
2367
|
-
| `1` | Repo mode
|
|
2427
|
+
| `1` | Repo mode: the gate failed on findings or `--fail-on-unknown`. |
|
|
2368
2428
|
| `2` | Usage or configuration error (bad flag, bad config, unset token). |
|
|
2369
2429
|
| `3` | The GitHub API was unusable after the retry budget (see below). |
|
|
2370
2430
|
| `4` | GitHub rejected the credentials (HTTP 401). |
|
|
2371
2431
|
| `5` | A repository listing answered `403` or `404`, with no rate limit. |
|
|
2372
2432
|
| `6` | A rate limit with nothing left stopped the run (causes below). |
|
|
2433
|
+
| `7` | Internal error: an unexpected failure, not a finding (see below). |
|
|
2373
2434
|
|
|
2374
2435
|
Code `6` has five causes, and a rate-limited `403` is one of them, not `5`:
|
|
2375
2436
|
|
|
@@ -2413,6 +2474,14 @@ organisation comes after the earlier ones' writes have been applied. Check
|
|
|
2413
2474
|
what the run printed before re-running; a re-run enables only what it finds
|
|
2414
2475
|
still off.
|
|
2415
2476
|
|
|
2477
|
+
Code `7` is not an abort. It reports an error the tool did not expect: a
|
|
2478
|
+
defect, or a failure no specific check covers, such as an `--output-dir` that
|
|
2479
|
+
cannot be created. Unlike `3` to `6`, it can come after output was written,
|
|
2480
|
+
so files under `--output-dir` may be partial; do not publish them, and treat
|
|
2481
|
+
the run as failed. For `remediate`, changes made before the error stand, as
|
|
2482
|
+
above. The message names the error in one line; re-run with `--verbose` to
|
|
2483
|
+
print the traceback, which never includes local variables.
|
|
2484
|
+
|
|
2416
2485
|
Org-mode `report` and `remediate` check for these before they collect
|
|
2417
2486
|
anything, for every configured organisation before the first. `report` reads
|
|
2418
2487
|
each organisation's own `token_env`; `remediate` reads only its one
|
|
@@ -2469,6 +2538,20 @@ read-only `token_env` in the config.
|
|
|
2469
2538
|
[The `remediate` subcommand](#the-remediate-subcommand) under Token permissions
|
|
2470
2539
|
lists the scopes and permissions it needs, by category.
|
|
2471
2540
|
|
|
2541
|
+
Before it collects anything, a dry run warns when a classic PAT could not make
|
|
2542
|
+
the changes it previews: one without `repo` or `public_repo` could make none of
|
|
2543
|
+
them (bar the CodeQL cleanup's deletions, which `security_events` also
|
|
2544
|
+
permits), and one with `public_repo` alone cannot change private repositories.
|
|
2545
|
+
Beneath each category's preview, it also names the targets whose repository
|
|
2546
|
+
the token's account does not administer, since GitHub may refuse those writes;
|
|
2547
|
+
they stay in the preview and its counts, and `--apply` still attempts them.
|
|
2548
|
+
During `--apply`, once three writes in a row in one category are refused with
|
|
2549
|
+
the same `403` or `404` answer, that category writes nothing more in that
|
|
2550
|
+
organisation: its remaining targets are reported as skipped, naming the
|
|
2551
|
+
refusal, and count as neither changed nor failed. A write that succeeds in
|
|
2552
|
+
between, even one step of a target's several, ends the run. The next category,
|
|
2553
|
+
and the next organisation, start afresh.
|
|
2554
|
+
|
|
2472
2555
|
```bash
|
|
2473
2556
|
# Token scopes and permissions: see "The remediate subcommand" under
|
|
2474
2557
|
# Token permissions.
|
|
@@ -187,6 +187,9 @@ tables (org mode):
|
|
|
187
187
|
ones), **Retried** (runs that passed on a later attempt, a direct sign of
|
|
188
188
|
flakiness), **Workflows** (how many distinct workflows failed) and **Worst
|
|
189
189
|
workflow** (the one with the most failures, linked to its run history).
|
|
190
|
+
A display threshold, `workflow_runs.fail_rate_display_threshold`, can
|
|
191
|
+
hide the rows failing at or below a given rate; they still count in the
|
|
192
|
+
footer.
|
|
190
193
|
Slack draws the same fixed-width table narrowed to **Repository**,
|
|
191
194
|
**Failed**, **Runs** and **Fail %**, with its totals row and footer; the
|
|
192
195
|
other columns stay on the terminal, GitHub Pages and `report.json`.
|
|
@@ -343,14 +346,17 @@ signal readable: repo mode reads the alerts only after a GraphQL read
|
|
|
343
346
|
the job token can make that read has not been tested. Where it cannot, the
|
|
344
347
|
Dependabot signal reads as unknown when the response carries no repository,
|
|
345
348
|
but as **disabled** when it carries the repository without that field's value
|
|
346
|
-
(see the Dependabot bullet below)
|
|
349
|
+
(see the Dependabot bullet below). A disabled signal never fails the gate; an
|
|
350
|
+
unknown one fails it only with `fail_on_unknown` on.
|
|
347
351
|
|
|
348
352
|
No job permission covers secret-scanning alerts: GitHub serves them only to a
|
|
349
353
|
GitHub App or a personal access token, and `security-events` covers code
|
|
350
354
|
scanning. With the job token, secret scanning therefore never gates a pull
|
|
351
|
-
request; it reads as unknown or disabled.
|
|
352
|
-
|
|
353
|
-
the
|
|
355
|
+
request on leaked secrets; it reads as unknown or disabled. An unknown reading
|
|
356
|
+
fails the gate under `fail_on_unknown`, so leave that input off for a job that
|
|
357
|
+
runs with the job token. To gate on leaked secrets, pass a token that can read
|
|
358
|
+
them through the action's `token` input, and grant it the repository
|
|
359
|
+
permissions for every signal repo mode reads (see the
|
|
354
360
|
[fine-grained table](#single-organisation--fine-grained-pat)). GitHub also
|
|
355
361
|
requires the account behind a personal access token to be an administrator
|
|
356
362
|
of the repository or of its organisation; otherwise the read is refused
|
|
@@ -362,15 +368,16 @@ the default `none`.
|
|
|
362
368
|
|
|
363
369
|
On a `pull_request` run from a fork, GitHub withholds repository secrets by
|
|
364
370
|
default, so a token passed from `secrets` is empty and the action falls back
|
|
365
|
-
to the job token: secret scanning then does not gate that run
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
to the job token: secret scanning then does not gate that run on leaked
|
|
372
|
+
secrets, and the job can pass unless `fail_on_unknown` is on and the read
|
|
373
|
+
comes back unknown. A workflow that must not pass without the token should
|
|
374
|
+
fail in an earlier step when the secret is empty. Do not switch to
|
|
375
|
+
`pull_request_target` to obtain the secret: a job that then checks out the
|
|
376
|
+
pull request's code exposes the token to it. For the same reason, do not
|
|
377
|
+
enable a private or internal repository's **Send secrets to workflows from
|
|
378
|
+
pull requests** setting where untrusted contributors can open fork pull
|
|
379
|
+
requests: with it on, the token is passed to workflow code the fork controls
|
|
380
|
+
instead of falling back to the job token.
|
|
374
381
|
|
|
375
382
|
Repo mode reads the repository's code-scanning, secret-scanning and Dependabot
|
|
376
383
|
alerts. A read the token cannot make does not always surface as unknown. A
|
|
@@ -422,15 +429,34 @@ Repo mode classifies every category against its default cutoff (see
|
|
|
422
429
|
[Pass/fail severity cutoff](#passfail-severity-cutoff)) and ignores
|
|
423
430
|
`report.categories.<key>.fail_severity`. CodeQL, Scorecard findings and
|
|
424
431
|
Dependabot use `medium`, aislop `low` and zizmor `informational`, so a
|
|
425
|
-
repository whose only CodeQL alerts are `low` reads clean
|
|
426
|
-
`fail_threshold` `any` or `low`.
|
|
427
|
-
|
|
428
|
-
Classification and the gate are separate, and the gate
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
432
|
+
repository whose only CodeQL alerts are `low` reads clean. The gate still
|
|
433
|
+
weighs those alerts: they fail it at `fail_threshold` `any` or `low`.
|
|
434
|
+
|
|
435
|
+
Classification and the gate are separate, and the gate judges findings rather
|
|
436
|
+
than offenders. A severity threshold fails the job when any signal holds an
|
|
437
|
+
open finding at or above it, whatever the signal's state: a clean signal with
|
|
438
|
+
findings under its category's cutoff, or an unknown one with the alerts it
|
|
439
|
+
read before the read failed. `fail_threshold: any` fails the job on every
|
|
440
|
+
offender, a sub-10 Scorecard score with no findings included, and on any open
|
|
441
|
+
finding of any severity; `none` never fails on findings. With the default
|
|
442
|
+
cutoffs only `low` and `any` reach findings that are not already offenders.
|
|
443
|
+
|
|
444
|
+
A signal that could not be read fails the gate only with `fail_on_unknown`
|
|
445
|
+
(`--fail-on-unknown`) on; it does so at any `fail_threshold`, `none`
|
|
446
|
+
included. The flag covers the signals the gate reads (CodeQL, Scorecard,
|
|
447
|
+
zizmor, aislop, fuzz, Dependabot alerts and secret scanning): a disabled or
|
|
448
|
+
not-applicable signal never fails it, nor does the unknown count of a table
|
|
449
|
+
such as Workflow Failures. Without the flag a token missing a permission can
|
|
450
|
+
pass the gate: check each category's footer for its `❓` unknown count. A
|
|
451
|
+
failed gate prints one line per cause: the signals holding findings at or
|
|
452
|
+
above the threshold, and each unreadable signal with the reason it could not
|
|
453
|
+
be read.
|
|
454
|
+
|
|
455
|
+
> The flag and input are recent additions. The action passes the flag only
|
|
456
|
+
> when the input is `"true"`, so leaving it off cannot break a run; but outside
|
|
457
|
+
> pull requests the action runs the pinned release, and a release predating the
|
|
458
|
+
> flag rejects it with `No such option`. Turn the input on only once the pinned
|
|
459
|
+
> release supports it, or set `tool_version` to one that does.
|
|
434
460
|
|
|
435
461
|
Repo mode reads no issues, pull requests or organisation membership, so it
|
|
436
462
|
needs no permission for them.
|
|
@@ -558,6 +584,17 @@ every write, provided the token's account holds the access described above.
|
|
|
558
584
|
`admin:org` stays optional, exactly as for the report, except as
|
|
559
585
|
the `codeql` caveat below describes.
|
|
560
586
|
|
|
587
|
+
The pre-flight checks a classic PAT's scopes against these writes: an
|
|
588
|
+
`--apply` whose token holds neither `repo` nor `public_repo` stops with exit
|
|
589
|
+
code `2` before anything is collected, naming the token and the missing scope,
|
|
590
|
+
and one holding `public_repo` alone warns that private repositories cannot be
|
|
591
|
+
changed. `codeql_stale_configurations` deletes code scanning analyses, which
|
|
592
|
+
`security_events` also permits, but its workflow re-enables need `repo` or
|
|
593
|
+
`public_repo`, so with that scope alone the category can still write and the
|
|
594
|
+
warning names its re-enables. An apply stops only when no selected category
|
|
595
|
+
can write, and otherwise warns naming the categories that cannot. A
|
|
596
|
+
fine-grained PAT or App token reports no scopes, so this check skips it.
|
|
597
|
+
|
|
561
598
|
**Fine-grained PAT, reads:** the repository permissions Metadata, Contents,
|
|
562
599
|
Dependabot alerts, Code scanning alerts, Secret scanning alerts, Issues,
|
|
563
600
|
Administration and Actions from the report's table. Keep Issues: a failed issue
|
|
@@ -672,6 +709,8 @@ that only shape an organisation-wide run — `output_dir`, `pages_url`,
|
|
|
672
709
|
— are **rejected** with exit code 2 rather than accepted and discarded, so a
|
|
673
710
|
misconfigured workflow says so instead of quietly producing a report that
|
|
674
711
|
ignores them.
|
|
712
|
+
`fail_on_unknown` is refused the same way in org mode, which has no gate for
|
|
713
|
+
it to act on.
|
|
675
714
|
|
|
676
715
|
### Runtime isolation
|
|
677
716
|
|
|
@@ -882,7 +921,9 @@ rest stay short — set it to `0` for no limit at all:
|
|
|
882
921
|
Here Releases / Tagging lists every repository, CodeQL shows its worst three, and
|
|
883
922
|
every other category keeps the shared limit of 10. A category's `top_n` applies
|
|
884
923
|
to all four surfaces at once; combine it with `top_n_report` / `top_n_cli` /
|
|
885
|
-
`top_n_slack` to vary the fallback per surface.
|
|
924
|
+
`top_n_slack` to vary the fallback per surface. On the Workflow Failures
|
|
925
|
+
tables, `workflow_runs.fail_rate_display_threshold` applies first: the limit,
|
|
926
|
+
and its `… and N more` tally, count only the rows the threshold leaves.
|
|
886
927
|
|
|
887
928
|
The resolution order for one category on one surface, most specific first:
|
|
888
929
|
|
|
@@ -1969,6 +2010,7 @@ like every other `report` key. Every key with its default:
|
|
|
1969
2010
|
"persistent_threshold": 0.9,
|
|
1970
2011
|
"min_runs": 3,
|
|
1971
2012
|
"fail_rate_error_threshold": 0.05,
|
|
2013
|
+
"fail_rate_display_threshold": 0,
|
|
1972
2014
|
"cache": true
|
|
1973
2015
|
}
|
|
1974
2016
|
},
|
|
@@ -2017,6 +2059,23 @@ Markdown, HTML and Slack carry no cell colour, so the setting leaves them
|
|
|
2017
2059
|
unchanged. It is independent of `persistent_threshold`, which judges
|
|
2018
2060
|
single workflows.
|
|
2019
2061
|
|
|
2062
|
+
`fail_rate_display_threshold`, a number from `0` to `1`, hides the rows
|
|
2063
|
+
failing at or below that fraction of their pass-or-fail runs, so a busy
|
|
2064
|
+
organisation's handful of high failure rates is not lost among repositories
|
|
2065
|
+
failing one run in a hundred. A row is listed only when its rate is strictly
|
|
2066
|
+
above the threshold, the comparison `fail_rate_error_threshold` makes. Each
|
|
2067
|
+
table judges the rate in its own **Fail %** column: the per-repository table
|
|
2068
|
+
the repository's rate, the detail table the workflow's, so a workflow
|
|
2069
|
+
failing often stays listed when its repository as a whole falls below the
|
|
2070
|
+
threshold. The comparison uses the unrounded rate, not the percentage the
|
|
2071
|
+
cell shows: with `0.02`, a repository failing 2.4% of its runs reads `2%`
|
|
2072
|
+
and is listed, and one failing 1.6% also reads `2%` and is not. Every
|
|
2073
|
+
surface applies it, for every window. The footer's counts do not change,
|
|
2074
|
+
since a hidden repository still has failures, and a footer line says how
|
|
2075
|
+
many rows the threshold hides (`22 failing at or below 2% not listed`);
|
|
2076
|
+
when it hides every row, the table is not drawn and the footer still is.
|
|
2077
|
+
`report.json` keeps every row. The default `0` lists every failing row.
|
|
2078
|
+
|
|
2020
2079
|
`cache` and `cache_dir` govern the **run store**, a SQLite file per
|
|
2021
2080
|
organisation at
|
|
2022
2081
|
|
|
@@ -2216,6 +2275,7 @@ github-security-report config keys report.categories.code_quality
|
|
|
2216
2275
|
| `top_n_cli` | No | — | Offenders per signal in the terminal output (`0` = no limit; overrides `top_n`) |
|
|
2217
2276
|
| `top_n_slack` | No | — | Offenders per signal in the Slack digest (`0` = no limit; overrides `top_n`) |
|
|
2218
2277
|
| `fail_threshold` | No | `none` | `none`/`low`/`medium`/`high`/`critical`/`any` (repo mode) |
|
|
2278
|
+
| `fail_on_unknown` | No | `false` | Also fail the repo-mode gate when a signal could not be read (repo mode only; refused with exit code `2` in org mode). Passed to the CLI only when `"true"`; a pinned release predating the flag rejects it |
|
|
2219
2279
|
| `force_notify` | No | `false` | Post to Slack regardless of `report_day` |
|
|
2220
2280
|
| `hide` | No | `""` | Category keys to suppress on every output (space- or comma-separated). Overrides config, and is one-way: it cannot re-enable a disabled category |
|
|
2221
2281
|
| `graph_batch` | No | `""` | Repositories per batched GraphQL prefetch query (minimum `1`; default: config, else `10`). Pass a repository or organisation variable such as `${{ vars.GSR_GRAPH_BATCH }}` to adjust it from settings. A batch that still fails is halved automatically, so this sets the starting size (see [GraphQL prefetch batch size](#graphql-prefetch-batch-size)) |
|
|
@@ -2236,7 +2296,7 @@ github-security-report config keys report.categories.code_quality
|
|
|
2236
2296
|
| ---- | ----------- |
|
|
2237
2297
|
| `should_notify` | Whether today is a Slack notification day |
|
|
2238
2298
|
| `slack_payload` | Prebuilt Slack `chat.postMessage` payload (JSON) |
|
|
2239
|
-
| `failed` | Whether the repo-mode
|
|
2299
|
+
| `failed` | Whether the repo-mode gate failed (exit code `1`) |
|
|
2240
2300
|
|
|
2241
2301
|
## Running locally
|
|
2242
2302
|
|
|
@@ -2320,12 +2380,13 @@ API in the same way.
|
|
|
2320
2380
|
| Code | Meaning |
|
|
2321
2381
|
| ---- | ------- |
|
|
2322
2382
|
| `0` | The report ran. |
|
|
2323
|
-
| `1` | Repo mode
|
|
2383
|
+
| `1` | Repo mode: the gate failed on findings or `--fail-on-unknown`. |
|
|
2324
2384
|
| `2` | Usage or configuration error (bad flag, bad config, unset token). |
|
|
2325
2385
|
| `3` | The GitHub API was unusable after the retry budget (see below). |
|
|
2326
2386
|
| `4` | GitHub rejected the credentials (HTTP 401). |
|
|
2327
2387
|
| `5` | A repository listing answered `403` or `404`, with no rate limit. |
|
|
2328
2388
|
| `6` | A rate limit with nothing left stopped the run (causes below). |
|
|
2389
|
+
| `7` | Internal error: an unexpected failure, not a finding (see below). |
|
|
2329
2390
|
|
|
2330
2391
|
Code `6` has five causes, and a rate-limited `403` is one of them, not `5`:
|
|
2331
2392
|
|
|
@@ -2369,6 +2430,14 @@ organisation comes after the earlier ones' writes have been applied. Check
|
|
|
2369
2430
|
what the run printed before re-running; a re-run enables only what it finds
|
|
2370
2431
|
still off.
|
|
2371
2432
|
|
|
2433
|
+
Code `7` is not an abort. It reports an error the tool did not expect: a
|
|
2434
|
+
defect, or a failure no specific check covers, such as an `--output-dir` that
|
|
2435
|
+
cannot be created. Unlike `3` to `6`, it can come after output was written,
|
|
2436
|
+
so files under `--output-dir` may be partial; do not publish them, and treat
|
|
2437
|
+
the run as failed. For `remediate`, changes made before the error stand, as
|
|
2438
|
+
above. The message names the error in one line; re-run with `--verbose` to
|
|
2439
|
+
print the traceback, which never includes local variables.
|
|
2440
|
+
|
|
2372
2441
|
Org-mode `report` and `remediate` check for these before they collect
|
|
2373
2442
|
anything, for every configured organisation before the first. `report` reads
|
|
2374
2443
|
each organisation's own `token_env`; `remediate` reads only its one
|
|
@@ -2425,6 +2494,20 @@ read-only `token_env` in the config.
|
|
|
2425
2494
|
[The `remediate` subcommand](#the-remediate-subcommand) under Token permissions
|
|
2426
2495
|
lists the scopes and permissions it needs, by category.
|
|
2427
2496
|
|
|
2497
|
+
Before it collects anything, a dry run warns when a classic PAT could not make
|
|
2498
|
+
the changes it previews: one without `repo` or `public_repo` could make none of
|
|
2499
|
+
them (bar the CodeQL cleanup's deletions, which `security_events` also
|
|
2500
|
+
permits), and one with `public_repo` alone cannot change private repositories.
|
|
2501
|
+
Beneath each category's preview, it also names the targets whose repository
|
|
2502
|
+
the token's account does not administer, since GitHub may refuse those writes;
|
|
2503
|
+
they stay in the preview and its counts, and `--apply` still attempts them.
|
|
2504
|
+
During `--apply`, once three writes in a row in one category are refused with
|
|
2505
|
+
the same `403` or `404` answer, that category writes nothing more in that
|
|
2506
|
+
organisation: its remaining targets are reported as skipped, naming the
|
|
2507
|
+
refusal, and count as neither changed nor failed. A write that succeeds in
|
|
2508
|
+
between, even one step of a target's several, ends the run. The next category,
|
|
2509
|
+
and the next organisation, start afresh.
|
|
2510
|
+
|
|
2428
2511
|
```bash
|
|
2429
2512
|
# Token scopes and permissions: see "The remediate subcommand" under
|
|
2430
2513
|
# Token permissions.
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0,
|
|
21
|
+
__version__ = version = '0.28.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 28, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -13,6 +13,7 @@ The command surface is split across:
|
|
|
13
13
|
- :mod:`cli.modes` -- the org, repo and remediate run modes
|
|
14
14
|
- :mod:`cli.config_cmd` -- the ``config check`` and ``config keys`` commands
|
|
15
15
|
- :mod:`cli.config_source` -- reading a configuration, reporting its errors
|
|
16
|
+
- :mod:`cli.guard` -- the exit-7 handler every command runs inside
|
|
16
17
|
- :mod:`cli.options` -- what a run takes from the command line
|
|
17
18
|
- :mod:`cli.publish` -- the Pages files, Slack digest and job summary
|
|
18
19
|
- :mod:`cli.outputs` -- offender limits, category visibility, file writing
|
|
@@ -21,6 +22,7 @@ The command surface is split across:
|
|
|
21
22
|
|
|
22
23
|
from __future__ import annotations
|
|
23
24
|
|
|
25
|
+
from github_security_report.cli import guard
|
|
24
26
|
from github_security_report.cli.app import (
|
|
25
27
|
_version_callback,
|
|
26
28
|
app,
|
|
@@ -49,6 +51,10 @@ from github_security_report.cli.serialise import _org_to_dict, _table_to_dict
|
|
|
49
51
|
# Registered here rather than in cli.app, which holds the run commands; the
|
|
50
52
|
# entry point is this package's ``app``, so the group is always present.
|
|
51
53
|
app.add_typer(config_app, name="config")
|
|
54
|
+
# Every command, these and any added later, reports an unexpected error as
|
|
55
|
+
# exit 7 rather than a traceback and exit 1. Importing cli.app, as the module
|
|
56
|
+
# form of the entry point does, runs this package first.
|
|
57
|
+
guard.install(app)
|
|
52
58
|
|
|
53
59
|
# The package façade: every name the module split moved is still importable
|
|
54
60
|
# from ``github_security_report.cli``, including the private helpers the tests
|
|
@@ -67,11 +67,6 @@ def main(
|
|
|
67
67
|
)
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
def _supplied(flags: dict[str, bool]) -> list[str]:
|
|
71
|
-
"""The names of the flags a caller supplied, for the repo-mode refusal."""
|
|
72
|
-
return [name for name, supplied in flags.items() if supplied]
|
|
73
|
-
|
|
74
|
-
|
|
75
70
|
def _console(no_color: bool) -> Console:
|
|
76
71
|
"""A console that drops colour in CI, when piped, or on request.
|
|
77
72
|
|
|
@@ -138,6 +133,9 @@ def report(
|
|
|
138
133
|
"--fail-threshold",
|
|
139
134
|
help="none|low|medium|high|critical|any (repo mode).",
|
|
140
135
|
),
|
|
136
|
+
fail_on_unknown: bool = typer.Option(
|
|
137
|
+
False, "--fail-on-unknown", help="Also fail on unreadable signals (repo mode)."
|
|
138
|
+
),
|
|
141
139
|
force_notify: bool = typer.Option(
|
|
142
140
|
False, "--force-notify", help="Post to Slack regardless of report_day."
|
|
143
141
|
),
|
|
@@ -250,6 +248,7 @@ def report(
|
|
|
250
248
|
|
|
251
249
|
if mode is runner.Mode.ORG:
|
|
252
250
|
assert cfg is not None
|
|
251
|
+
boundary.reject_repo_only(console, {"--fail-on-unknown": fail_on_unknown})
|
|
253
252
|
boundary.check_releases_exclude(console, cfg, releases_exclude)
|
|
254
253
|
options = OrgRunOptions(
|
|
255
254
|
output_dir=Path(output_dir) if output_dir else None,
|
|
@@ -272,29 +271,25 @@ def report(
|
|
|
272
271
|
# into the run, so what repo mode accepts is what repo mode applies.
|
|
273
272
|
# The run-store flags are among the refused: one repository's week is
|
|
274
273
|
# read afresh each time, so they would be accepted and do nothing.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
"--refresh-runs": refresh_runs,
|
|
295
|
-
}
|
|
296
|
-
),
|
|
297
|
-
)
|
|
274
|
+
org_only = {
|
|
275
|
+
"--output-dir": output_dir is not None,
|
|
276
|
+
"--pages-url": pages_url is not None,
|
|
277
|
+
"--slack-channel": slack_channel is not None,
|
|
278
|
+
"--force-notify": force_notify,
|
|
279
|
+
"--top-n-slack": top_n_slack is not None,
|
|
280
|
+
"--repo-min-age-days": repo_min_age_days is not None,
|
|
281
|
+
"--release-max-age-days": release_max_age_days is not None,
|
|
282
|
+
"--releases-exclude": bool(releases_exclude),
|
|
283
|
+
"--no-gating": no_gating,
|
|
284
|
+
"--include-archived": include_archived,
|
|
285
|
+
"--include-test": include_test,
|
|
286
|
+
"--graph-batch": graph_batch is not None,
|
|
287
|
+
"--concurrency": concurrency is not None,
|
|
288
|
+
"--no-run-cache": no_run_cache,
|
|
289
|
+
"--run-cache-dir": run_cache_dir is not None,
|
|
290
|
+
"--refresh-runs": refresh_runs,
|
|
291
|
+
}
|
|
292
|
+
boundary.reject_org_only(console, org_only)
|
|
298
293
|
code = boundary.run_guarded(
|
|
299
294
|
console,
|
|
300
295
|
_run_repo(
|
|
@@ -303,6 +298,7 @@ def report(
|
|
|
303
298
|
token_env=token_env or "GITHUB_TOKEN",
|
|
304
299
|
console=console,
|
|
305
300
|
fail_threshold=fail_threshold,
|
|
301
|
+
fail_on_unknown=fail_on_unknown,
|
|
306
302
|
report_cfg=cfg.report if cfg is not None else None,
|
|
307
303
|
limits=limits,
|
|
308
304
|
hidden=hidden,
|