Repository navigation
feat(argocd): GitHub push webhook on a locked-down public host - #307
Open
arunanshub wants to merge 2 commits into
Open
arunanshub wants to merge 2 commits into
arunanshub wants to merge 2 commits into
Conversation
Argo CD now refreshes on push instead of waiting up to ~3 minutes for its poll. GitHub delivers to argocd-hook.arunanshu.dev/api/webhook; the UI host stays behind the wildcard Access OTP. Four independent layers keep the public host narrow: - Cloudflare WAF custom rule: only GitHub's `hooks` CIDRs (read from api.github.com/meta each plan), only POST /api/webhook. - Cloudflare Access: path-scoped bypass for /api/webhook only. - Traefik: HTTPRoute matches only POST /api/webhook, behind a RateLimit middleware (per-host bucket; remote addr is cloudflared's). - Argo CD: HMAC check via webhook.github.secret, resolved from the sealed argocd-webhook-github Secret through a $ref; body capped at 5MB. The secret is generated in tofu state and flows to kubeseal (`just seal-argocd-webhook`) and the GitHub API (`just github-argocd-webhook`) without being printed. Polling stays at the chart default as the fallback. Rollout, triage and rotation are in docs/runbooks/argocd-webhook.md. The sealed secret is not in this commit: it must be generated from tofu state after `just infra-apply`, so check-manifests fails until it lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ApgDFwSZDFKWW75JMu3hXu
The prod overlay only holds the Application, so check-manifests never builds the component's resources/; the render job does, and that is the one that fails until the SealedSecret is committed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ApgDFwSZDFKWW75JMu3hXu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Argo CD refreshes on push instead of waiting up to ~3 minutes for its poll. GitHub delivers to
argocd-hook.arunanshu.dev/api/webhook;argocd.arunanshu.devstays behind the Access OTP.Layers
infra/cloudflare_waf.tfhooksCIDRs only (fromapi.github.com/meta, re-read every plan),POST /api/webhookonlyinfra/cloudflare_access.tf/api/webhookpath only; other paths on the host still hit OTPkubernetes/components/argocd-webhookPOST /api/webhook; RateLimit 30/min, burst 30webhook.github.secret($argocd-webhook-github:secretref); body ≤ 5MBSecret:
random_passwordin tofu state →just seal-argocd-webhook→ SealedSecret; and →just github-argocd-webhook→ GitHub API. Never printed.Before merging
cloudflare_ruleset.zone_custom_firewallowns the zone's custom-rules entry point; import any existing rules first.just infra-applyjust seal-argocd-webhook, commitgithub-secret.sealedsecret.yamlhere. TheRender diffCI job fails until this lands (kustomize buildof the component resources can't find the file) (deliberate: no placeholder secret).After merging
argocdApplication (no auto-sync), then check the liveargocd-secret/argocd-cm.just github-argocd-webhook, push something, watch Recent Deliveries.Known risk: Bot Fight Mode
It's on in
cloudflare_hardening.tf, runs outside the Ruleset Engine, and cannot be skipped by any custom rule. If it challenges GitHub's deliveries, the fix is an IP Access allow rule for the hook CIDRs or turning it off. Both are zone-wide, so neither is included here. Triage table indocs/runbooks/argocd-webhook.md.Validation run locally
tofu fmt -check,tofu validate(lock file updated forhashicorp/http3.6.3)opsctl verify-adoption: invariant holdsyamlfmt -lint,just --fmt --check, gitleaks: cleanpart-oflabel lands inspec.template.metadata.labelsNot run:
render-diff/ conftest (CI does it),infra-plan(needs your state).https://claude.ai/code/session_01ApgDFwSZDFKWW75JMu3hXu
Generated by Claude Code