Skip to content

chore: initialize main branch#11

Merged
feiskyer merged 3 commits into
mainfrom
initialize-main
May 9, 2022
Merged

chore: initialize main branch#11
feiskyer merged 3 commits into
mainfrom
initialize-main

Conversation

@mainred

@mainred mainred commented May 6, 2022

Copy link
Copy Markdown
Member

We moved the legacy code to legacy branch, and this main branch starts from 31d6360

@zhiying-lin zhiying-lin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@feiskyer
feiskyer merged commit 59be9e1 into main May 9, 2022
@feiskyer
feiskyer deleted the initialize-main branch May 9, 2022 02:34
mainred pushed a commit that referenced this pull request Jun 14, 2022
chore: initialize main branch
rchincha added a commit to rchincha/fleet-networking that referenced this pull request Jul 21, 2026
…curityPolicy attach

Extends the FrontDoorProfile reconciler with the WAF enforcement path described
in docs/first-party/002-afd-implementation-plan.md Azure#11:

- spec.wafPolicy nil + ComplianceMode=None -> no WAF; any prior fleet-managed
  SecurityPolicy is drift-deleted so a user who clears the field does not
  leave stale WAF attachment behind. Programmed=True.
- spec.wafPolicy set -> resolve the referenced Microsoft.Network/
  frontdoorwebapplicationfirewallpolicies resource via armfrontdoor
  PoliciesClient, then upsert a Microsoft.Cdn/profiles/{}/securityPolicies/
  fleet-waf-{uid} of type WebApplicationFirewall binding the policy to the
  default AFD endpoint (path "/*"). Programmed=True.
- ComplianceMode=SFI-NS253 -> additionally require PolicySettings.Mode ==
  Prevention; Detection or nil-Mode is rejected with
  Reason=WAFPolicyNotInPreventionMode so an SFI-audited tenant cannot ship
  a WAF policy that only observes traffic.

Terminal client rejections (WAFPolicyNotFound, WAFPolicyNotInPreventionMode,
malformed ID, cross-subscription ref) short-circuit before Programmed=True is
set, so a single Programmed condition remains authoritative for readiness.
Cross-subscription refs are intentionally rejected in POC scope because the
Clients bundle does not build a per-sub armfrontdoor client yet; the message
tells the operator exactly why.

Reconciler gains WAFPoliciesClient, SecurityPoliciesClient, and
SubscriptionID fields (last cached because neither SDK client exposes it and
the resolver needs it for cross-sub detection).

Test scaffolding:
- WAFPolicyFake exposes SetPolicy/DeletePolicy for pre-seeding a policy at
  a specific PolicyMode; the reconciler only reads so the store is
  test-owned.
- SecurityPolicyFake exposes GetStored so specs can assert on the exact
  ARM ID, WafPolicy.ID, and Association domains the reconciler wrote.
- Endpoint fake now populates .ID on create; a nil ID would silently
  produce an empty Association and mask bugs.

No new envtest specs land in this commit -- suite_test.go only wires the
fakes so the existing happy-path spec keeps passing. Specs exercising the
three WAF paths (happy / NotFound / NotInPrevention) land next.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a8fabc68-e113-49ef-b82d-d99a8502da11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants