Skip to content

ask_unlisted gates the check once per virtual host instead of copying every route - #79

Merged
tudor-pop merged 1 commit into
masterfrom
78-ask-unlisted-without-route-copies
Dec 2, 2026
Merged

tudor-pop merged 1 commit into
masterfrom
78-ask-unlisted-without-route-copies

Conversation

@tudor-pop

Copy link
Copy Markdown
Contributor

Part of #78

ask_unlisted (v2.3.0) rendered the unlisted-origin ask as a copy of every route in each virtual host. This renders it as one ExtensionWithMatcher around ext_authz per environment, so the render no longer grows with the routes.

Measured on a file with 242 routes in each of three hosts and 20 listed origins:

v2.3.0 this branch
bytes the key adds 2,670,723 28,611 (the same at 50 to 1,000 routes)
Envoy heap at idle 222.0 MiB 24.0 MiB
container peak at start-up 236.5 MiB 35.7 MiB

Behaviour:

  • An origin in none of the lists is asked once, before CORS, with the question header.
  • A listed origin, a pattern origin, the exact own origin and a request with no Origin are never asked.
  • With the key, only the exact own origin (https, default port) is admitted unasked. The same host on another scheme or port is asked like any unlisted origin.
  • An admitted null origin gets no allow-origin header.
  • A file without the key renders byte for byte as v2.3.0.

Review focus:

  1. The skip matcher and the per-host enable in internal/render against Envoy 1.40's ExtensionWithMatcher, HttpFilter.disabled and FilterConfig (links in docs/origins.md).
  2. The CORS RE2 matcher never matching * or null (TestAskUnlistedCORSMatchers).
  3. The conformance scenario's ask counts: 20 rows, each asserting whether the check was asked.

Tests: go test ./...: 210 tests and 1,736 subtests, 0 failures. Conformance on Envoy 1.40: 20 of 20 rows. One review before this pull request; its findings are fixed here.

After the merge, v2.3.1 is tagged on the merged commit.

…d of copying every route (Part of #78)

v2.3.0 rendered the unlisted-origin ask as a copy of every route in each virtual host, each copy carrying one negated
Origin matcher per listed origin. On a file with 242 routes in each of three hosts and 20 listed origins the render
grew by 2.67 MB, and Envoy's heap at idle rose from 66.7 to 222.0 MiB with a start-up peak of 236.5 MiB.

The ask is now one ExtensionWithMatcher around ext_authz per environment. It skips any request the environment's hosts
and lists already admit, is turned on by the virtual host and off by its refused route, and the virtual host's RBAC
reads the check's answer. The virtual host's CORS policy admits an origin the check admitted with one RE2 matcher that
never matches "*" or "null". The key now adds a constant 28,611 bytes at any route count; at 242 routes Envoy's heap at
idle is 24.0 MiB and the container peaks at 35.7 MiB.

With the key, only the exact own origin (https, default port) is admitted unasked and gets its own allow-origin
header; the same host on another scheme or port is asked like any other unlisted origin. An admitted "null" origin gets
no allow-origin header. A file without the key renders byte for byte as v2.3.0.

The conformance scenario counts the questions the check receives, so every row asserts whether its request was asked:
20 rows on Envoy 1.40.
@tudor-pop
tudor-pop enabled auto-merge (rebase) December 2, 2026 22:10
@tudor-pop
tudor-pop merged commit 5014e08 into master Dec 2, 2026
1 check passed
@tudor-pop
tudor-pop deleted the 78-ask-unlisted-without-route-copies branch December 2, 2026 22:26
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.

1 participant