Skip to content

fix: disable network policy enforcement by default#764

Merged
utksh1 merged 2 commits into
utksh1:mainfrom
ionfwsrijan:fix/network-policy-default-753
Jun 12, 2026
Merged

fix: disable network policy enforcement by default#764
utksh1 merged 2 commits into
utksh1:mainfrom
ionfwsrijan:fix/network-policy-default-753

Conversation

@ionfwsrijan

Copy link
Copy Markdown
Contributor

Description

Changes the default enforce_network_policy setting from True to False so the
tool is usable out of the box without manual configuration.

Changes Made

backend/secuscan/config.py

  • Changed enforce_network_policy default from True to False

Rationale

With network_allowlist=[] (empty) and enforce_network_policy=True, the network
policy engine denies all egress traffic by default, making the tool completely
unusable for scanning. Users who need egress restrictions can enable the policy
and configure their allowlist.

Fixes

Change enforce_network_policy default from True to False so the tool
is usable out of the box. Users can enable it and configure allowlist
for restricted environments.

Closes utksh1#753
@ionfwsrijan

Copy link
Copy Markdown
Contributor Author

@utksh1 Please review this

@utksh1 utksh1 added level:advanced 55 pts difficulty label for advanced contributor PRs type:security Security work category bonus label type:bug Bug fix work category bonus label area:backend Backend API, database, or service work area:security Security-sensitive implementation or tests labels Jun 11, 2026

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This changes a security-sensitive default and needs more work before it can merge.

Changing enforce_network_policy from true to false makes the tool easier to run, but it also disables the denylist protections for metadata, loopback, private, link-local, and ULA ranges by default. That is too broad for a security default change as a one-line patch.

Please preserve default denylist protection while solving the empty-allowlist usability problem. For example, make the policy allow public egress by default while still blocking denylisted/private ranges, or use a documented log-only onboarding mode with explicit tests. The PR also needs tests covering the default behavior so we do not regress into either deny-all scanning or allow-all internal egress.

…ault

Instead of disabling enforce_network_policy entirely (which kills denylist
protection), add implicit 0.0.0.0/0 and ::/0 allow rules when no explicit
allowlist is configured. The denylist is always checked first, so private,
metadata, loopback, link-local, and ULA ranges remain blocked.

Changes:
- Revert enforce_network_policy default back to True
- _init_default_policies: add implicit allow-all for public egress when
  network_allowlist is empty; warn only when custom allowlist is configured
- Update tests: empty allowlist now allows public IPs but blocks denylisted
  ranges; custom allowlist preserves deny-by-default behavior

Closes utksh1#753
@ionfwsrijan

Copy link
Copy Markdown
Contributor Author

@utksh1 I've made the changes. Please review

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved. The update preserves network policy enforcement by default, keeps denylisted/private ranges blocked, and only adds default public egress when no explicit allowlist is configured, with tests for public and denylisted ranges.

@utksh1
utksh1 merged commit 0ccb3c8 into utksh1:main Jun 12, 2026
11 checks passed
@utksh1 utksh1 added the gssoc:approved Admin validation: approved for GSSoC scoring label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work area:security Security-sensitive implementation or tests gssoc:approved Admin validation: approved for GSSoC scoring level:advanced 55 pts difficulty label for advanced contributor PRs type:bug Bug fix work category bonus label type:security Security work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Network Policy Default Configuration Blocks All External Scanning — Tool Unusable Out of the Box

2 participants