[Feat] Allow Firewall Port Ranges#1088
Open
RichardAnderson wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds firewall port range support across the firewall rule stack, updating backend validation/storage, frontend guidance, API docs, and tests.
Changes:
- Converts firewall rule ports from integer-style handling to string values that can hold single ports or
start:endranges. - Adds shared validation and normalization for port/range input.
- Updates UI help text, OpenAPI docs, factories, defaults, and feature/API tests.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
app/Actions/FirewallRule/ManageRule.php |
Normalizes port input, applies new validation rule, and refactors rule attribute/job handling. |
app/Models/FirewallRule.php |
Updates model typing/casts for string ports. |
app/Services/Firewall/AbstractFirewall.php |
Stores default firewall ports as strings. |
app/ValidationRules/PortOrPortRangeRule.php |
Adds validation for single ports and inclusive port ranges. |
database/factories/FirewallRuleFactory.php |
Emits string ports from the factory. |
database/migrations/2026_05_15_131942_change_firewall_rules_port_to_string.php |
Alters firewall_rules.port to string and defines rollback behavior. |
public/api-docs/openapi/firewall-rules.yaml |
Documents port range input for firewall rule creation. |
public/api-docs/openapi/schemas/FirewallRule.yaml |
Documents port range format on firewall rule responses. |
resources/js/pages/firewall/components/form.tsx |
Adds placeholder/help text for port range entry. |
resources/js/types/firewall.d.ts |
Changes frontend firewall rule port type to string. |
tests/Feature/API/FirewallTest.php |
Updates API expectations and adds valid integer/range input coverage. |
tests/Feature/FirewallTest.php |
Adds web feature coverage for ranges and invalid port inputs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for specifying firewall rule ports as either a single port or an inclusive port range (e.g., "3000:3010") throughout the application. It updates the backend, validation, database schema, API documentation, frontend, and tests to accommodate this new format, ensuring robust validation and clear user guidance.
Changes:
Database:
portfield in theFirewallRulemodel and related logic from an integer to a string to allow port ranges.Port field and validation:
FirewallRule.portfrom integer to string and added thePortOrPortRangeRulevalidator to support single ports and port ranges, including all related model, logic, and factory updates.firewall_rulestable, converting theportcolumn to string and handling rollback for port ranges.Business logic refactoring:
ManageRuleto normalize port input, centralize attribute mapping, and standardize job dispatching, improving maintainability and consistency.Frontend user experience:
Testing: