You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generate_allowed_domains accepted * anywhere in a domain pattern (e.g., ex*ample.com, example.*, *.*.com), diverging from the documented *.mycompany.com convention.
Changes
src/compile/standalone.rs: Added a second validation pass after the character check. Any pattern containing * that isn't exactly a single leading *. prefix (with no further * in the remainder) now fails compilation with a descriptive error:
network.allow domain 'example.*' uses '*' in an unsupported position.
Wildcards must appear only as a leading prefix (e.g. '*.example.com').
tests/compiler_tests.rs: Added 5 tests covering valid (*.mycompany.com) and invalid (example.*, ex*ample.com, *.*.com, bare *) patterns.
CopilotAI
changed the title
[WIP] Fix wildcard position in network.allow domain patterns
chore: constrain wildcard position in network.allow domain patterns
Apr 14, 2026
Summary: Looks good — the wildcard validation logic is correct and the tests are comprehensive. One minor edge case worth noting.
Findings
⚠️ Suggestions
src/compile/standalone.rs:356 — The pattern *. (a wildcard followed by a bare dot, no TLD) passes the new validation. Evaluating:
host.starts_with("*.") → true
host[2..].contains('*') → false (empty string)
Result: accepted, inserted into the allowlist
This is almost certainly harmless (AWF's Squid proxy would not match anything meaningful against *.), but a stricter guard could also require !host[2..].is_empty() to block this degenerate form.
src/compile/standalone.rs:367-373 — network.blocked entries are inserted into HashSet::remove() with no character validation. Since blocked only performs exact set-membership removal (it can never add domains to the allowlist), there's no security risk — a malformed entry simply won't match. Still worth a follow-up to apply the same valid_chars check for consistency and early feedback to users who typo a blocked entry.
✅ What Looks Good
Panic safety: host[2..] is always a valid UTF-8 byte boundary because * and . are both single-byte ASCII, so the slice cannot split a multibyte character.
Logic correctness: The condition host.contains('*') && !(host.starts_with("*.") && !host[2..].contains('*')) correctly accepts only the *.label.tld form and rejects bare *, trailing .*, mid-string ex*ample.com, and double-wildcard *.*.com.
Test coverage: All five test cases map directly to the documented convention and its edge cases; the stderr assertion on "unsupported position" ties tests to the actual error message.
Error messages: Both error paths include the offending pattern and a concrete example of the correct form — good UX for pipeline authors.
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
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.
generate_allowed_domainsaccepted*anywhere in a domain pattern (e.g.,ex*ample.com,example.*,*.*.com), diverging from the documented*.mycompany.comconvention.Changes
src/compile/standalone.rs: Added a second validation pass after the character check. Any pattern containing*that isn't exactly a single leading*.prefix (with no further*in the remainder) now fails compilation with a descriptive error:tests/compiler_tests.rs: Added 5 tests covering valid (*.mycompany.com) and invalid (example.*,ex*ample.com,*.*.com, bare*) patterns.