OpenWriterControle/.github/workflows/installer-checks.yml
Darren Hinde 699b2d7769
ci(security): phase-1 CI hardening — affected-area tests, least privilege, action pinning, dependency governance (#336)
* ci(security): run deterministic eval tests in affected-area CI (Task 04)

The build-check job validated build + suite structure but never ran the
tests, and its summary referenced a `test:ci` script that did not exist.
Make affected-area CI meaningful:

- Add `test:ci` to evals/framework running the offline, deterministic
  Vitest allowlist (7 files / 112 tests) — no model, network, or paid
  execution.
- Add a required "Run deterministic tests" step to build-check; a failure
  fails the job and the existing PR summary gate (which keys on
  build-check.result) fails closed.
- Correct the summary note to state test:ci runs the deterministic
  allowlist and that model/network agent suites are excluded on PRs.

The broader deterministic suite has 3 pre-existing failing files
(framework-confidence, logger, test-runner; confirmed failing before this
work) which are intentionally out of the allowlist and tracked separately.

Validated locally: build, validate:suites:all, and test:ci all exit 0.

* ci(security): least privilege permissions + pin actions to SHAs (Task 05)

Harden all 9 GitHub Actions workflows:

Least privilege:
- Add explicit top-level `permissions: contents: read` to installer-checks,
  validate-test-suites, and opencode (opencode's job keeps the writes it
  needs; the top level now defaults to read).
- Every workflow now declares an explicit top-level permissions block.
- Write scopes retained only where justified (releases, doc/registry
  commits, follow-up PRs, and sync-docs' issues.create).

Immutable action pinning:
- Pin every `uses:` to a full 40-char commit SHA with a version comment,
  including first-party actions/* (checkout, github-script, setup-node,
  upload-artifact) and third-party (oven-sh/setup-bun).
- Replace the two mutable refs that could change under us at any push:
  ludeeus/action-shellcheck@master and sst/opencode/github@latest.

Record all SHAs, versions, and permission justifications in
docs/maintenance/repository-recovery/action-pin-inventory.md.

Verified: all 9 workflows parse as valid YAML; no floating tag/branch refs
remain; every workflow has a top-level permissions block.

* docs(security): add SECURITY.md and private-reporting checklist (Task 06)

- Add root SECURITY.md: supported versions (0.7.x), private reporting via
  GitHub's "Report a vulnerability", best-effort response expectations,
  coordinated disclosure, and no-secret guidance.
- Add private-vulnerability-reporting checklist that separates repository
  file work (this PR) from GitHub settings changes that require their own
  approval (Task 07: enabling private vulnerability reporting).

No external links to validate; the reporting path uses the repo Security
tab. SECURITY.md documents the private reporting path ahead of Task 07
enabling it.

* ci(security): add dependency governance and ownership controls (Task 08)

- .github/dependabot.yml: weekly grouped github-actions updates (keeps the
  Task 05 SHA pins current). Scoped to actions only — the primary lockfile
  is bun.lock and Dependabot's npm ecosystem would desync it; npm
  dependency risk is covered by dependency-review below.
- .github/workflows/dependency-review.yml: runs on PRs with contents: read,
  SHA-pinned actions, fail-on-severity: high to block newly introduced
  high-severity vulnerabilities (exceptions documented inline).
- .github/CODEOWNERS: default owner @darrenhinde with explicit ownership of
  security-sensitive paths (workflows, dependabot, CODEOWNERS, SECURITY.md,
  scripts/validation).

Verified: dependabot.yml and dependency-review.yml are valid YAML;
dependency-review actions are SHA-pinned with contents: read; CODEOWNERS
owner is the repository owner.

* docs(security): record GitHub security settings evidence (Task 07)

Enable private vulnerability reporting and record read-back evidence.

Settings changed (each approved immediately before, verified by read-back):
- Private vulnerability reporting: enabled=false -> enabled=true. The
  Security tab now offers "Report a vulnerability", making the path
  documented in SECURITY.md live.
- Dependency Graph / Dependabot alerts: 404 -> 204. This was an
  undocumented prerequisite of Task 08's dependency-review.yml, which
  failed with "Dependency graph is not enabled"; the Dependency Review
  check on PR #336 went fail -> pass after enabling it.

No other repository setting was modified; secret scanning and push
protection are unchanged, and dependabot_security_updates remains disabled
(out of scope, would need its own approval). Both changes are reversible
via the corresponding DELETE calls.

Marks Part B of the private-vulnerability-reporting checklist complete.
2026-07-15 00:19:28 +01:00

260 lines
8.5 KiB
YAML

name: Installer Checks
on:
pull_request:
branches: [main]
paths:
- 'install.sh'
- 'update.sh'
- 'registry.json'
- 'scripts/tests/test-*.sh'
push:
branches: [main]
paths:
- 'install.sh'
- 'update.sh'
workflow_dispatch:
permissions:
contents: read
jobs:
shellcheck:
name: ShellCheck Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Run ShellCheck on install.sh
uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca # master (resolved 2026-07-15)
with:
scandir: '.'
additional_files: 'install.sh update.sh'
severity: warning
- name: Summary
if: success()
run: |
echo "## ✅ ShellCheck Passed" >> $GITHUB_STEP_SUMMARY
echo "No shell script issues found in install.sh or update.sh" >> $GITHUB_STEP_SUMMARY
syntax-check:
name: Bash Syntax Validation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Check install.sh syntax
run: bash -n install.sh
- name: Check update.sh syntax
run: bash -n update.sh
- name: Check test scripts syntax
run: |
for script in scripts/tests/test-*.sh; do
echo "Checking $script..."
bash -n "$script"
done
- name: Summary
run: |
echo "## ✅ Syntax Check Passed" >> $GITHUB_STEP_SUMMARY
echo "All shell scripts have valid syntax" >> $GITHUB_STEP_SUMMARY
non-interactive-tests:
name: Non-Interactive Mode Tests
runs-on: ${{ matrix.os }}
needs: [shellcheck, syntax-check]
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install jq (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y jq
- name: Install jq (macOS)
if: matrix.os == 'macos-latest'
run: brew install jq || true
- name: Run non-interactive tests
run: bash scripts/tests/test-non-interactive.sh
- name: Summary
if: success()
run: |
echo "## ✅ Non-Interactive Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
echo "All piped execution scenarios work correctly" >> $GITHUB_STEP_SUMMARY
e2e-tests:
name: End-to-End Installation Tests
runs-on: ${{ matrix.os }}
needs: [shellcheck, syntax-check]
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install jq (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y jq
- name: Install jq (macOS)
if: matrix.os == 'macos-latest'
run: brew install jq || true
- name: Run E2E tests
env:
OPENCODE_BRANCH: ${{ github.head_ref || github.ref_name }}
run: bash scripts/tests/test-e2e-install.sh
- name: Summary
if: success()
run: |
echo "## ✅ E2E Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
echo "Full installation workflow validated" >> $GITHUB_STEP_SUMMARY
compatibility-tests:
name: Compatibility Tests
runs-on: ${{ matrix.os }}
needs: [shellcheck, syntax-check]
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install jq (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y jq
- name: Install jq (macOS)
if: matrix.os == 'macos-latest'
run: brew install jq || true
- name: Run compatibility tests
run: bash scripts/tests/test-compatibility.sh
- name: Summary
if: success()
run: |
echo "## ✅ Compatibility Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
echo "Platform compatibility validated" >> $GITHUB_STEP_SUMMARY
profile-smoke-test:
name: Profile Installation Smoke Test
runs-on: ubuntu-latest
needs: [non-interactive-tests]
strategy:
matrix:
profile: [essential, developer, business, full, advanced]
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install dependencies
run: sudo apt-get install -y jq curl
- name: Test ${{ matrix.profile }} profile
env:
OPENCODE_BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
TEST_DIR="/tmp/profile-test-${{ matrix.profile }}"
mkdir -p "$TEST_DIR"
echo "Installing ${{ matrix.profile }} profile..."
bash install.sh ${{ matrix.profile }} --install-dir="$TEST_DIR/.opencode"
if [ -d "$TEST_DIR/.opencode/agent" ]; then
echo "✅ Profile ${{ matrix.profile }} installed successfully"
echo "Files installed:"
find "$TEST_DIR/.opencode" -type f -name "*.md" | head -10
else
echo "❌ Profile ${{ matrix.profile }} failed"
exit 1
fi
- name: Summary
if: success()
run: |
echo "## ✅ Profile Test: ${{ matrix.profile }}" >> $GITHUB_STEP_SUMMARY
echo "Profile installed successfully via non-interactive mode" >> $GITHUB_STEP_SUMMARY
summary:
name: Installer Checks Summary
runs-on: ubuntu-latest
needs: [shellcheck, syntax-check, non-interactive-tests, e2e-tests, compatibility-tests, profile-smoke-test]
if: always()
steps:
- name: Generate summary
run: |
echo "## 📊 Installer Checks Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.shellcheck.result }}" == "success" ]; then
echo "✅ **ShellCheck:** Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **ShellCheck:** Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.syntax-check.result }}" == "success" ]; then
echo "✅ **Syntax Check:** Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Syntax Check:** Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.non-interactive-tests.result }}" == "success" ]; then
echo "✅ **Non-Interactive Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Non-Interactive Tests:** Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.e2e-tests.result }}" == "success" ]; then
echo "✅ **E2E Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **E2E Tests:** Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.compatibility-tests.result }}" == "success" ]; then
echo "✅ **Compatibility Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Compatibility Tests:** Failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.profile-smoke-test.result }}" == "success" ]; then
echo "✅ **Profile Smoke Tests:** All profiles work" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Profile Smoke Tests:** Some profiles failed" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
FAILED=0
[ "${{ needs.shellcheck.result }}" != "success" ] && FAILED=1
[ "${{ needs.syntax-check.result }}" != "success" ] && FAILED=1
[ "${{ needs.non-interactive-tests.result }}" != "success" ] && FAILED=1
[ "${{ needs.e2e-tests.result }}" != "success" ] && FAILED=1
if [ $FAILED -eq 0 ]; then
echo "### ✅ All Installer Checks Passed!" >> $GITHUB_STEP_SUMMARY
echo "The installer is safe to merge." >> $GITHUB_STEP_SUMMARY
else
echo "### ❌ Some Checks Failed" >> $GITHUB_STEP_SUMMARY
echo "Please fix failing checks before merging." >> $GITHUB_STEP_SUMMARY
fi