mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 15:10:00 +08:00
feat/https-compose-caddy
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2973ca593d |
ci: pin every GitHub Action to a commit SHA (#4671)
## Description Every third-party action in `.github/` ran from a version tag like `actions/checkout@v7`. A tag can be moved to other code at any time. That is how `tj-actions/changed-files` leaked CI secrets from ~23,000 repos in March 2025. Here a moved tag would run with the release job's PyPI OIDC token (`id-token: write`) and the Docker job's `packages: write` token. Pinning to a commit SHA closes that, and a new test keeps it closed. Closes # ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Performance improvement - [x] Code refactoring (no functional changes) ## Changes Made - All 195 third-party `uses:` refs in 25 files now name the commit their tag points to today, with the version as a comment: `actions/checkout@3d3c42e5... # v7.0.1`. No action version changes. - Dependabot's existing `github-actions` config updates SHA pins and their version comments, so the pins stay current. - Pin dtolnay/rust-toolchain stable and 1.95.0 branches to their existing commit heads. The stable action retains its runtime toolchain input/default; the 1.95.0 action embeds toolchain: 1.95.0. This preserves each call site's existing toolchain selection. - New `test_every_action_is_pinned_to_a_commit_sha` in `scripts/tests/test_ci_workflow.py` fails on any tag-pinned action and lists each one. - Three tests in `tests/test_release_workflows.py` matched the old tag text (`setup-buildx-action@v4`, `gh-action-pypi-publish@vX.Y.Z`, `release-please-action@v4/v5`). They now match the SHA pin and its version comment. ## Testing - [x] Unit tests pass (`pytest`) - [x] Linting passes (`ruff check .`) - [ ] Type checking passes (`mypy headroom`) - [x] New tests added for new functionality - [x] Manual testing performed ### Test Output ```text $ uv run --frozen --extra dev pytest -q scripts/tests/test_ci_workflow.py scripts/tests/test_pr_health_workflow.py scripts/tests/test_normalize_release_pr_bodies.py tests/test_release_workflows.py 87 passed in 0.87s $ uv run --frozen --extra dev pytest -q scripts/tests/test_pr_health_labels.py scripts/tests/test_version_sync.py tests/test_cli/test_wrap_copilot.py tests/test_learn/test_subagent_scanning.py tests/test_plugin_manifests.py tests/test_pr208_changes.py 114 passed in 1.32s $ uvx ruff check scripts/tests/test_ci_workflow.py tests/test_release_workflows.py && uvx ruff format --check <same> All checks passed! ``` ## Real Behavior Proof - Environment: macOS, Python 3.12 via `uv run --frozen --extra dev`, branch cut from `main` at |
||
|
|
5698e91b2a |
chore(security): beacon rate limit, dev environment, weekly CodeQL triage (#4008)
SOC 2 follow-ups from the 2026-10-06 firewall review (R3, R4) and incident INC-2026-001. ## Beacon rate limit (R3) `deploy/beacon/wrangler.toml` said a WAF rule limited `/v1/logs` to 60 req/min/IP. That rule could not exist: headroomlabs.ai is not a Cloudflare zone, so the Worker is only on `workers.dev`. This adds a [Workers rate-limit binding](https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/) checked in `fetch()` **before** the body is read. - Keyed on one constant, not the IP: the Worker still never reads `cf-connecting-ip` (privacy promise in the file header). Trade-off: a flood also sheds real events for that minute. - 3000 req/min **per Cloudflare location** (~10x today's ~300/min total). - Returns 429, which the client does **not** treat as a gzip refusal (`_GZIP_REFUSED_STATUSES` is 400/415), so rate-limited clients keep compressing. - Fails open if the binding is absent **or the limiter itself errors** (review fix): a rate-limit service outage lets beacons through rather than dropping all of them. `node deploy/beacon/test-rollup.mjs` covers 429 over the limit, fail-open on outage and when unbound, and the single shared key. ## Dev environment (R4) `[env.dev]` deploys `headroom-beacon-dev` bound to the new `headroom-telemetry-dev` bucket (600/min limit). Already deployed and tested: a sample event returns 204, and a 2,500-request burst got 384 × 429. ## Weekly CodeQL triage `.github/workflows/codeql-triage.yml` opens an issue every Monday, assigned to @chopratejas (tejas@headroomlabs.ai), listing open critical/high alerts with checkboxes. Alert #63 sat unowned for five months; this gives alerts an owner and leaves an audit trail. **One issue per week, however often it runs (review fix).** The logic is in `scripts/codeql_triage.sh`: - It keys the issue on the ISO week, using a hidden marker in the body. - It finds the existing issue by listing security-labelled issues, closed ones included. It uses a listing, not search, so an issue created seconds earlier is not missed. - It reuses that issue and never edits, reopens or retitles it, so ticked boxes and closure stand. Alerts opened since then are added once, as a comment. - The jq programs live in quoted heredocs, which clears ShellCheck SC2016 without any shell expansion. - `tests/test_codeql_triage_script.py` runs the real script against a fake `gh`. It covers same-day re-runs, a Friday dispatch on a closed issue with ticked boxes, the next week, and the ISO year boundary (2027-01-01 is in 2026-W53). ### Test output ```text $ pytest -q tests/test_codeql_triage_script.py 6 passed $ node deploy/beacon/test-rollup.mjs rate limit: 429 over, fail-open on outage and when unbound ok $ shellcheck scripts/codeql_triage.sh && actionlint .github/workflows/codeql-triage.yml (clean) ``` ## ⚠️ Before deploying production The live `headroom-beacon` Worker predates #3253 (gzip inflate, schema v2 allowlist). `wrangler deploy` from main will ship that too, not just this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4008" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a> <!-- devin-review-badge-end --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: JerrettDavis <mxjerrett@gmail.com> |