github-security-report 0.23.1__tar.gz → 0.24.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.23.1 → github_security_report-0.24.0}/PKG-INFO +124 -31
- {github_security_report-0.23.1 → github_security_report-0.24.0}/README.md +123 -30
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/_version.py +2 -2
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/categories/__init__.py +0 -10
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/__init__.py +7 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/app.py +5 -4
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/boundary.py +23 -0
- github_security_report-0.24.0/src/github_security_report/cli/config_cmd.py +184 -0
- github_security_report-0.24.0/src/github_security_report/cli/config_source.py +88 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/modes.py +21 -4
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/outputs.py +3 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/serialise.py +15 -6
- github_security_report-0.24.0/src/github_security_report/collect/exclusions.py +114 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/extras.py +112 -61
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/org.py +18 -1
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/scoping.py +4 -3
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/config/__init__.py +4 -2
- github_security_report-0.24.0/src/github_security_report/config/blocks.py +394 -0
- github_security_report-0.24.0/src/github_security_report/config/dictionary.py +273 -0
- github_security_report-0.24.0/src/github_security_report/config/errors.py +257 -0
- github_security_report-0.24.0/src/github_security_report/config/key_notes.py +207 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/config/loader.py +137 -46
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/config/models.py +42 -91
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/config/order.py +65 -23
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/config/schema.py +61 -22
- github_security_report-0.24.0/src/github_security_report/config/workflow_runs.py +84 -0
- github_security_report-0.24.0/src/github_security_report/matching.py +52 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/posture/releases.py +12 -8
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/html.py +10 -8
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/markdown.py +10 -8
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/slack.py +8 -8
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/terminal.py +11 -12
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/report/__init__.py +8 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/report/aggregate.py +28 -9
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/report/display.py +42 -14
- github_security_report-0.24.0/src/github_security_report/report/exclusions.py +63 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/report/signals.py +7 -10
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/report/tables.py +5 -9
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/scope.py +9 -7
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/summary.py +12 -9
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/templates/report.html.j2 +1 -0
- github_security_report-0.23.1/src/github_security_report/config/blocks.py +0 -298
- {github_security_report-0.23.1 → github_security_report-0.24.0}/.gitignore +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/LICENSE +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/LICENSES/Apache-2.0.txt +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/pyproject.toml +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/scripts/README.md +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/authors.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/categories/keys.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/categories/signals.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/categories/tables.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/classify.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/__main__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/options.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/progress.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/publish.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/remediation.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/cli/summary.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/accounting.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/alerts.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/analyses.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/batch_errors.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/codeql_parsers.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/copilot.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/endpoints.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/errors.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/events.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/failures.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/org_reads.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/paging.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/parsers.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/queries.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/reads.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/repo_parser.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/reviews.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/transport.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/workflow_runs.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/client/writes.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/code_quality.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/codeql/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/codeql/cleanup.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/codeql/facts.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/codeql/tables.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/codeql.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/context.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/graph.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/protocols.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/repo.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/run_sync.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/collect/workflow_runs.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/gating.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/gitctx.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/issue_presentation.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/issues.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/layout.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/malware.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/models.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/ordering.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/posture/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/posture/enablement.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/posture/facts.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/posture/quality.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/pulls/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/pulls/columns.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/pulls/counting.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/pulls/presentation.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/pulls/table.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/py.typed +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/ranking.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/remediate/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/remediate/codeql.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/remediate/model.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/slack_limits.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/slack_text.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/render/terminal_notices.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/rulesets.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/runner.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/secret_patterns.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/severity.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/templates/index.html.j2 +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/workflow_runs/__init__.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/workflow_runs/aggregate.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/workflow_runs/models.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/workflow_runs/store.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/workflow_runs/store_codec.py +0 -0
- {github_security_report-0.23.1 → github_security_report-0.24.0}/src/github_security_report/workflow_runs/tables.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.24.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
|
|
@@ -76,7 +76,8 @@ states and rendered worst-first:
|
|
|
76
76
|
|
|
77
77
|
Every category renders the same **standardised summary footer** beneath its
|
|
78
78
|
table: remediation-first count lines (failures, disabled, unknown, then the
|
|
79
|
-
healthy pass line, then
|
|
79
|
+
healthy pass line, then the test repositories and other repositories it
|
|
80
|
+
excluded). A category may add a note qualifying the
|
|
80
81
|
pass line (Code Quality's per-language breakdown) and a **Not applicable**
|
|
81
82
|
count, both shown on every surface. The pass line reads **"All <state>"** when
|
|
82
83
|
nothing needs attention, or **"N <state>"** otherwise. The terminal and Slack
|
|
@@ -200,8 +201,8 @@ tables (org mode):
|
|
|
200
201
|
enabled count out of the applicable count per language, such as
|
|
201
202
|
`python 30/32 · go 5/5 · javascript-typescript 10/12`. See
|
|
202
203
|
[ADR-0006](docs/adr/0006-github-code-quality.md); hide it with the
|
|
203
|
-
`code_quality` render toggle, or leave
|
|
204
|
-
with its `
|
|
204
|
+
`code_quality` render toggle, or leave test repositories out of it alone
|
|
205
|
+
with its `exclude_tests` patterns (see [Per-category exclusions](#per-category-exclusions)).
|
|
205
206
|
- **Workflow Failures** — repositories whose GitHub Actions workflows failed
|
|
206
207
|
in the window, ranked by failed runs. The motivating case is the bulk
|
|
207
208
|
Dependabot merge whose integration tests need credentials, so they run
|
|
@@ -435,7 +436,10 @@ its checkout on `PATH`.
|
|
|
435
436
|
Configuration is JSON, supplied as a plain `vars.` entry or base64-encoded in a
|
|
436
437
|
`secrets.` entry (base64 only to stop JSON braces tripping GitHub's log
|
|
437
438
|
redaction — it is encoding, not encryption). Tokens are referenced by
|
|
438
|
-
environment-variable name, never embedded.
|
|
439
|
+
environment-variable name, never embedded. `github-security-report config keys`
|
|
440
|
+
lists every key with its type, default and description, and
|
|
441
|
+
`github-security-report config check` validates a configuration before a run
|
|
442
|
+
(see [Checking a configuration](#checking-a-configuration)).
|
|
439
443
|
|
|
440
444
|
```json
|
|
441
445
|
{
|
|
@@ -518,25 +522,35 @@ organisation, as `--top-n` does.
|
|
|
518
522
|
|
|
519
523
|
The per-org `exclude` list removes repositories from analysis entirely; they are
|
|
520
524
|
reported as **excluded** (distinct from "not enabled"), so an intentional
|
|
521
|
-
exclusion is visible rather than silently dropped.
|
|
522
|
-
|
|
525
|
+
exclusion is visible rather than silently dropped. Every exclusion list in the
|
|
526
|
+
configuration (`exclude`, `releases_exclude` and the
|
|
527
|
+
[per-category lists](#per-category-exclusions)) holds name patterns: regular
|
|
528
|
+
expressions *searched* against the repository name, case-insensitively, as
|
|
529
|
+
GitHub compares names. `^test-` is the prefix it looks like, a plain name
|
|
530
|
+
matches itself (and any name containing it), and `^name$` pins one repository
|
|
531
|
+
exactly. A pattern that does not compile, or an empty one, is a configuration
|
|
532
|
+
error naming the list and the pattern; `--releases-exclude` takes the same
|
|
533
|
+
patterns and refuses the same two, exiting 2 before any collection starts.
|
|
523
534
|
|
|
524
535
|
Every category reports those exclusions beneath its counts, so an
|
|
525
536
|
organisation-wide list repeats under each one. `report.excluded_display`
|
|
526
|
-
governs that line on every surface
|
|
537
|
+
governs that line on every surface, and `report.excluded_names` (default
|
|
538
|
+
`true`) whether it names the repositories beneath the count or counts them
|
|
539
|
+
alone:
|
|
527
540
|
|
|
528
541
|
| Value | Excluded line |
|
|
529
542
|
| ----- | ------------- |
|
|
530
543
|
| `always-show` (default) | Shown under every category |
|
|
531
544
|
| `always-hide` | Never shown |
|
|
532
|
-
| `conditional-hide` | Shown only for a category whose exclusions differ from the
|
|
545
|
+
| `conditional-hide` | Shown only for a category whose exclusions differ from the report-wide baseline, and then in full |
|
|
533
546
|
|
|
547
|
+
The baseline is what a category with no list of its own reports: the
|
|
548
|
+
organisation's `exclude` list plus any report-wide `report.exclude` patterns.
|
|
534
549
|
Hiding the line changes nothing else: every count is unaffected, and the report
|
|
535
550
|
header's repository count already leaves excluded repositories out. So a clean
|
|
536
|
-
category reads `All Clean` once no Excluded line qualifies it.
|
|
537
|
-
|
|
538
|
-
(see [Per-category exclusions](#per-category-exclusions))
|
|
539
|
-
`conditional-hide` the line survives only beneath such a category. The
|
|
551
|
+
category reads `All Clean` once no Excluded line qualifies it. With
|
|
552
|
+
`conditional-hide` the line survives only beneath a category whose own list
|
|
553
|
+
makes it differ (see [Per-category exclusions](#per-category-exclusions)). The
|
|
540
554
|
`report.json` artifact always lists the exclusions.
|
|
541
555
|
|
|
542
556
|
Archived and test repositories are excluded from analysis by default. Opt them
|
|
@@ -690,37 +704,75 @@ render as a name list rather than a one-column table on every surface. The
|
|
|
690
704
|
|
|
691
705
|
### Per-category exclusions
|
|
692
706
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
707
|
+
Beyond the organisation's `exclude` list, which removes a repository from
|
|
708
|
+
analysis altogether, every category can leave repositories out that the
|
|
709
|
+
others still report. Two classes of name pattern (see
|
|
710
|
+
[Configuration](#configuration)) share one mechanism, differing only in how
|
|
711
|
+
the footer reports them:
|
|
712
|
+
|
|
713
|
+
| Config list | Footer line | Default display |
|
|
714
|
+
| ----------- | ----------- | --------------- |
|
|
715
|
+
| `exclude` | ⏩ **Excluded**, merged with the organisation's own `exclude` list | Shown, repositories named |
|
|
716
|
+
| `exclude_tests` | 🧪 **Test repositories excluded**, a line of its own | Shown, counted but not named |
|
|
717
|
+
|
|
718
|
+
Both lists exist **report-wide** (`report.exclude`, `report.exclude_tests`,
|
|
719
|
+
applying to every category) and **per category**
|
|
720
|
+
(`report.categories.<key>.exclude` / `.exclude_tests`), where a category's
|
|
721
|
+
list *replaces* the inherited one, as every other `categories` key does; an
|
|
722
|
+
organisation's own `report` block replaces it the same way. Unlike the
|
|
723
|
+
organisation's list, these repositories are still analysed, so one category can
|
|
724
|
+
keep reporting what another leaves out. A repository matching both lists of a
|
|
725
|
+
category counts once, as a test repository.
|
|
726
|
+
|
|
727
|
+
The motivating case is Code Quality, which is billed per committer: an
|
|
728
|
+
organisation that reports its test repositories (`include_test`) still has no
|
|
729
|
+
reason to pay for scanning them, and wants the section to list only the
|
|
700
730
|
repositories worth switching on:
|
|
701
731
|
|
|
702
732
|
```json
|
|
703
733
|
{
|
|
704
734
|
"report": {
|
|
705
735
|
"include_test": true,
|
|
736
|
+
"excluded_display": "conditional-hide",
|
|
706
737
|
"categories": {
|
|
707
|
-
"code_quality": { "
|
|
738
|
+
"code_quality": { "exclude_tests": ["^test-"] }
|
|
708
739
|
}
|
|
709
740
|
},
|
|
710
741
|
"organizations": [{ "name": "lfreleng-actions" }]
|
|
711
742
|
}
|
|
712
743
|
```
|
|
713
744
|
|
|
745
|
+
```text
|
|
746
|
+
Code Quality
|
|
747
|
+
✅ 72 Enabled
|
|
748
|
+
📊 Enabled by language: python 57/57 · go 3/3 · javascript-typescript 25/25
|
|
749
|
+
➖ 60 Not applicable
|
|
750
|
+
🧪 12 Test repositories excluded
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
The test line governs its own display, symmetric with the general one:
|
|
754
|
+
|
|
755
|
+
| Key | Values | Default |
|
|
756
|
+
| --- | ------ | ------- |
|
|
757
|
+
| `report.excluded_display` | `always-show` / `always-hide` / `conditional-hide` | `always-show` |
|
|
758
|
+
| `report.excluded_names` | Boolean: list names beneath the count | `true` |
|
|
759
|
+
| `report.excluded_tests_display` | `always-show` / `always-hide` / `conditional-hide` | `always-show` |
|
|
760
|
+
| `report.excluded_tests_names` | Boolean: list names beneath the count | `false` |
|
|
761
|
+
|
|
762
|
+
`conditional-hide` compares a category's list with the report-wide baseline of
|
|
763
|
+
the same class, so a line survives only beneath a category whose own list
|
|
764
|
+
differs: above, only Code Quality shows its test line.
|
|
765
|
+
|
|
714
766
|
An excluded repository is neither a row nor a count in that category, and
|
|
715
|
-
`remediate
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
767
|
+
`remediate` never writes to it: `remediate --category code_quality` reports
|
|
768
|
+
nothing to remediate for the test repositories above. Naming a repository with
|
|
769
|
+
`--repos` opts it in for that run, so `remediate --category code_quality
|
|
770
|
+
--repos test-go-project` would enable Code Quality there; the organisation's
|
|
771
|
+
own `exclude` list still refuses it. `report.json` carries the baselines under
|
|
772
|
+
`excluded` (general) and `excluded_tests`, and each category whose lists make
|
|
773
|
+
it differ under `category_excluded` and `category_excluded_tests`, with its
|
|
774
|
+
full list. The Workflow Failures detail table covers the same repositories as
|
|
775
|
+
its parent and reports the same exclusions; its own lists are not read.
|
|
724
776
|
|
|
725
777
|
### Per-category row ordering
|
|
726
778
|
|
|
@@ -1844,6 +1896,44 @@ via `token_env` (e.g. `LFRELENG_ACTIONS_REPORT_PAT`, exported in your shell or s
|
|
|
1844
1896
|
from a secrets file) — the channel ID is the only Slack value the file holds,
|
|
1845
1897
|
and the Slack **bot token** is consumed by the workflow, not the CLI.
|
|
1846
1898
|
|
|
1899
|
+
### Checking a configuration
|
|
1900
|
+
|
|
1901
|
+
`config check` reads a configuration the way `report` does — a path, then
|
|
1902
|
+
`--config-data`, then the per-user file above — and validates it without
|
|
1903
|
+
touching GitHub. An empty `--config-data`, such as an unset variable, fails
|
|
1904
|
+
the check rather than falling through to the per-user file. `config check`
|
|
1905
|
+
exits `0` for a valid configuration and `2` otherwise:
|
|
1906
|
+
|
|
1907
|
+
```bash
|
|
1908
|
+
github-security-report config check ~/.config/github-security-report/config.json
|
|
1909
|
+
github-security-report config check --config-data "$CONFIG_B64"
|
|
1910
|
+
```
|
|
1911
|
+
|
|
1912
|
+
A configuration with problems lists every one, each by its dotted path, rather
|
|
1913
|
+
than stopping at the first:
|
|
1914
|
+
|
|
1915
|
+
<!-- markdownlint-disable MD013 -->
|
|
1916
|
+
```text
|
|
1917
|
+
Configuration config.json is invalid:
|
|
1918
|
+
organizations[0]: unknown key "exclde" (did you mean "exclude"?); valid keys: name, token_env, exclude, releases_exclude, slack, report
|
|
1919
|
+
report.top_n: expected an integer, got "ten"
|
|
1920
|
+
(github-security-report 0.23.1; a key added in a later release needs an upgrade)
|
|
1921
|
+
```
|
|
1922
|
+
<!-- markdownlint-enable MD013 -->
|
|
1923
|
+
|
|
1924
|
+
`report` and `remediate` print the same message, in red, and exit `2` without a
|
|
1925
|
+
traceback; `--verbose` adds the underlying exception. A deprecated key is still
|
|
1926
|
+
valid: `config check` names it and its replacement, then reports the
|
|
1927
|
+
configuration valid.
|
|
1928
|
+
|
|
1929
|
+
`config keys` lists the keys a configuration takes, generated from the same
|
|
1930
|
+
schema the loader validates against. Give it a dotted path to see one block:
|
|
1931
|
+
|
|
1932
|
+
```bash
|
|
1933
|
+
github-security-report config keys
|
|
1934
|
+
github-security-report config keys report.categories.code_quality
|
|
1935
|
+
```
|
|
1936
|
+
|
|
1847
1937
|
## Inputs
|
|
1848
1938
|
|
|
1849
1939
|
<!-- markdownlint-disable MD013 -->
|
|
@@ -2043,7 +2133,10 @@ a typo), or one that matches only repositories the configuration excludes
|
|
|
2043
2133
|
(the `exclude` list, archived, fork, template or test), stops the run with
|
|
2044
2134
|
exit code 2 and says which. A bare name excluded in one organisation but in
|
|
2045
2135
|
scope in another runs against the in-scope one only; naming a repository never
|
|
2046
|
-
brings an excluded one back. A
|
|
2136
|
+
brings an excluded one back. A named repository is opted in to every
|
|
2137
|
+
category's `exclude` and `exclude_tests` patterns for the run, since naming it
|
|
2138
|
+
is the request (see [Per-category exclusions](#per-category-exclusions)). A
|
|
2139
|
+
`--repos` value that names nothing also stops
|
|
2047
2140
|
the run, rather than falling back to every repository. The run then collects
|
|
2048
2141
|
exactly the repositories that check validated, without listing the
|
|
2049
2142
|
organisation again, and prints `Limited to:` beneath its heading.
|
|
@@ -32,7 +32,8 @@ states and rendered worst-first:
|
|
|
32
32
|
|
|
33
33
|
Every category renders the same **standardised summary footer** beneath its
|
|
34
34
|
table: remediation-first count lines (failures, disabled, unknown, then the
|
|
35
|
-
healthy pass line, then
|
|
35
|
+
healthy pass line, then the test repositories and other repositories it
|
|
36
|
+
excluded). A category may add a note qualifying the
|
|
36
37
|
pass line (Code Quality's per-language breakdown) and a **Not applicable**
|
|
37
38
|
count, both shown on every surface. The pass line reads **"All <state>"** when
|
|
38
39
|
nothing needs attention, or **"N <state>"** otherwise. The terminal and Slack
|
|
@@ -156,8 +157,8 @@ tables (org mode):
|
|
|
156
157
|
enabled count out of the applicable count per language, such as
|
|
157
158
|
`python 30/32 · go 5/5 · javascript-typescript 10/12`. See
|
|
158
159
|
[ADR-0006](docs/adr/0006-github-code-quality.md); hide it with the
|
|
159
|
-
`code_quality` render toggle, or leave
|
|
160
|
-
with its `
|
|
160
|
+
`code_quality` render toggle, or leave test repositories out of it alone
|
|
161
|
+
with its `exclude_tests` patterns (see [Per-category exclusions](#per-category-exclusions)).
|
|
161
162
|
- **Workflow Failures** — repositories whose GitHub Actions workflows failed
|
|
162
163
|
in the window, ranked by failed runs. The motivating case is the bulk
|
|
163
164
|
Dependabot merge whose integration tests need credentials, so they run
|
|
@@ -391,7 +392,10 @@ its checkout on `PATH`.
|
|
|
391
392
|
Configuration is JSON, supplied as a plain `vars.` entry or base64-encoded in a
|
|
392
393
|
`secrets.` entry (base64 only to stop JSON braces tripping GitHub's log
|
|
393
394
|
redaction — it is encoding, not encryption). Tokens are referenced by
|
|
394
|
-
environment-variable name, never embedded.
|
|
395
|
+
environment-variable name, never embedded. `github-security-report config keys`
|
|
396
|
+
lists every key with its type, default and description, and
|
|
397
|
+
`github-security-report config check` validates a configuration before a run
|
|
398
|
+
(see [Checking a configuration](#checking-a-configuration)).
|
|
395
399
|
|
|
396
400
|
```json
|
|
397
401
|
{
|
|
@@ -474,25 +478,35 @@ organisation, as `--top-n` does.
|
|
|
474
478
|
|
|
475
479
|
The per-org `exclude` list removes repositories from analysis entirely; they are
|
|
476
480
|
reported as **excluded** (distinct from "not enabled"), so an intentional
|
|
477
|
-
exclusion is visible rather than silently dropped.
|
|
478
|
-
|
|
481
|
+
exclusion is visible rather than silently dropped. Every exclusion list in the
|
|
482
|
+
configuration (`exclude`, `releases_exclude` and the
|
|
483
|
+
[per-category lists](#per-category-exclusions)) holds name patterns: regular
|
|
484
|
+
expressions *searched* against the repository name, case-insensitively, as
|
|
485
|
+
GitHub compares names. `^test-` is the prefix it looks like, a plain name
|
|
486
|
+
matches itself (and any name containing it), and `^name$` pins one repository
|
|
487
|
+
exactly. A pattern that does not compile, or an empty one, is a configuration
|
|
488
|
+
error naming the list and the pattern; `--releases-exclude` takes the same
|
|
489
|
+
patterns and refuses the same two, exiting 2 before any collection starts.
|
|
479
490
|
|
|
480
491
|
Every category reports those exclusions beneath its counts, so an
|
|
481
492
|
organisation-wide list repeats under each one. `report.excluded_display`
|
|
482
|
-
governs that line on every surface
|
|
493
|
+
governs that line on every surface, and `report.excluded_names` (default
|
|
494
|
+
`true`) whether it names the repositories beneath the count or counts them
|
|
495
|
+
alone:
|
|
483
496
|
|
|
484
497
|
| Value | Excluded line |
|
|
485
498
|
| ----- | ------------- |
|
|
486
499
|
| `always-show` (default) | Shown under every category |
|
|
487
500
|
| `always-hide` | Never shown |
|
|
488
|
-
| `conditional-hide` | Shown only for a category whose exclusions differ from the
|
|
501
|
+
| `conditional-hide` | Shown only for a category whose exclusions differ from the report-wide baseline, and then in full |
|
|
489
502
|
|
|
503
|
+
The baseline is what a category with no list of its own reports: the
|
|
504
|
+
organisation's `exclude` list plus any report-wide `report.exclude` patterns.
|
|
490
505
|
Hiding the line changes nothing else: every count is unaffected, and the report
|
|
491
506
|
header's repository count already leaves excluded repositories out. So a clean
|
|
492
|
-
category reads `All Clean` once no Excluded line qualifies it.
|
|
493
|
-
|
|
494
|
-
(see [Per-category exclusions](#per-category-exclusions))
|
|
495
|
-
`conditional-hide` the line survives only beneath such a category. The
|
|
507
|
+
category reads `All Clean` once no Excluded line qualifies it. With
|
|
508
|
+
`conditional-hide` the line survives only beneath a category whose own list
|
|
509
|
+
makes it differ (see [Per-category exclusions](#per-category-exclusions)). The
|
|
496
510
|
`report.json` artifact always lists the exclusions.
|
|
497
511
|
|
|
498
512
|
Archived and test repositories are excluded from analysis by default. Opt them
|
|
@@ -646,37 +660,75 @@ render as a name list rather than a one-column table on every surface. The
|
|
|
646
660
|
|
|
647
661
|
### Per-category exclusions
|
|
648
662
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
663
|
+
Beyond the organisation's `exclude` list, which removes a repository from
|
|
664
|
+
analysis altogether, every category can leave repositories out that the
|
|
665
|
+
others still report. Two classes of name pattern (see
|
|
666
|
+
[Configuration](#configuration)) share one mechanism, differing only in how
|
|
667
|
+
the footer reports them:
|
|
668
|
+
|
|
669
|
+
| Config list | Footer line | Default display |
|
|
670
|
+
| ----------- | ----------- | --------------- |
|
|
671
|
+
| `exclude` | ⏩ **Excluded**, merged with the organisation's own `exclude` list | Shown, repositories named |
|
|
672
|
+
| `exclude_tests` | 🧪 **Test repositories excluded**, a line of its own | Shown, counted but not named |
|
|
673
|
+
|
|
674
|
+
Both lists exist **report-wide** (`report.exclude`, `report.exclude_tests`,
|
|
675
|
+
applying to every category) and **per category**
|
|
676
|
+
(`report.categories.<key>.exclude` / `.exclude_tests`), where a category's
|
|
677
|
+
list *replaces* the inherited one, as every other `categories` key does; an
|
|
678
|
+
organisation's own `report` block replaces it the same way. Unlike the
|
|
679
|
+
organisation's list, these repositories are still analysed, so one category can
|
|
680
|
+
keep reporting what another leaves out. A repository matching both lists of a
|
|
681
|
+
category counts once, as a test repository.
|
|
682
|
+
|
|
683
|
+
The motivating case is Code Quality, which is billed per committer: an
|
|
684
|
+
organisation that reports its test repositories (`include_test`) still has no
|
|
685
|
+
reason to pay for scanning them, and wants the section to list only the
|
|
656
686
|
repositories worth switching on:
|
|
657
687
|
|
|
658
688
|
```json
|
|
659
689
|
{
|
|
660
690
|
"report": {
|
|
661
691
|
"include_test": true,
|
|
692
|
+
"excluded_display": "conditional-hide",
|
|
662
693
|
"categories": {
|
|
663
|
-
"code_quality": { "
|
|
694
|
+
"code_quality": { "exclude_tests": ["^test-"] }
|
|
664
695
|
}
|
|
665
696
|
},
|
|
666
697
|
"organizations": [{ "name": "lfreleng-actions" }]
|
|
667
698
|
}
|
|
668
699
|
```
|
|
669
700
|
|
|
701
|
+
```text
|
|
702
|
+
Code Quality
|
|
703
|
+
✅ 72 Enabled
|
|
704
|
+
📊 Enabled by language: python 57/57 · go 3/3 · javascript-typescript 25/25
|
|
705
|
+
➖ 60 Not applicable
|
|
706
|
+
🧪 12 Test repositories excluded
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
The test line governs its own display, symmetric with the general one:
|
|
710
|
+
|
|
711
|
+
| Key | Values | Default |
|
|
712
|
+
| --- | ------ | ------- |
|
|
713
|
+
| `report.excluded_display` | `always-show` / `always-hide` / `conditional-hide` | `always-show` |
|
|
714
|
+
| `report.excluded_names` | Boolean: list names beneath the count | `true` |
|
|
715
|
+
| `report.excluded_tests_display` | `always-show` / `always-hide` / `conditional-hide` | `always-show` |
|
|
716
|
+
| `report.excluded_tests_names` | Boolean: list names beneath the count | `false` |
|
|
717
|
+
|
|
718
|
+
`conditional-hide` compares a category's list with the report-wide baseline of
|
|
719
|
+
the same class, so a line survives only beneath a category whose own list
|
|
720
|
+
differs: above, only Code Quality shows its test line.
|
|
721
|
+
|
|
670
722
|
An excluded repository is neither a row nor a count in that category, and
|
|
671
|
-
`remediate
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
723
|
+
`remediate` never writes to it: `remediate --category code_quality` reports
|
|
724
|
+
nothing to remediate for the test repositories above. Naming a repository with
|
|
725
|
+
`--repos` opts it in for that run, so `remediate --category code_quality
|
|
726
|
+
--repos test-go-project` would enable Code Quality there; the organisation's
|
|
727
|
+
own `exclude` list still refuses it. `report.json` carries the baselines under
|
|
728
|
+
`excluded` (general) and `excluded_tests`, and each category whose lists make
|
|
729
|
+
it differ under `category_excluded` and `category_excluded_tests`, with its
|
|
730
|
+
full list. The Workflow Failures detail table covers the same repositories as
|
|
731
|
+
its parent and reports the same exclusions; its own lists are not read.
|
|
680
732
|
|
|
681
733
|
### Per-category row ordering
|
|
682
734
|
|
|
@@ -1800,6 +1852,44 @@ via `token_env` (e.g. `LFRELENG_ACTIONS_REPORT_PAT`, exported in your shell or s
|
|
|
1800
1852
|
from a secrets file) — the channel ID is the only Slack value the file holds,
|
|
1801
1853
|
and the Slack **bot token** is consumed by the workflow, not the CLI.
|
|
1802
1854
|
|
|
1855
|
+
### Checking a configuration
|
|
1856
|
+
|
|
1857
|
+
`config check` reads a configuration the way `report` does — a path, then
|
|
1858
|
+
`--config-data`, then the per-user file above — and validates it without
|
|
1859
|
+
touching GitHub. An empty `--config-data`, such as an unset variable, fails
|
|
1860
|
+
the check rather than falling through to the per-user file. `config check`
|
|
1861
|
+
exits `0` for a valid configuration and `2` otherwise:
|
|
1862
|
+
|
|
1863
|
+
```bash
|
|
1864
|
+
github-security-report config check ~/.config/github-security-report/config.json
|
|
1865
|
+
github-security-report config check --config-data "$CONFIG_B64"
|
|
1866
|
+
```
|
|
1867
|
+
|
|
1868
|
+
A configuration with problems lists every one, each by its dotted path, rather
|
|
1869
|
+
than stopping at the first:
|
|
1870
|
+
|
|
1871
|
+
<!-- markdownlint-disable MD013 -->
|
|
1872
|
+
```text
|
|
1873
|
+
Configuration config.json is invalid:
|
|
1874
|
+
organizations[0]: unknown key "exclde" (did you mean "exclude"?); valid keys: name, token_env, exclude, releases_exclude, slack, report
|
|
1875
|
+
report.top_n: expected an integer, got "ten"
|
|
1876
|
+
(github-security-report 0.23.1; a key added in a later release needs an upgrade)
|
|
1877
|
+
```
|
|
1878
|
+
<!-- markdownlint-enable MD013 -->
|
|
1879
|
+
|
|
1880
|
+
`report` and `remediate` print the same message, in red, and exit `2` without a
|
|
1881
|
+
traceback; `--verbose` adds the underlying exception. A deprecated key is still
|
|
1882
|
+
valid: `config check` names it and its replacement, then reports the
|
|
1883
|
+
configuration valid.
|
|
1884
|
+
|
|
1885
|
+
`config keys` lists the keys a configuration takes, generated from the same
|
|
1886
|
+
schema the loader validates against. Give it a dotted path to see one block:
|
|
1887
|
+
|
|
1888
|
+
```bash
|
|
1889
|
+
github-security-report config keys
|
|
1890
|
+
github-security-report config keys report.categories.code_quality
|
|
1891
|
+
```
|
|
1892
|
+
|
|
1803
1893
|
## Inputs
|
|
1804
1894
|
|
|
1805
1895
|
<!-- markdownlint-disable MD013 -->
|
|
@@ -1999,7 +2089,10 @@ a typo), or one that matches only repositories the configuration excludes
|
|
|
1999
2089
|
(the `exclude` list, archived, fork, template or test), stops the run with
|
|
2000
2090
|
exit code 2 and says which. A bare name excluded in one organisation but in
|
|
2001
2091
|
scope in another runs against the in-scope one only; naming a repository never
|
|
2002
|
-
brings an excluded one back. A
|
|
2092
|
+
brings an excluded one back. A named repository is opted in to every
|
|
2093
|
+
category's `exclude` and `exclude_tests` patterns for the run, since naming it
|
|
2094
|
+
is the request (see [Per-category exclusions](#per-category-exclusions)). A
|
|
2095
|
+
`--repos` value that names nothing also stops
|
|
2003
2096
|
the run, rather than falling back to every repository. The run then collects
|
|
2004
2097
|
exactly the repositories that check validated, without listing the
|
|
2005
2098
|
organisation again, and prints `Limited to:` beneath its heading.
|
|
@@ -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.24.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 24, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -24,7 +24,6 @@ from github_security_report.categories.signals import SIGNAL_CATEGORIES
|
|
|
24
24
|
from github_security_report.categories.tables import TABLE_CATEGORIES
|
|
25
25
|
|
|
26
26
|
__all__ = [
|
|
27
|
-
"EXCLUDABLE_CATEGORIES",
|
|
28
27
|
"NESTED_CATEGORIES",
|
|
29
28
|
"REPO_LIST_CATEGORIES",
|
|
30
29
|
"CategoryKey",
|
|
@@ -77,15 +76,6 @@ REPO_LIST_CATEGORIES: frozenset[CategoryKey] = frozenset(
|
|
|
77
76
|
)
|
|
78
77
|
|
|
79
78
|
|
|
80
|
-
# Categories that take an ``exclude`` list of their own, dropping repositories
|
|
81
|
-
# from that one category while every other still reports them. A repository
|
|
82
|
-
# excluded this way is counted on the category's Excluded footer line, so the
|
|
83
|
-
# omission stays visible, and remediation never writes it. Only the categories
|
|
84
|
-
# whose builders apply the list are named: the schema refuses it anywhere else,
|
|
85
|
-
# where it would validate and then do nothing.
|
|
86
|
-
EXCLUDABLE_CATEGORIES: frozenset[CategoryKey] = frozenset({CategoryKey.CODE_QUALITY})
|
|
87
|
-
|
|
88
|
-
|
|
89
79
|
def orderable_categories() -> tuple[CategoryMeta, ...]:
|
|
90
80
|
"""Categories an ordering list may name, in registry order.
|
|
91
81
|
|
|
@@ -11,6 +11,8 @@ The command surface is split across:
|
|
|
11
11
|
|
|
12
12
|
- :mod:`cli.app` -- the Typer application, options and validation
|
|
13
13
|
- :mod:`cli.modes` -- the org, repo and remediate run modes
|
|
14
|
+
- :mod:`cli.config_cmd` -- the ``config check`` and ``config keys`` commands
|
|
15
|
+
- :mod:`cli.config_source` -- reading a configuration, reporting its errors
|
|
14
16
|
- :mod:`cli.options` -- what a run takes from the command line
|
|
15
17
|
- :mod:`cli.publish` -- the Pages files, Slack digest and job summary
|
|
16
18
|
- :mod:`cli.outputs` -- offender limits, category visibility, file writing
|
|
@@ -26,6 +28,7 @@ from github_security_report.cli.app import (
|
|
|
26
28
|
remediate,
|
|
27
29
|
report,
|
|
28
30
|
)
|
|
31
|
+
from github_security_report.cli.config_cmd import config_app
|
|
29
32
|
from github_security_report.cli.modes import (
|
|
30
33
|
_abort_auth,
|
|
31
34
|
_abort_network,
|
|
@@ -43,6 +46,10 @@ from github_security_report.cli.outputs import (
|
|
|
43
46
|
)
|
|
44
47
|
from github_security_report.cli.serialise import _org_to_dict, _table_to_dict
|
|
45
48
|
|
|
49
|
+
# Registered here rather than in cli.app, which holds the run commands; the
|
|
50
|
+
# entry point is this package's ``app``, so the group is always present.
|
|
51
|
+
app.add_typer(config_app, name="config")
|
|
52
|
+
|
|
46
53
|
# The package façade: every name the module split moved is still importable
|
|
47
54
|
# from ``github_security_report.cli``, including the private helpers the tests
|
|
48
55
|
# reach for, so relocating a definition changes no caller's import path.
|
|
@@ -155,7 +155,7 @@ def report(
|
|
|
155
155
|
releases_exclude: list[str] | None = typer.Option(
|
|
156
156
|
None,
|
|
157
157
|
"--releases-exclude",
|
|
158
|
-
help="Repository name to omit from the Releases/Tagging table (repeatable; replaces the configured list, so it is refused when the run covers more than one organisation).",
|
|
158
|
+
help="Repository name pattern to omit from the Releases/Tagging table: a regular expression searched case-insensitively (repeatable; replaces the configured list, so it is refused when the run covers more than one organisation).",
|
|
159
159
|
),
|
|
160
160
|
hide: list[str] | None = typer.Option(
|
|
161
161
|
None,
|
|
@@ -227,6 +227,7 @@ def report(
|
|
|
227
227
|
console, "--concurrency", concurrency, maximum=CONCURRENCY_MAX
|
|
228
228
|
)
|
|
229
229
|
hidden = boundary.resolve_hidden(console, hide)
|
|
230
|
+
boundary.check_patterns(console, "--releases-exclude", releases_exclude)
|
|
230
231
|
overrides = ReportOverrides(
|
|
231
232
|
repo_min_age_days=repo_min_age_days,
|
|
232
233
|
release_max_age_days=release_max_age_days,
|
|
@@ -243,7 +244,7 @@ def report(
|
|
|
243
244
|
run_cache_dir=run_cache_dir,
|
|
244
245
|
)
|
|
245
246
|
|
|
246
|
-
cfg, config_path = _load_config(config_file, config_data, org, token_env)
|
|
247
|
+
cfg, config_path = _load_config(config_file, config_data, org, token_env, console)
|
|
247
248
|
detected = boundary.detect_target(console, repo, scope)
|
|
248
249
|
mode = boundary.resolve_mode(console, scope, cfg=cfg, detected=detected)
|
|
249
250
|
|
|
@@ -353,7 +354,7 @@ def remediate(
|
|
|
353
354
|
repos: list[str] | None = typer.Option(
|
|
354
355
|
None,
|
|
355
356
|
"--repos",
|
|
356
|
-
help="Limit every selected category to these repositories: comma-separated and/or repeatable, each 'name' (in any configured org) or 'owner/name'. Each org's repository list is checked first: a name matching nothing, a name matching only excluded repositories, or an incomplete list stops the run before any per-repository read or any write.",
|
|
357
|
+
help="Limit every selected category to these repositories: comma-separated and/or repeatable, each 'name' (in any configured org) or 'owner/name'. Naming a repository opts it into every category's exclude/exclude_tests patterns for this run; the organisation's own exclude list still holds. Each org's repository list is checked first: a name matching nothing, a name matching only excluded repositories, or an incomplete list stops the run before any per-repository read or any write.",
|
|
357
358
|
),
|
|
358
359
|
no_color: bool = typer.Option(False, "--no-color", help="Disable coloured output."),
|
|
359
360
|
no_progress: bool = typer.Option(
|
|
@@ -405,7 +406,7 @@ def remediate(
|
|
|
405
406
|
)
|
|
406
407
|
raise typer.Exit(2)
|
|
407
408
|
|
|
408
|
-
cfg, config_path = _load_config(config_file, config_data, org, token_env)
|
|
409
|
+
cfg, config_path = _load_config(config_file, config_data, org, token_env, console)
|
|
409
410
|
if cfg is None:
|
|
410
411
|
console.print(
|
|
411
412
|
"[red]No configuration: provide --config, --config-data or --org.[/red]"
|
|
@@ -28,6 +28,7 @@ from github_security_report.categories import CategoryKey
|
|
|
28
28
|
from github_security_report.cli.modes import _abort_auth, _abort_network
|
|
29
29
|
from github_security_report.client import AuthError, NetworkError
|
|
30
30
|
from github_security_report.config import Config
|
|
31
|
+
from github_security_report.matching import compile_patterns
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
def check_non_negative(console: Console, name: str, value: int | None) -> None:
|
|
@@ -136,6 +137,28 @@ def reject_org_only(console: Console, supplied: Sequence[str]) -> None:
|
|
|
136
137
|
raise typer.Exit(2)
|
|
137
138
|
|
|
138
139
|
|
|
140
|
+
def check_patterns(console: Console, name: str, patterns: Sequence[str] | None) -> None:
|
|
141
|
+
"""Reject an empty or uncompilable name pattern given on the command line.
|
|
142
|
+
|
|
143
|
+
Mirrors the configuration loader's rules for the same list. An override
|
|
144
|
+
skips the loader, so without this an empty pattern, which every name
|
|
145
|
+
contains, would silently drop every repository, and one that does not
|
|
146
|
+
compile would fail only after the organisation had been collected.
|
|
147
|
+
"""
|
|
148
|
+
if not patterns:
|
|
149
|
+
return
|
|
150
|
+
if not all(patterns):
|
|
151
|
+
console.print(f"[red]{name} takes a non-empty name pattern[/red]")
|
|
152
|
+
raise typer.Exit(2)
|
|
153
|
+
try:
|
|
154
|
+
compile_patterns(patterns, name)
|
|
155
|
+
except ValueError as exc:
|
|
156
|
+
# markup=False: the pattern is printed literally, so a bracket in it
|
|
157
|
+
# cannot be read as Rich markup.
|
|
158
|
+
console.print(str(exc), style="red", markup=False)
|
|
159
|
+
raise typer.Exit(2) from exc
|
|
160
|
+
|
|
161
|
+
|
|
139
162
|
def check_releases_exclude(
|
|
140
163
|
console: Console, cfg: Config, releases_exclude: Sequence[str] | None
|
|
141
164
|
) -> None:
|