feat: make allow-domains optional (blocks all traffic when not specified)#80
feat: make allow-domains optional (blocks all traffic when not specified)#80
Conversation
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
|
@copilot pull the latest from main branch and commit and push |
Test Coverage Report
Coverage ThresholdsThe project has the following coverage thresholds configured:
Coverage report generated by `npm run test:coverage` |
src/cli.ts
Outdated
| if (allowedDomains.length > 0) { | ||
| logger.info(`Allowed domains: ${allowedDomains.join(', ')}`); | ||
| } else { | ||
| logger.info('Allowed domains: (all domains allowed)'); |
There was a problem hiding this comment.
shouldn't this be "all domains are not allowed?"
There was a problem hiding this comment.
Fixed in commit 0305e94. Changed the message from "(all domains allowed)" to "(none specified - all traffic allowed)" to make it clearer that when no domains are specified, the firewall allows all traffic (no filtering is applied).
There was a problem hiding this comment.
@copilot I thought when no domains are specified, then everything should be blocked, that's not the case?
There was a problem hiding this comment.
You're right to question this! The current implementation allows all traffic when no domains are specified (with warnings).
However, blocking all traffic when no domains are specified would be more secure. The original requirement said "make allow-domains optional" which I interpreted as allowing the tool to run without domains, but I can change it to block everything instead.
Which behavior would you prefer?
- Current (permissive): No domains = allow all traffic with warnings
- Secure (restrictive): No domains = block all traffic
If you want option 2, I'll update the code to block all traffic when no domains are specified.
There was a problem hiding this comment.
Implemented option 2 in commit 7532d22! When no domains are specified, all outbound traffic is now BLOCKED.
The changes include:
- Warning message: "
⚠️ WARNING: No domains specified - all outbound traffic will be BLOCKED" - Log message: "Allowed domains: (none specified - all traffic blocked)"
- Squid config: Generates "deny all" rule when domains array is empty
- Tests updated to verify blocking behavior
All 350 tests passing.
Integrates wildcard domain support and DNS server restrictions from main with the optional domains feature. Resolves merge conflicts by combining both features - domains are now optional, and when specified, support wildcards like *.github.com and api-*.example.com. Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Done! Merged latest changes from main branch in commit 651576e. The merge integrates:
All 259 tests passing. The optional domains feature now works with wildcards - when domains are specified, they're validated for wildcard patterns, and when no domains are specified, all traffic is allowed with security warnings. |
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
- Merged latest changes from main branch (v0.6.0) including log management features - Changed behavior: when no domains specified, all traffic is now BLOCKED (option 2) - Updated warning messages to reflect blocking behavior - Updated tests to match new blocking behavior - All 350 tests passing Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Makes the
--allow-domainsargument optional. When no domains are specified, all outbound traffic is blocked by default for security.Changes Made
CLI (
src/cli.ts)Allowed domains: (none specified - all traffic blocked)Squid Config Generator (
src/squid-config.ts)dstdomainanddstdom_regexACLsTests (
src/squid-config.test.ts)Behavior
*.github.com)Integration with Main Branch
Merged latest changes from main (v0.6.0):
*.github.com,api-*.example.com)--dns-serversflagvalidateDomainOrPattern()Testing
Example
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.