Skip to content

[release-v3.30] fix(dikastes): register ALPCheckProvider to restore L7 policy enforcement#12004

Open
electricjesus wants to merge 3 commits intorelease-v3.30from
cherry-pick-11986-release-v3.30
Open

[release-v3.30] fix(dikastes): register ALPCheckProvider to restore L7 policy enforcement#12004
electricjesus wants to merge 3 commits intorelease-v3.30from
cherry-pick-11986-release-v3.30

Conversation

@electricjesus
Copy link
Member

@electricjesus electricjesus commented Mar 5, 2026

Cherry-pick of #11986 to release-v3.30.

The staged policies refactoring (931244d, #9804) introduced a CheckProvider plugin interface in dikastes but never registered a provider in OSS. This caused all ext_authz Check requests to return UNKNOWN, which Envoy treats as a denial — breaking L7 application layer policy for all OSS users since v3.30.0.

This PR adds an ALPCheckProvider that wraps the existing checkStore logic and registers it in dikastes, restoring policy evaluation for the ext_authz Check RPC.

Fixes #11857

Release note:

Fix Dikastes (L7 application layer policy) returning UNKNOWN for all ext_authz Check requests, which Envoy treats as 403. Register ALPCheckProvider to restore L7 policy enforcement.

…ment

The staged policies refactoring (931244d) introduced a CheckProvider
plugin interface but never registered a provider in OSS. This caused all
ext_authz Check requests to return UNKNOWN, breaking L7 application
layer policy for all OSS users since v3.30.0.

Add an ALPCheckProvider that wraps the existing checkStore logic and
register it in dikastes, restoring policy evaluation for the ext_authz
Check RPC.

Fixes #11857
…tests

Extract the check server setup (provider registration + gRPC service
registration) into newCheckServer(), called by both runServer() and the
FV tests. This ensures the tests exercise the exact same wiring as
production, so removing a provider from newCheckServer will fail FV
tests immediately.

Also uses the existing RegisterGRPCServices() method, removing the need
for the v2/v2alpha authz imports from dikastes.go.
Copilot AI review requested due to automatic review settings March 5, 2026 10:51
@electricjesus electricjesus requested a review from a team as a code owner March 5, 2026 10:51
@electricjesus electricjesus added release-note-required Change has user-facing impact (no matter how small) docs-not-required Docs not required for this change labels Mar 5, 2026
@marvin-tigera marvin-tigera added this to the Calico v3.30.6 milestone Mar 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Restores dikastes L7 application-layer policy (ALP) enforcement on the release-v3.30 branch by registering the missing ALPCheckProvider, and adds end-to-end FV coverage to prevent regressions.

Changes:

  • Register ALPCheckProvider via a shared newCheckServer() wiring function used by both production and tests.
  • Add a new ALPCheckProvider implementation that delegates to existing checkStore evaluation.
  • Add FV tests that exercise the full Felix sync → policy store → ext_authz Check gRPC flow.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app-policy/cmd/dikastes/dikastes.go Centralizes ext_authz server/provider registration in newCheckServer() and removes redundant v2/v2alpha wiring.
app-policy/cmd/dikastes/dikastes_fv_test.go Adds FV tests covering allow/deny and HTTP method L7 matching through real gRPC + UDS plumbing.
app-policy/checker/alp_check_provider.go Introduces ALPCheckProvider to evaluate ALP using existing policy store logic.
app-policy/checker/alp_check_provider_test.go Unit tests for ALPCheckProvider behavior.
app-policy/checker/server_test.go Updates server tests to register providers and validate expected status codes.

Comment on lines +274 to +278
func (e *dikastesTestEnv) cleanup() {
_ = e.authzConn.Close()
e.dikastesGRPC.GracefulStop()
_ = os.RemoveAll(e.socketDir)
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

dikastesTestEnv.cleanup() stops the dikastes gRPC server but never stops the fake Felix PolicySync gRPC server (testSyncServer.grpcServer) or closes its listener. That can leak goroutines/file descriptors across tests and makes failures harder to diagnose. Consider adding a Stop/GracefulStop method on testSyncServer and invoking it from cleanup (and closing the listener).

Copilot uses AI. Check for mistakes.
Comment on lines +286 to +290
grpcServer *grpc.Server
listener net.Listener
cLock sync.Mutex
cancelFns []func()
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

testSyncServer keeps cLock and cancelFns state that is only ever appended to in Sync() and never used elsewhere. If restart/connection-cancel behavior isn't needed in these FV tests, removing this unused state would simplify the fake server; otherwise, wire it into cleanup/stop logic so it has an effect.

Copilot uses AI. Check for mistakes.
On release-v3.30, TierInfo.IngressPolicies is []string (not
[]*PolicyID) and Policy has no Tier field. Update the FV test to
match the proto types on this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required Docs not required for this change release-note-required Change has user-facing impact (no matter how small)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants