ci: add AUTO_SYNC_TOKEN rotation drift canary (#72) #77
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/issue-72-auto-sync-token-canary-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #72. Addresses hostile-self-review weakest-spot #3 from PR #66.
Summary
New workflow
.github/workflows/auto-sync-canary.yml. Runs every 6h (and on workflow_dispatch). Read-only verification of the auth surface thatauto-sync-main-to-staging.ymldepends on. Goes RED with an actionable error message whenAUTO_SYNC_TOKENhas drifted out of validity, instead of waiting for the next push to main to expose the breakage.What it checks
GET /api/v1/user→ token authenticates AND resolves todevops-engineer(not founder PAT, not another persona).GET /api/v1/repos/molecule-ai/molecule-core→ token hasread:repositoryscope on this repo.git ls-remote refs/heads/stagingviahttps://oauth2:<token>@.../→ exact HTTPS auth path used byactions/checkoutstep in the real auto-sync workflow.Design choice (from issue #72)
Option B (read-only verify), rejecting Options A (full sync on schedule — clutters staging with synthetic merge commits) and C (push to canary branch — duplicates
branch-protection-drift.yml's authz coverage). Prior art: Cloudflare's/user/tokens/verify, AWS Secrets Manager rotation Lambda'stestSecret, HashiCorp Vault'svault token lookup.Hardening
feedback_schedule_vs_dispatch_secrets_hardening). The 2026-04-28 sweep-cf-orphans #2088 lesson: a janitor that silently soft-skips on missing secrets is indistinguishable from a healthy one.-H "Authorization: token $VAR"; thegit ls-remoteURL is composed in a local var; sed-redaction on any error output that prints response bodies. GitHub Actions secret-masking covers anything that slips through.AUTO_SYNC_TOKENfrom the workflow under monitor. Same blast radius. Read-only paths only.Operator runbook
In the workflow header. Includes:
Verification
python3 -c 'yaml.safe_load(...)')17 */6 * * *, permscontents: read, no token leaks in sourcerun:blockworkflow_dispatchonce PR lands and verify GREEN end-to-endsecretsoverride on a fork branch)Coordination
Test plan
AUTO_SYNC_TOKENto junk via repo Actions secret, trigger, confirm RED with one of the three actionable errors.Refs: #72 (this issue), #66 (the auto-sync fix being monitored)
The two API probes used the unsafe shape rejected by lint-curl-status-capture.yml (per feedback_curl_status_capture_pollution): status=$(curl ... -w '%{http_code}' ... || echo "000") When curl exits non-zero (transport error, --fail-with-body 4xx/5xx), the `-w` already wrote a code; the `|| echo "000"` then APPENDS another "000", yielding "000000" or "409000" — passes shape checks while looking right. Switch to the canonical safe shape (set +e + tempfile + cat): set +e curl ... -w '%{http_code}' >code_file 2>/dev/null set -e status=$(cat code_file 2>/dev/null || true) [ -z "$status" ] && status="000" Inline comment in both probe steps explains the lint constraint so the next editor doesn't re-introduce the bad pattern. Refs: #72, lint failure on PR #77 (1/22 red → 22/22 expected green)Phase 4 verification — final
CI status on
e4e1bf40(latest)detect-changesaggregators0cef033a)Blocked by required conditionsdescription — these are matrix-dependent jobs whose path-filter aggregator (detect-changes) ALREADY ran and emitted skip-success, but the dependent jobs don't auto-resolve in Gitea Actions. This is a known org-wide infra issue (perfeedback_branch_protection_check_name_parity), not a regression introduced by this PR. The same shape exists on every PR that doesn't touch the matrix's path filters.pr-guards / disable-auto-merge-on-push. Pre-existing infra gap (depends onmolecule-ai/molecule-cireusable workflow that appears unavailable post-Gitea migration). Out of scope for this PR; sister agent #197 sweep agent's territory.Local probe verification (since Gitea 1.22.6 doesn't expose REST workflow_dispatch)
Ran all three probes against live Gitea using my admin token, then mutated each:
Hostile self-review weakest-3 (commit history)
e4e1bf40with inline comment pointing at all three files that must update together (auto-sync workflow's git config + this canary + staging branch protection's whitelist).--dry-runsemantics + branch-protection prevent staging-deletion.Ready to merge
From my side: yes. From CI's side: blocked by the pre-existing pr-guards infra gap. Recommend merge as-is when an operator decides to override (the actual signal-bearing checks are green and this is additive behaviour — new file only).
Pure additive new workflow (auto-sync-canary.yml). 6h cron + workflow_dispatch trigger. 3-probe read-only verify of AUTO_SYNC_TOKEN. Hostile self-review caught + fixed false-green probe (ls-remote → push --dry-run). All real signal-bearing CI green; pre-existing pr-guards red is org-wide gap (sister #197 territory). Token never echoed. Closes #72. Ready to merge.
Auto-sync-canary.yml synthetic check (#198). 6h cron + workflow_dispatch. 3-probe read-only verify of AUTO_SYNC_TOKEN: GET /user, GET /repos, git push --dry-run. Hostile-review caught + fixed false-green probe (ls-remote → push-dry-run). All real signal-bearing CI green. Ready.