Repository navigation
Reject invalid domain allowlist forms and normalize scheme casing - #11952
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
The shared-parser change affects protocol-scoped Squid enforcement and automatic host access, with host-gateway routing and default-port interactions beyond the limited, contract-preserving review scope.
No open issues 🎉
What changed in this PR
This PR addresses #11926 by rejecting domain allowlist entries that cannot match Squid ACLs and handling HTTP/HTTPS prefixes case-insensitively while preserving protocol restrictions.
Changes:
- Reject ports, URL paths, queries, user information, and unsupported schemes with actionable errors.
- Reuse the shared protocol parser for localhost and host-gateway detection.
- Add regression coverage and document accepted domain syntax.
| File | Description |
|---|---|
src/squid-config-domains.test.ts |
Tests mixed-case protocol restrictions and rejection of invalid ACL inputs. |
src/parsers/dns-parsers.ts |
Uses shared parsing for localhost and host-gateway normalization. |
src/parsers/dns-parsers.test.ts |
Covers mixed-case prefixes and trailing slashes in host detection. |
src/domain-validation.ts |
Rejects unsupported domain-entry syntax with guidance. |
src/domain-patterns.ts |
Recognizes HTTP/HTTPS prefixes case-insensitively. |
src/domain-patterns.test.ts |
Covers accepted syntax and newly rejected forms. |
docs/usage.md |
Documents accepted entries and alternatives for paths and ports. |
Review effort: Balanced (adaptive)
|
✅ Copilot review passed with no inline comments. @lpcox Add the |
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 7e8df78 |
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 94.45% | 94.44% | 📉 -0.01% |
| Statements | 93.08% | 93.07% | 📉 -0.01% |
| Functions | 93.64% | 93.64% | ➡️ +0.00% |
| Branches | 87.37% | 87.36% | 📉 -0.01% |
📁 Per-file Coverage Changes (2 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/nvx/one-shot-process.ts |
84.0% → 81.5% (-2.47%) | 76.8% → 74.7% (-2.11%) |
src/commands/main-action-cleanup.ts |
97.9% → 96.9% (-1.03%) | 98.0% → 97.0% (-0.99%) |
Coverage comparison generated by scripts/ci/compare-coverage.ts
--allow-domainsand--allow-domains-fileaccept ports, URL paths, unsupported schemes, and mixed-case prefixes that produce nonmatching Squid ACLs. Users see unexpected 403s instead of configuration errors.