Files
CommandForge/.gitea/workflows/security.yml
T
poli0981andClaude Opus 5.5 3776562fb6 ci: Security workflow — workflow lint and the ops security scan
actionlint and shellcheck (pinned, SHA-256 verified) lint .gitea/workflows,
and the ops repo's security.yml runs gitleaks over the full history, Opengrep,
osv-scanner and a NuGetAudit restore on the Windows runner. Push to main,
pull requests, and weekly on Friday 14:11 UTC (inside the runner's
13:00-16:00 UTC window, a free slot in the ops cron registry). This replaces
CodeQL for both the C# and the workflow analysis.

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

83 lines
3.8 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:
#
# workflow-lint actionlint + shellcheck on .gitea/workflows/*.yml (CodeQL's `actions` analysis
# is gone; Opengrep's GitHub Actions rules below also check for injection)
# scan the ops repo's security.yml: gitleaks (full history), Opengrep (SAST, report
# only), osv-scanner (lockfiles; this repo has none, so it has nothing to scan)
# and a `dotnet restore` with NuGetAudit that fails on high/critical advisories
# (NU1903/NU1904). build.yml's restore already fails on moderate ones.
#
# Weekly as well, so a new advisory against unchanged dependencies turns it red: Friday 14:11 UTC
# = 21:11 Vietnam (a free 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: '11 14 * * 5'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Both linters as release binaries at pinned versions, SHA-256 verified (the pins of the ops
# repo's ops-lint.yml). Renovate does not update them: bump version and checksum together.
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
- 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"
# The files by name: actionlint only finds .github/workflows by itself. .github/actionlint.yaml
# ignores only the Gitea features actionlint does not know; everything else stays 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
dotnet-runs-on: windows-latest # WPF (net10.0-windows) restores only on Windows
dotnet-solution: CommandForge.slnx