Skip to content

Reject invalid domain allowlist forms and normalize scheme casing - #11952

Merged
lpcox merged 2 commits into
mainfrom
copilot/fix-allow-domains-acl-matching
Nov 22, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/fix-allow-domains-acl-matching

Conversation

@lpcox

@lpcox lpcox commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

--allow-domains and --allow-domains-file accept ports, URL paths, unsupported schemes, and mixed-case prefixes that produce nonmatching Squid ACLs. Users see unexpected 403s instead of configuration errors.

  • Validation: Reject ports, paths, queries, user information, and unsupported schemes with actionable errors rather than silently stripping restrictions.
  • Protocol handling: Recognize HTTP/HTTPS prefixes case-insensitively while preserving protocol-specific ACLs. Use the shared parser for localhost and host-gateway detection.
  • Regressions and documentation: Cover rejected forms and mixed-case prefixes; document accepted syntax, including wildcards and a single trailing slash.
HTTPS://api.github.com        → HTTPS-only ACL for .api.github.com
github.com:443               → error: use a bare domain without a port
https://github.com/org/repo   → error: use --allow-urls with --ssl-bump
ftp://example.com            → error: only HTTP/HTTPS prefixes supported

@lpcox lpcox changed the title [WIP] Fix ACL matching for allow-domains with various inputs Reject invalid domain allowlist forms and normalize scheme casing Nov 22, 2026
@lpcox
lpcox marked this pull request as ready for review November 22, 2026 17:24
Copilot AI adaptive review requested due to automatic review settings November 22, 2026 17:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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)

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11952 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 7e8df78

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

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

@lpcox
lpcox merged commit b212d8f into main Nov 22, 2026
42 of 45 checks passed
@lpcox
lpcox deleted the copilot/fix-allow-domains-acl-matching branch November 22, 2026 17:52
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.

--allow-domains accepts host:port, URL paths, and non-lowercase schemes, but the generated ACL never matches

3 participants