Improve Domain Pattern Matching with Flexible Wildcard Support #250
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.
Summary
This PR improves the security of domain pattern matching in Smokescreen by implementing more flexible wildcard validation rules. The changes allow multiple wildcards in domain patterns while maintaining strong security boundaries to prevent overly broad matches.
Core Logic Changes
1. Changed Domain Validation (
pkg/smokescreen/acl/v1/acl.go
)2. Improved Pattern Matching (
pkg/smokescreen/acl/v1/acl.go
)*.example.com
continue to work exactly as before*.*.example.com
andapi.*.service.*.com
now work correctly3. Comprehensive Test Coverage (
pkg/smokescreen/acl/v1/acl_test.go
)TestACLAddInvalidGlob
to reflect new validation rules4. Documentation Updates (
README.md
)Examples of New Supported Patterns
✅ Now Allowed:
❌ Still Blocked (Security):
Downstream Impact
✅ Backward Compatible Changes
*.example.com
continue to work unchanged