sni: Add logic to allow pattern prefix match#1242
Merged
jrajahalme merged 1 commit intomainfrom Apr 1, 2025
Merged
Conversation
b7e63c3 to
8e14edb
Compare
8e14edb to
4bdbc38
Compare
jrajahalme
requested changes
Mar 31, 2025
Member
jrajahalme
left a comment
There was a problem hiding this comment.
We should remove the partial subdomain match, it is dangerous.
This commit is to support domain matching logic for SNI. Examples of valid matches: "*.example.com" matches: - "foo.example.com" - "bar.example.com" - "sub.example.com" but not: - "example.com" as wildcard requires exactly one label - "foo.bar.example.com" due to too many labels - "notexample.com" due to different domain Signed-off-by: Tam Mach <tam.mach@cilium.io>
4bdbc38 to
ce4b1c6
Compare
fristonio
added a commit
to fristonio/cilium-proxy
that referenced
this pull request
Jan 11, 2026
This commit adds support for specifying wildcard('*') anywhere in the
server names match pattern. This allow users to write more compressed
network policies and is inline with what cilium/cilium supports for FQDN
match patterns.
With this change users can now write allowed server names as:
- '**.cilium.io': Existing behavior which matches any number of
subdomain levels in the prefix. "test.cilium.io" and
"test.app.cilium.io" matches but "cilium.io" does not.
- '*.cilium.io': Existing behavior which matches all subdomains of
cilium.io on a single level. "test.cilium.io" matches but
"test.app.cilium.io" and "cilium.io" do not.
- 'sub*.cilium.io': Matches subdomains of cilium.io where the subdomain
component begins with "sub"(only one level). "sub.cilium.io" and
"subdomain.cilium.io" matches wile "www.cilium.io", "cilium.io" and
"test.subdomain.cilium.io" do not.
SNI match patterns are now implemented using regular expressions. The
required regex is derived and compiled once during xDS configuration
update.
If the match pattern doesn't contain any wildcard specifier the
implementation relies on explicit full string match.
Extends: cilium#1242
Related to: cilium/cilium#43597
Signed-off-by: Deepesh Pathak <deepesh.pathak@isovalent.com>
fristonio
added a commit
to fristonio/cilium-proxy
that referenced
this pull request
Jan 11, 2026
This commit adds support for specifying wildcard('*') anywhere in the
server names match pattern. This allow users to write more compressed
network policies and is inline with what cilium/cilium supports for FQDN
match patterns.
With this change users can now write allowed server names as:
- '**.cilium.io': Existing behavior which matches any number of
subdomain levels in the prefix. "test.cilium.io" and
"test.app.cilium.io" matches but "cilium.io" does not.
- '*.cilium.io': Existing behavior which matches all subdomains of
cilium.io on a single level. "test.cilium.io" matches but
"test.app.cilium.io" and "cilium.io" do not.
- 'sub*.cilium.io': Matches subdomains of cilium.io where the subdomain
component begins with "sub"(only one level). "sub.cilium.io" and
"subdomain.cilium.io" matches wile "www.cilium.io", "cilium.io" and
"test.subdomain.cilium.io" do not.
SNI match patterns are now implemented using regular expressions. The
required regex is derived and compiled once during xDS configuration
update.
If the match pattern doesn't contain any wildcard specifier the
implementation relies on explicit full string match.
Extends: cilium#1242
Related to: cilium/cilium#43597
Signed-off-by: Deepesh Pathak <deepesh.pathak@isovalent.com>
This was referenced Jan 11, 2026
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.
This commit is to support domain matching logic for SNI.
Examples of valid matches:
"*.example.com" matches:
but not: