waf: pass managedRules through set spec and outputs (SPEC-waf-managed-rules row 7)#60
Draft
acoshift wants to merge 1 commit into
Draft
waf: pass managedRules through set spec and outputs (SPEC-waf-managed-rules row 7)#60acoshift wants to merge 1 commit into
acoshift wants to merge 1 commit into
Conversation
Re-pin github.com/deploys-app/api to d2704814 (waf-managed-rules) so the new managedRules field on WAFSet/WAFItem flows through the CLI: waf set -f zone.yaml carries it via the existing yaml unmarshal, and table output picks up the api Table() CRS column, yaml/json/toon the field itself — no runner code changes needed. Docs and help now state the whole-replace footgun (omitting managedRules disables and clears it — start from waf get output): the set case comment, the -f flag usage, the help.go short, and the README waf section. waf_test.go pins the spec-file contract (omitted → nil, enabled:false keeps tuning, waf get yaml round-trips into WAFSet) so an api yaml-tag regression fails loudly here. Re-pin to the post-merge api main pseudo-version before merging; the current pin is the unmerged api feature branch.
8a1c1e9 to
288d705
Compare
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.
Implements the deploys CLI row of SPEC-waf-managed-rules (§14 row 7, CLI notes in §6): pass the new
managedRulesblock throughwaf set/waf get/waf list.What changed
github.com/deploys-app/apitod2704814(the apiwaf-managed-rulesbranch) soWAFSet/WAFItemcarrymanagedRuleswith yaml/json tags and theCRStable column.-fusage now document the whole-replace contract — a spec that omitsmanagedRulesdisables and clears it, so always start fromwaf getoutput. No runner logic change: the set path unmarshals straight intoapi.WAFSet, and table/yaml/json/toon outputs pick the field up from the api module.waf sethelp/docs mentionmanagedRulesand the omit-clears footgun.managedRulesdecodes to nil (server clears),enabled:falsekeeps the curatedexcludedRulestuning, andwaf getyaml (with read-only extras) round-trips intoWAFSetintact.Test evidence
gofmt -l .clean;go build ./...andgo vet ./...pass.go test ./...: 82 tests pass in 3 packages (repo has no PR CI; verified locally).managedRulesmarshals as JSON"managedRules":nullon the wire (= server clears, matching whole-replace semantics); full-knob block round-trips.Merge gate (why this is a draft)
The api pin
v0.0.0-20260711014233-d27048143494is the unmerged apiwaf-managed-rulesbranch (api PR not opened/merged yet; api main head is7488037). api squash-merges, so this hash will never land on main. Per spec §14 sequencing, do not merge until the api contract PR merges, then re-pin go.mod to the post-merge api main pseudo-version (also picks up any api review fixes).Rollout (spec §11)
This CLI change is inert until the platform side ships; sequence:
CORAZA_ENABLED=trueon target clusters — everything gates on this release.managed_rulescolumn migration, then deploy the binary (migration-before-binary).features.waf.managedRuleson the enabled locations (ops SQL, by name).waf setwithmanagedRulesreturnsapi.ErrLocationNotSupport— this CLI is safe to ship early once re-pinned.Expected conflicts with sibling WAF branches
Three CLI WAF drafts re-pin go.mod to different unmerged api feature-branch pseudo-versions: this PR
d27048143494, #59 (waf-events)380d9eb5c22f, #58 (waf-ip-lists)2a1d11a0be1d. go.mod/go.sum conflict pairwise; resolution: whichever merges after the first takes a fresh single pin to an api main pseudo-version containing all merged api PRs.internal/runner/waf.gomerges cleanly with #59 (this PR edits thesetcase; #59 adds aneventscase afterdelete); no file overlap with #58 (new waflist.go + its help.go entry — help.go may need a trivial adjacent-line merge). There is no deploys-repo waf-test branch (api-side only).