Skip to content

Feature: Option to show all Windows Firewall rules - #3630

Merged
mergify[bot] merged 9 commits into
BornToBeRoot:mainfrom
omrzgit:feature/firewall-load-windows-rules-option
Oct 20, 2026
Merged

mergify[bot] merged 9 commits into
BornToBeRoot:mainfrom
omrzgit:feature/firewall-load-windows-rules-option

Conversation

@omrzgit

@omrzgit omrzgit commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request

  • Added a "Show all rules" option in the Firewall tool to display all Windows Defender Firewall rules in addition to rules created by NETworkManager
  • Optimized rule loading in Firewall.cs using bulk filter retrieval with hashtable mapping across port, address, application, and interface filters to query entire system rulesets in a single pass (~18s for 800+ rules instead of individual per-rule queries)
  • Added Firewall_ShowAllRules setting property in SettingsInfo.cs and GlobalStaticConfiguration.cs (defaults to false, preserving existing behavior and sub-second startup load time)
  • Added a CheckBox toggle in FirewallView.xaml toolbar beside the Search box and Refresh button
  • Added localization string ShowAllRules in Strings.resx / Strings.Designer.cs

Summary

Previously, the Firewall tool only displayed rules whose display name started with NETworkManager_. While this isolated rules managed directly by NETworkManager, users were unable to view or inspect the system's full firewall configuration. This PR introduces an optional "Show all rules" toggle in the toolbar. When unchecked (default), it preserves the fast, scoped behavior. When checked, it loads and maps all Windows Firewall rules on the system.

Contributing

By submitting this pull request, I confirm the following:

@mergify

mergify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@BornToBeRoot

Copy link
Copy Markdown
Owner

@omrzgit Thanks! I added some more features and guards to this PR.

We need to block Edit rule for rules not managed by NETworkManager, because the Edit dialog and the logic behind it can't handle every case yet (e.g. services). Enable, disable and delete aren't a problem, and Copy as works as well: the copy just doesn't include the unsupported properties, and a warning is shown in that case.

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.

🟡 Changes recommended

Copying an interface-restricted Allow rule can silently discard its adapter restriction and broaden network access.

1 open issue
1 file not reviewed
  • Source/NETworkManager.Localization/Resources/Strings.Designer.cs: Generated file
What changed in this PR

Adds optional system-wide firewall rule visibility to NETworkManager while retaining the managed-only default.

Changes:

  • Adds Firewall settings, bulk rule loading, source indicators and loading feedback.
  • Preserves unsupported properties during edits and adds safeguards for external rules.
  • Updates exports, validation, localization and documentation.
File Description
Website/​docs/​changelog/​next-release.md Documents features and fixes.
Website/​docs/​application/​firewall.md Explains settings and rule restrictions.
Source/​NETworkManager/​Views/​FirewallView.xaml.cs Adds double-click editing.
Source/​NETworkManager/​Views/​FirewallView.xaml Adds rule indicators, safeguards and loading states.
Source/​NETworkManager/​Views/​FirewallSettingsView.xaml.cs Connects the settings view model.
Source/​NETworkManager/​Views/​FirewallSettingsView.xaml Adds the visibility toggle.
Source/​NETworkManager/​Views/​FirewallRuleChildWindow.xaml Improves scrolling and path validation.
Source/​NETworkManager/​ViewModels/​SettingsViewModel.cs Routes to Firewall settings.
Source/​NETworkManager/​ViewModels/​HostsFileEditorViewModel.cs Aligns confirmation list formatting.
Source/​NETworkManager/​ViewModels/​FirewallViewModel.cs Coordinates loading, editing and warnings.
Source/​NETworkManager/​ViewModels/​FirewallSettingsViewModel.cs Manages the visibility preference.
Source/​NETworkManager/​ViewModels/​FirewallRuleViewModel.cs Shares supported protocol definitions.
Source/​NETworkManager/​DialogHelper.cs Formats bulleted confirmation lists.
Source/​NETworkManager.Validators/​EmptyOrFileExistsValidator.cs Supports environment-variable expansion.
Source/​NETworkManager.Settings/​SettingsViewManager.cs Registers Firewall settings.
Source/​NETworkManager.Settings/​SettingsInfo.cs Stores the visibility preference.
Source/​NETworkManager.Settings/​GlobalStaticConfiguration.cs Keeps managed-only visibility as default.
Source/​NETworkManager.Models/​Firewall/​FirewallRuleSource.cs Defines rule origins.
Source/​NETworkManager.Models/​Firewall/​FirewallRuleProgram.cs Preserves program paths and keywords.
Source/​NETworkManager.Models/​Firewall/​FirewallRuleNotFoundException.cs Identifies missing-rule failures.
Source/​NETworkManager.Models/​Firewall/​FirewallRuleHiddenProperties.cs Tracks unsupported traffic restrictions.
Source/​NETworkManager.Models/​Firewall/​FirewallRule.cs Adds source and compatibility metadata.
Source/​NETworkManager.Models/​Firewall/​Firewall.cs Implements bulk loading and in-place updates.
Source/​NETworkManager.Models/​Export/​ExportManager.FirewallRule.cs Preserves interface-type display values.
Source/​NETworkManager.Localization/​Resources/​Strings.resx Adds labels and warnings.
Source/​NETworkManager.Localization/​Resources/​Strings.Designer.cs Exposes new localized resources.
Source/​NETworkManager.Documentation/​DocumentationManager.cs Maps Firewall settings to documentation.
Source/​NETworkManager.Controls/​ObservableRangeCollection.cs Batches collection replacement notifications.

Review effort: Balanced

Comment on lines +206 to +209
HiddenProperties = ParseHiddenProperties(
result.Properties["IcmpType"]?.Value?.ToString(),
result.Properties["Service"]?.Value?.ToString(),
result.Properties["Package"]?.Value?.ToString()),
@mergify
mergify Bot merged commit e14a9bf into BornToBeRoot:main Oct 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants