Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# bf-phhj
title: Harden the public repository to match handbells
status: completed
type: task
priority: normal
created_at: 2026-11-05T14:00:00Z
updated_at: 2026-11-05T14:12:17Z
parent: bf-wivr
---

Phase E4 of bf-wivr. Bring beans-web's GitHub settings, rulesets and workflows up to the handbells-used-chart-dorico-plugin baseline.

## Todo

- [x] Workflows: persist-credentials false on every checkout; top-level permissions {} with per-job grants
- [x] CodeQL: scan the actions language as well
- [x] Scan job: zizmor and gitleaks with SARIF upload to code scanning
- [x] Renovate: pinGitHubActionDigests, 7-day minimum release age, platformCommit, gitleaks custom manager
- [x] Repo settings: immutable releases, squash-only merge buttons, Projects off
- [x] Tag ruleset: v* tags cannot be deleted, force-pushed or updated
- [x] main ruleset: no bypass, 0 approvals, thread resolution, CodeQL code-scanning rule, checks pinned to their apps, codecov/patch required
- [x] Open the PR; its CI run is the first under the new gate

## Summary of Changes

Workflows: `permissions: {}` at the top of ci.yml and codeql.yml with per-job grants; `persist-credentials: false` on every checkout; codecov-action pin comments corrected to v7.0.0 (zizmor ref-version-mismatch). CodeQL now runs a matrix over `actions` and `javascript-typescript`. New Repo Scan job runs zizmor 1.31.1 and gitleaks 8.30.1, both SHA-256-verified release downloads, failing on findings and uploading SARIF.

Renovate: `helpers:pinGitHubActionDigests`, global 7-day `minimumReleaseAge` (security updates exempt), `platformCommit: enabled`, and a regex manager that moves each scanner VERSION and SHA256 together.

GitHub settings, applied through the API: merge-commit and rebase buttons off (squash only), Projects off, immutable releases on, a `release tags` ruleset on `refs/tags/v*` blocking deletion, force-push and update, and the `main` ruleset now has no bypass actors, 0 required approvals, no code-owner requirement, required thread resolution, a CodeQL code-scanning rule (high or higher security alerts, errors), and every required check pinned to its app (GitHub Actions 15368, codecov/patch 254) with Analyze split per language and Repo Scan added.

The TypeScript analysis keeps the category it used before the matrix (`.github/workflows/codeql.yml:analyze`) so dismissed alert #1 keeps its dismissal and code scanning can compare pull requests against main. Only the new actions analysis uses `/language:actions`.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
# bf-wivr
title: Final pre-public audit, vulnerability remediation, and rename to beans-web
status: in-progress
status: completed
type: epic
priority: high
created_at: 2026-08-04T18:15:54Z
updated_at: 2026-08-05T23:25:28Z
updated_at: 2026-11-05T14:28:45Z
---

Final pass before flipping the repo to public visibility: a fresh five-dimension audit, Trivy vulnerability remediation across the Docker images and the beans Go binary, the beans-frontend to beans-web rename, and GitHub public-repo hardening. Design: docs/superpowers/specs/2026-08-04-final-public-release-audit-design.md
Expand All @@ -20,7 +20,11 @@ Final pass before flipping the repo to public visibility: a fresh five-dimension
- [x] Phase E1 — substitute the scaffold placeholders
- [x] Phase E2 — the 0.3.0 changelog entry
- [x] Final whole-branch review — approved for public release
- [ ] Phase E3 — cut over: rename the GitHub repository and flip visibility to public
- [ ] Phase E4 — harden the public repository (rulesets, secret scanning, CodeQL, Actions lockdown, private vulnerability reporting, Discussions)
- [x] Phase E3 — cut over: rename the GitHub repository and flip visibility to public
- [x] Phase E4 — harden the public repository (rulesets, secret scanning, CodeQL, Actions lockdown, private vulnerability reporting, Discussions)

Phase E3 is deliberately left to the maintainer so the image tested one final time is the exact tree that goes public.

## Summary of Changes

The audit, Trivy remediation and rename shipped in 0.3.0. The repository is now `ThePrismSystem/beans-web` and public. Hardening is in bf-phhj: secret scanning with push protection, private vulnerability reporting, Discussions, SHA-pinned actions and a read-only default token were already on; bf-phhj added a `main` ruleset with no bypass that requires every CI check plus codecov/patch and a CodeQL code-scanning rule, a `release tags` ruleset, immutable releases, squash-only merges, CodeQL over the workflows, and zizmor and gitleaks scans.
115 changes: 110 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:
push:
branches: [main]

permissions:
contents: read
permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -30,8 +29,12 @@ jobs:
lint:
name: Lint
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

Expand All @@ -51,8 +54,12 @@ jobs:
audit:
name: Audit
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

Expand All @@ -69,8 +76,12 @@ jobs:
typecheck:
name: Typecheck
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

Expand All @@ -87,8 +98,12 @@ jobs:
test:
name: Test (coverage)
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

Expand Down Expand Up @@ -136,7 +151,7 @@ jobs:
# keep coverage flags scoped correctly per package.
- name: Upload coverage to Codecov (shared)
if: always()
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/shared/coverage/lcov.info
Expand All @@ -145,7 +160,7 @@ jobs:

- name: Upload coverage to Codecov (server)
if: always()
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./apps/server/coverage/lcov.info
Expand All @@ -154,7 +169,7 @@ jobs:

- name: Upload coverage to Codecov (web)
if: always()
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./apps/web/coverage/lcov.info
Expand Down Expand Up @@ -196,8 +211,12 @@ jobs:
e2e:
name: E2E
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

Expand Down Expand Up @@ -259,10 +278,14 @@ jobs:
name: Build
needs: [lint, typecheck]
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

Expand All @@ -279,8 +302,12 @@ jobs:
quality:
name: Quality
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

Expand Down Expand Up @@ -310,8 +337,12 @@ jobs:
image-scan:
name: Image Scan
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Build the production image
run: docker build -t beans-web:ci .
Expand All @@ -327,3 +358,77 @@ jobs:
severity: HIGH,CRITICAL
ignore-unfixed: true
trivyignores: .trivyignore

# zizmor audits the workflows and gitleaks reads the whole history for
# secrets. Both fail the job on any finding and send their results to code
# scanning. Nothing from the pull request is installed or run here, so this
# is the one job that can hold security-events: write.
repo-scan:
name: Repo Scan
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'self-hosted' }}
permissions:
contents: read
security-events: write # to upload the SARIF results to code scanning
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # gitleaks reads the whole history
persist-credentials: false

# Each tool is a release download checked against its SHA-256. The
# "# renovate:" comment tells Renovate where VERSION comes from, and it
# changes VERSION and SHA256 together (see renovate.json).
- name: Install zizmor
env:
# renovate: datasource=github-release-attachments depName=zizmorcore/zizmor
VERSION: v1.31.1
SHA256: d185f726bdaf92df78273217dfdd24ebcd6b0ef48cf3ce776ff5762b6e138c99
run: |
curl -sSfL -o zizmor.tar.gz "https://github.com/zizmorcore/zizmor/releases/download/${VERSION}/zizmor-x86_64-unknown-linux-gnu.tar.gz"
echo "${SHA256} zizmor.tar.gz" | sha256sum --check
mkdir -p "$RUNNER_TEMP/bin"
tar -xzf zizmor.tar.gz -C "$RUNNER_TEMP/bin" zizmor
rm zizmor.tar.gz
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"

- name: Install gitleaks
env:
# renovate: datasource=github-release-attachments depName=gitleaks/gitleaks
VERSION: v8.30.1
SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
run: |
curl -sSfL -o gitleaks.tar.gz "https://github.com/gitleaks/gitleaks/releases/download/${VERSION}/gitleaks_${VERSION#v}_linux_x64.tar.gz"
echo "${SHA256} gitleaks.tar.gz" | sha256sum --check
mkdir -p "$RUNNER_TEMP/bin"
tar -xzf gitleaks.tar.gz -C "$RUNNER_TEMP/bin" gitleaks
rm gitleaks.tar.gz

# With GH_TOKEN set, zizmor also runs its online audits.
- name: Audit the workflows
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p sarif
zizmor --format sarif .github/workflows/*.yml > sarif/zizmor.sarif || true
zizmor .github/workflows/*.yml

- name: Scan the history for secrets
if: ${{ !cancelled() }}
run: |
mkdir -p sarif
gitleaks git --redact --no-banner --exit-code 1 --report-format sarif --report-path sarif/gitleaks.sarif .

# A fork pull request's token cannot write to code scanning.
- name: Upload zizmor results
if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: github/codeql-action/upload-sarif@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
sarif_file: sarif/zizmor.sarif
category: zizmor

- name: Upload gitleaks results
if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: github/codeql-action/upload-sarif@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
sarif_file: sarif/gitleaks.sarif
category: gitleaks
23 changes: 19 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ on:
schedule:
- cron: "23 5 * * 1"

permissions:
contents: read
permissions: {}

concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
name: Analyze (${{ matrix.language }})
# The same trust boundary ci.yml draws: a fork pull request runs on
# GitHub's hardware, everything else on ours. `build-mode: none` reads the
# tree rather than running it, so the exposure here is smaller than the
Expand All @@ -29,15 +28,31 @@ jobs:
security-events: write
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
# `actions` reads the workflows themselves.
- language: actions
category: /language:actions
# The category this analysis uploaded under before the matrix
# existed. Keeping it keeps the alert history and dismissals, and
# lets code scanning compare a pull request against main.
- language: javascript-typescript
category: .github/workflows/codeql.yml:analyze
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Initialize CodeQL
uses: github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
languages: javascript-typescript
languages: ${{ matrix.language }}
build-mode: none
queries: security-and-quality

- name: Analyze
uses: github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
with:
category: ${{ matrix.category }}
22 changes: 15 additions & 7 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"extends": ["config:recommended", "helpers:pinGitHubActionDigests"],
"schedule": ["before 9am on monday"],
"minimumReleaseAge": "7 days",
"prConcurrentLimit": 10,
"platformCommit": "enabled",
"dependencyDashboard": true,
"vulnerabilityAlerts": {
"enabled": true,
"schedule": ["at any time"],
"automerge": false,
"labels": ["security"]
"labels": ["security"],
"minimumReleaseAge": null
},
"packageRules": [
{
Expand All @@ -21,21 +24,18 @@
"matchDepTypes": ["devDependencies"],
"matchUpdateTypes": ["patch", "minor"],
"groupName": "dev dependencies (non-major)",
"automerge": true,
"minimumReleaseAge": "3 days"
"automerge": true
},
{
"description": "Major dev dependencies still automerge, but one at a time — a group is only as mergeable as its worst member.",
"matchDepTypes": ["devDependencies"],
"matchUpdateTypes": ["major"],
"automerge": true,
"minimumReleaseAge": "3 days"
"automerge": true
},
{
"description": "Actions run with a token and are not dev dependencies. Digest-pinned, and merged deliberately.",
"matchManagers": ["github-actions"],
"groupName": "github actions",
"pinDigests": true,
"automerge": false
},
{
Expand All @@ -52,6 +52,14 @@
"matchStrings": ["ARG BEANS_VERSION=(?<currentValue>v[0-9][^\\s]*)"],
"depNameTemplate": "github.com/hmans/beans",
"datasourceTemplate": "go"
},
{
"customType": "regex",
"description": "The scanners CI downloads by release tag and checks against a SHA-256. Renovate takes the new hash from the release, so VERSION and SHA256 always change together.",
"managerFilePatterns": ["/^\\.github/workflows/[^/]+\\.yml$/"],
"matchStrings": [
"# renovate: datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)\\n\\s+VERSION: (?<currentValue>v\\S+)\\n\\s+SHA256: (?<currentDigest>[0-9a-f]{64})"
]
}
]
}
Loading