Commit Graph
4 Commits
Author SHA1 Message Date
Lauri Ojansivu 4599e34518 Security download: a build log the log endpoint refuses is read through gh run view, and why it failed is kept.
The first run downloaded the failed jobs but none of their logs: the log
endpoint answers with a redirect to storage, and the reason was only on the
screen. Now gh run view --log-failed reads the same log, and when both
refuse, job-<id>-<name>.log-error.txt and the summary say why.

Thanks to xet7 !
2026-11-22 17:38:05 +02:00
Lauri Ojansivu 689d538152 Security download: the newest build logs too, to fix failing builds from the files.
releases/sec/download-github-security.sh now also writes, per repository,
<datetime>/builds/: runs.json with the newest GitHub Actions runs, and for
every workflow whose newest finished run failed, its jobs and each failed
job's whole log and last 200 lines. SUMMARY.md gets a Builds table - failed
workflows first, their failed jobs and steps, and where the logs are.
--builds N looks at the N newest runs (default 100), --builds 0 at none. A
workflow's name is a directory name, never a path.

tests/securityDownloadScript.test.cjs: the newest finished run per workflow,
only failed jobs' logs, the summary row, a repository without Actions, and
--builds 0.

Thanks to xet7 !
2026-11-22 17:25:38 +02:00
Lauri Ojansivu ed19817433 releases/sec: SUMMARY.md carries no secret scanning field, and kept secrets are owner-only.
Code scanning alert #604 (py/clear-text-storage-sensitive-data, CWE-312):
download_github_security.py wrote a secret scanning alert's
secret_type_display_name into SUMMARY.md. That is the secret's type, not the
secret, but SUMMARY.md is the one file that is never redacted and the one most
likely to be pasted somewhere, so it now says only "Secret scanning alert" and
points at secret-scanning/, where the type still is. When
--include-secret-values keeps the secrets, the files holding them are created
readable by their owner only.

tests/securityDownloadScript.test.cjs checks the summary of a redacted and of a
kept download for the secret, its type and its type name, the 0600 mode of
kept secrets, and that describe() reads no field of a secret scanning alert
and every secret scanning write passes the private flag.

Thanks to GitHub CodeQL and xet7 !
2026-11-12 16:07:39 +02:00
Lauri Ojansivu 801f8956fe releases/sec: download a GitHub organization's Security and quality alerts with gh.
releases/sec/download-github-security.sh ORGANIZATION saves, for every
repository of the organization (or the ones named with --repo), its
Dependabot, code scanning, secret scanning and security advisory alerts
to .tools/log/sec/<organization>/<repository>/<YYYY-MM-DD_HH-MM-SS>/,
a directory per kind: alerts.json, a file per alert, an open code
scanning alert's instances, and SUMMARY.md with every open alert and its
link. It runs the GitHub CLI outside the editor's sandbox, where gh and
its login are, so the alerts can then be read and fixed from the files
inside it. A kind GitHub does not answer - not enabled, or not visible
to the account - gets status.txt with the reason and the run goes on;
archived repositories and forks are skipped unless asked for; the secret
a secret scanning alert found is redacted unless --include-secret-values
is given. A name that is not a GitHub name is refused before it becomes
a path or an API address. .tools/ keeps the downloads out of git.

tests/securityDownloadScript.test.cjs runs it against a stand-in gh: the
layout, both pages of a paginated answer, the summary, a disabled kind,
the redaction everywhere in the download and, as negatives, bad names,
no gh and gh signed out writing nothing. buildScriptParity knows why
build.sh has no menu entry for it.

Thanks to xet7 !
2026-11-11 04:25:18 +02:00