Files
HashTool/.gitea/workflows/security.yml
T
poli0981andClaude Opus 5.5 f63ad264b2
CI / build-test (ubuntu-latest) (pull_request) Successful in 1m59s
CI / build-test (windows-latest) (pull_request) Successful in 1m48s
CI / format (pull_request) Successful in 58s
Release / prepare (pull_request) Successful in 9s
Security / vulnerable-packages (pull_request) Successful in 54s
Reusable / Security / Rust (cargo-deny) (pull_request) Skipped
Security / licenses (pull_request) Successful in 1m21s
Security / workflow-lint (pull_request) Successful in 28s
Reusable / Security / Secrets (gitleaks) (pull_request) Successful in 11s
Reusable / Security / SAST (Opengrep) (pull_request) Successful in 24s
Reusable / Security / Dependencies (osv-scanner) (pull_request) Successful in 13s
Reusable / Security / .NET (NuGetAudit) (pull_request) Successful in 41s
Security / scan (pull_request) Successful in 1m30s
Reusable / Qodana / Qodana (pull_request) Failing after 4m57s
Qodana / qodana (pull_request) Failing after 4m57s
CI / ci-ok (pull_request) Successful in 1s
Release / app (linux) (pull_request) Successful in 4m20s
Release / app (win) (pull_request) Successful in 4m37s
Release / cli (linux-x64) (pull_request) Successful in 1m20s
Release / cli (win-x64) (pull_request) Failing after 43s
Release / check (pull_request) Successful in 35s
Release / publish (versioned files, linux) (pull_request) Skipped
Release / publish (win) (pull_request) Skipped
Release / Gitea release (notes + links) (pull_request) Skipped
Release / announce (pull_request) Skipped
ci: ICU for the Linux jobs, coverage of HashTool.Core only
The first run on Gitea found two problems:

- The runner's Ubuntu image has no ICU, so .NET stopped at start-up ("Couldn't
  find a valid ICU package"). Jobs that run the tests or the app install
  libicu-dev; jobs that only restore, build or run tools use invariant
  globalization. The ops NuGetAudit job, which installs nothing, runs on
  windows-latest.
- Avalonia 12.2's XAML compiler names generated types and methods with U+0001,
  which Microsoft.CodeCoverage's Cobertura writer cannot put into XML: the
  tests passed and the test host then crashed. eng/coverage.config limits
  coverage to HashTool.Core, the only module the gate measures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 11:19:29 +07:00

168 lines
7.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Security
# Gitea has no CodeQL, no dependency review and no code-scanning UI (ops runbook §1, migration decision D7). This
# workflow covers instead:
#
# vulnerable-packages NuGet packages with known advisories, transitive ones included (fails on any severity)
# licenses licences of the shipped projects' packages against eng/allowed-licenses.json
# workflow-lint zizmor, actionlint and shellcheck on .gitea/workflows/*.yml
# scan the ops repo's security.yml: gitleaks over the full history, Opengrep (C# and Python rules;
# report only, SARIF as an artifact), osv-scanner (lockfiles; this repo has none) and a
# NuGetAudit restore that fails on high/critical advisories
#
# Weekly as well, so a new advisory against unchanged dependencies turns it red: Monday 13:43 UTC = 20:43 Vietnam
# (this repo's slot in the ops repo's cron registry; the runner is the maintainer's PC and only runs 13:00–16:00 UTC).
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "43 13 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: security-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
AVALONIA_TELEMETRY_OPTOUT: 1
jobs:
# `dotnet package list --vulnerable` always exits 0, so the JSON report is checked explicitly.
vulnerable-packages:
name: vulnerable-packages
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
env:
# The runner's Ubuntu image has no ICU; restoring and listing packages need no cultures.
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- name: Restore
run: dotnet restore HashTool.slnx
- name: List vulnerable packages
run: |
dotnet package list --project HashTool.slnx --vulnerable --include-transitive --format json > vulnerable.json
jq -r '.projects[]? | .path as $p | .frameworks[]? | (.topLevelPackages[]?, .transitivePackages[]?)
| select((.vulnerabilities // []) | length > 0)
| "\($p): \(.id) \(.resolvedVersion) - \([.vulnerabilities[].severity] | join(", ")) \([.vulnerabilities[].advisoryurl] | join(" "))"' vulnerable.json \
| sort -u | tee vulnerable.txt
if [ -s vulnerable.txt ]; then
echo "::error::Vulnerable NuGet packages found (see above)."
exit 1
fi
echo "No known vulnerable packages."
# Only shipped projects are checked; test and benchmark tools are not redistributed.
licenses:
name: licenses
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
env:
# The runner's Ubuntu image has no ICU; restoring and listing packages need no cultures.
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- name: Restore
run: |
dotnet tool restore
dotnet restore HashTool.slnx
- name: Check licenses
run: >-
dotnet nuget-license -ji eng/license-inputs.json -t
-a eng/allowed-licenses.json -o Markdown
# The linters without Docker: actionlint and shellcheck as release binaries at pinned versions, SHA-256 verified (the
# pins of the ops repo's ops-lint.yml), zizmor from the hash-locked .github/requirements-ci.txt. Renovate does not
# update the binaries: bump version and checksum together, by hand.
workflow-lint:
name: workflow-lint
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
env:
ACTIONLINT_VERSION: 1.7.12
ACTIONLINT_SHA256: 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 # actionlint_1.7.12_linux_amd64.tar.gz
SHELLCHECK_VERSION: v0.11.0
SHELLCHECK_SHA256: 8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198 # shellcheck-v0.11.0.linux.x86_64.tar.xz
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
- name: Install zizmor
run: |
python -m pip install --quiet --require-hashes --only-binary :all: -r .github/requirements-ci.txt
# The files by name: zizmor only looks for .github/workflows by itself. Offline: its online audits ask GitHub's
# API about the actions, with a token this runner does not have. Any finding at medium or above fails.
- name: zizmor (workflow security audit)
run: zizmor --offline --min-severity medium --config .github/zizmor.yml .gitea/workflows/*.yml
- name: Install actionlint ${{ env.ACTIONLINT_VERSION }} + shellcheck ${{ env.SHELLCHECK_VERSION }}
run: |
set -euo pipefail
tmp="${RUNNER_TEMP:-/tmp}"
bin="$tmp/lint-bin"
mkdir -p "$bin"
curl -fsSL --retry 3 -o "$tmp/actionlint.tar.gz" \
"https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
echo "${ACTIONLINT_SHA256} $tmp/actionlint.tar.gz" | sha256sum -c -
tar -xzf "$tmp/actionlint.tar.gz" -C "$bin" actionlint
curl -fsSL --retry 3 -o "$tmp/shellcheck.tar.xz" \
"https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz"
echo "${SHELLCHECK_SHA256} $tmp/shellcheck.tar.xz" | sha256sum -c -
tar -xJf "$tmp/shellcheck.tar.xz" -C "$bin" --strip-components=1 "shellcheck-${SHELLCHECK_VERSION}/shellcheck"
echo "$bin" >> "$GITHUB_PATH"
# .github/actionlint.yaml ignores only the Gitea features actionlint does not know; everything else is an error.
- name: actionlint (workflow syntax and expressions)
run: |
actionlint -version
actionlint -color -config-file .github/actionlint.yaml \
-shellcheck "$(command -v shellcheck)" .gitea/workflows/*.yml
scan:
permissions:
contents: read
uses: poli0981/.github/.gitea/workflows/security.yml@c133a00dc7a0bd7bd68253d415758b408d615fa4 # ops v2026.11.4
with:
dotnet: true
# The ops NuGetAudit job runs .NET without installing ICU, which the runner's Ubuntu image lacks.
dotnet-runs-on: windows-latest
dotnet-solution: HashTool.slnx
# eng/*.py: localisation, release notes, release and coverage checks.
python: true