CI: eslint-plugin-security and zizmor; harden the workflow
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 23s
CI / Test (jest) (push) Successful in 22s
CI / Security (npm audit) (push) Successful in 14s
CI / Scan (secrets, workflows, shell) (push) Failing after 18s
CI / Integration (api) (push) Successful in 2m43s
CI / Lint (eslint) (pull_request) Successful in 17s
CI / Test (jest) (pull_request) Successful in 18s
CI / Security (npm audit) (pull_request) Successful in 13s
CI / UI (playwright) (push) Successful in 3m0s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Skipped
CI / Scan (secrets, workflows, shell) (pull_request) Failing after 14s
CI / Integration (api) (pull_request) Successful in 2m24s
CI / UI (playwright) (pull_request) Successful in 2m16s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m18s
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 23s
CI / Test (jest) (push) Successful in 22s
CI / Security (npm audit) (push) Successful in 14s
CI / Scan (secrets, workflows, shell) (push) Failing after 18s
CI / Integration (api) (push) Successful in 2m43s
CI / Lint (eslint) (pull_request) Successful in 17s
CI / Test (jest) (pull_request) Successful in 18s
CI / Security (npm audit) (pull_request) Successful in 13s
CI / UI (playwright) (push) Successful in 3m0s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Skipped
CI / Scan (secrets, workflows, shell) (pull_request) Failing after 14s
CI / Integration (api) (pull_request) Successful in 2m24s
CI / UI (playwright) (pull_request) Successful in 2m16s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m18s
- eslint-plugin-security 4.2.1 (recommended-legacy) with detect-object-injection off (it flags every obj[key]) and file/regex rules off for CI scripts and tests. The remaining hits were false positives with a one-line reason each (fixed page names, the worker's own directory, a null check), plus one real tidy-up: the condition tokenizer's number regex is now two flat patterns with no backtracking, and malformed numbers like 1.2.3 are refused. - zizmor 1.32.0 in the Scan job. Its findings are fixed: persist-credentials: false on every checkout (no job pushes), container images pinned by digest (tag kept in the reference), and the deploy tag step takes github.* values through env instead of template expansion. Left as is: secrets-outside-env (auditor persona; Gitea has no deployment environments). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d96028070
commit
235d9240c0
11 files changed
+104
-19
No files matched your search
+31
-11
@@ -28,9 +28,11 @@ jobs:
|
||||
name: Lint (eslint)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20 # a hung step fails instead of blocking main
|
||||
container: node:20-bookworm
|
||||
container: node:20-bookworm@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
- name: Install dependencies (lockfile only)
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
@@ -48,9 +50,11 @@ jobs:
|
||||
name: Test (jest)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
container: node:20-bookworm
|
||||
container: node:20-bookworm@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
- name: Install dependencies (lockfile only)
|
||||
run: npm ci
|
||||
- name: Run jest with coverage
|
||||
@@ -60,9 +64,11 @@ jobs:
|
||||
name: Security (npm audit)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
container: node:20-bookworm
|
||||
container: node:20-bookworm@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
- name: Audit production and dev dependencies
|
||||
run: |
|
||||
# Retry only when the registry itself fails (it has returned spurious 400s);
|
||||
@@ -89,7 +95,7 @@ jobs:
|
||||
name: Integration (api)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
container: node:20-bookworm # the server and workers on production's Node
|
||||
container: node:20-bookworm@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5 # the server and workers on production's Node
|
||||
env:
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: '3306'
|
||||
@@ -98,6 +104,8 @@ jobs:
|
||||
DB_PASSWORD: ci-only # throwaway database inside the job container
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
- name: Install dependencies (lockfile only)
|
||||
run: npm ci
|
||||
- name: Start MariaDB
|
||||
@@ -114,10 +122,11 @@ jobs:
|
||||
name: Scan (secrets, workflows, shell)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
container: node:20-bookworm
|
||||
container: node:20-bookworm@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
fetch-depth: 0 # gitleaks scans the whole history, not just this commit
|
||||
- name: Install scanners (pinned versions, verified checksums)
|
||||
run: |
|
||||
@@ -136,6 +145,10 @@ jobs:
|
||||
run: actionlint .gitea/workflows/*.yml
|
||||
- name: Shell scripts (shellcheck)
|
||||
run: git ls-files -z '*.sh' | xargs -0 shellcheck
|
||||
- name: Workflow security (zizmor)
|
||||
run: |
|
||||
python3 -m venv /tmp/zizmor && /tmp/zizmor/bin/pip install -q zizmor==1.32.0
|
||||
/tmp/zizmor/bin/zizmor --offline --format plain .gitea/workflows/*.yml
|
||||
- name: Vendored design system matches upstream
|
||||
run: scripts/ci/check-web-template.sh
|
||||
- name: Code patterns (semgrep)
|
||||
@@ -158,7 +171,7 @@ jobs:
|
||||
timeout-minutes: 30
|
||||
# Official image with Chromium and its system libraries; its version must match
|
||||
# @playwright/test in package.json.
|
||||
container: mcr.microsoft.com/playwright:v1.64.1-noble
|
||||
container: mcr.microsoft.com/playwright:v1.64.1-noble@sha256:2f05f8a734509a7b3f26a912639488ee08f58a7b292d14d62271bcff9038768f
|
||||
env:
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: '3306'
|
||||
@@ -167,6 +180,8 @@ jobs:
|
||||
DB_PASSWORD: ci-only # throwaway database inside the job container
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
- name: Install dependencies (lockfile only)
|
||||
run: npm ci
|
||||
- name: Start MariaDB
|
||||
@@ -193,7 +208,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
if: github.event_name == 'pull_request'
|
||||
container: mcr.microsoft.com/playwright:v1.64.1-noble
|
||||
container: mcr.microsoft.com/playwright:v1.64.1-noble@sha256:2f05f8a734509a7b3f26a912639488ee08f58a7b292d14d62271bcff9038768f
|
||||
env:
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: '3306'
|
||||
@@ -204,6 +219,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
fetch-depth: 0
|
||||
- name: Did this PR change the UI?
|
||||
id: ui
|
||||
@@ -290,19 +306,22 @@ jobs:
|
||||
- name: Tag deployed commit
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RUN_NUMBER: ${{ github.run_number }}
|
||||
GIT_SHA: ${{ github.sha }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
TAG="deploy-$(date -u +%Y.%m.%d)-${{ github.run_number }}"
|
||||
TAG="deploy-$(date -u +%Y.%m.%d)-${RUN_NUMBER}"
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"target\":\"${{ github.sha }}\",\"message\":\"Deployed to production\"}" \
|
||||
"https://code.lotusguild.org/api/v1/repos/${{ github.repository }}/tags"
|
||||
-d "{\"tag_name\":\"${TAG}\",\"target\":\"${GIT_SHA}\",\"message\":\"Deployed to production\"}" \
|
||||
"https://code.lotusguild.org/api/v1/repos/${REPO}/tags"
|
||||
|
||||
deploy-worker:
|
||||
name: Deploy worker
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
container: node:20-bookworm
|
||||
container: node:20-bookworm@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5
|
||||
needs: [deploy] # the server first: it must understand anything new the worker sends
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
concurrency:
|
||||
@@ -311,6 +330,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false # no job pushes; keep the token out of .git/config
|
||||
fetch-depth: 0 # to compare against the commit the worker runs now
|
||||
- name: Did the worker change since the running version?
|
||||
id: changed
|
||||
|
||||
Reference in new issue
Block a user