feat: improve navigation and add security scans
Security / Secrets (gitleaks) (push) Successful in 1m29s
Lint / Lint (push) Successful in 1m43s
Security / Dependencies (Trivy) (push) Successful in 1m59s
Security / Code (Semgrep) (push) Successful in 3m34s
Tests / Dashboard checks (push) Successful in 1m2s
Tests / Go backend (push) Successful in 3m13s
Docker / Docker Build & Push (push) Successful in 8m15s

- Hide the lone navigation tab and show mobile menus as overlays
- Add secret, code, and dependency scanning to CI
- Update test workflows and remove an unused frontend dependency
This commit is contained in:
Gabriel20xx committed 2026-10-27 09:54:10 +00:00
1 parent 85e6db67b5
commit 817236f349
23 files changed
+299 -74

No files matched your search

+143
View File
@@ -0,0 +1,143 @@
name: Security
on:
push:
branches: ['**']
pull_request:
branches: [main, master]
schedule:
# Weekly, so advisories published after the last push still get reported.
- cron: '23 5 * * 1'
workflow_dispatch: {}
jobs:
secrets:
name: Secrets (gitleaks)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
# Full history, so a secret that was committed and later removed is still found.
fetch-depth: 0
submodules: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# gitleaks runs at a pinned version. go run checks the module against the Go checksum
# database. Known false positives go in .gitleaks.toml at the repo root, which gitleaks reads
# on its own.
- name: Scan git history for secrets
run: go run github.com/zricethezav/gitleaks/v8@v8.30.1 git --no-banner --redact --exit-code 1 .
code:
name: Code (Semgrep)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
submodules: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Semgrep
run: pip install semgrep==1.182.1
# Fails on ERROR findings from Semgrep's default rules. WARNING findings are not gated.
- name: Scan code
run: semgrep scan --config p/default --severity ERROR --error --metrics=off .
dependencies:
name: Dependencies (Trivy)
runs-on: ubuntu-latest
permissions:
contents: read
env:
TRIVY_VERSION: '0.76.1'
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
submodules: false
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 24
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
run: pip install uv==0.13.5
- name: Install Trivy
# Downloaded from the release and checked against its published checksums. The
# aquasecurity/trivy-action version tags were repointed to malicious commits in March 2026,
# so that action is not used.
shell: bash
run: |
archive="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
base_url="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
curl --fail --location --retry 5 --retry-delay 2 \
--output "$RUNNER_TEMP/$archive" "$base_url/$archive"
curl --fail --location --retry 5 --retry-delay 2 \
--output "$RUNNER_TEMP/trivy_checksums.txt" "$base_url/trivy_${TRIVY_VERSION}_checksums.txt"
(cd "$RUNNER_TEMP" && grep -F " $archive" trivy_checksums.txt > trivy_checksum.txt \
&& sha256sum -c trivy_checksum.txt)
tar -xzf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP" trivy
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
"$RUNNER_TEMP/trivy" --version
# Trivy audits lockfiles and skips bare manifests. For each manifest with no lockfile in its
# own folder or any parent folder, resolve one here so its dependencies get scanned. These
# lockfiles are made only for this run and are not committed.
- name: Resolve manifests that have no lockfile
shell: bash
run: |
has_lockfile() {
local dir=$1
shift
while true; do
for lockfile in "$@"; do
if [ -f "$dir/$lockfile" ]; then
return 0
fi
done
if [ "$dir" = "." ]; then
return 1
fi
dir=$(dirname "$dir")
done
}
while IFS= read -r -d '' manifest; do
dir=$(dirname "$manifest")
if ! has_lockfile "$dir" package-lock.json yarn.lock pnpm-lock.yaml; then
echo "Resolving npm dependencies in $dir"
(cd "$dir" && npm install --package-lock-only --ignore-scripts --no-audit --no-fund)
fi
done < <(find . -name node_modules -prune -o -name package.json -print0)
while IFS= read -r -d '' manifest; do
dir=$(dirname "$manifest")
if ! has_lockfile "$dir" uv.lock poetry.lock Pipfile.lock; then
echo "Resolving Python dependencies in $dir"
(cd "$dir" && uv lock)
fi
done < <(find . -name node_modules -prune -o -name .venv -prune -o -name pyproject.toml -print0)
# Fails on HIGH and CRITICAL vulnerabilities that have a fixed version. Vulnerabilities with no
# fix are left out, because nothing can be changed to clear them. Development dependencies are
# included, since build and test tooling runs in CI.
# --offline-scan: Maven Central rate-limits the lookups Trivy makes for pom.xml, so Maven
# dependencies are read from their declared versions only. Transitive ones are not resolved.
- name: Scan dependencies for known vulnerabilities
run: >-
trivy fs --scanners vuln --severity HIGH,CRITICAL --ignore-unfixed --include-dev-deps
--offline-scan --exit-code 1 --timeout 15m .
+12 -5
View File
@@ -65,15 +65,15 @@ jobs:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: scratch
ports:
- 5432:5432
- 5432/tcp
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/scratch?sslmode=disable
SHARED_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/scratch?sslmode=disable
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/scratch?sslmode=disable
SHARED_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/scratch?sslmode=disable
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -84,7 +84,14 @@ jobs:
cache: true
# -p 1 runs one package at a time, because the database tests share one scratch database.
- name: Run Go tests
run: go test -p 1 ./...
shell: bash
run: |
# Gitea Actions runs jobs in a container, where the service is reached by its label.
if [ "${GITEA_ACTIONS:-}" = "true" ]; then
export DATABASE_URL="postgres://postgres:postgres@postgres:5432/scratch?sslmode=disable"
export SHARED_TEST_DATABASE_URL="postgres://postgres:postgres@postgres:5432/scratch?sslmode=disable"
fi
go test -p 1 ./...
python:
name: Test (Python)
@@ -99,7 +106,7 @@ jobs:
with:
python-version: '3.12'
- name: Install package
run: python -m pip install --upgrade pip -e "packages/python-backend[fastapi]"
run: python -m pip install --upgrade pip -e "packages/python-backend[fastapi,test]"
- name: Run Python tests
run: python -m unittest discover -s packages/python-backend/tests -p 'test_*.py'