Skip to content

Port/ICMP parameter ranges should enforce first <= last#8578

Merged
FelixMcFelix merged 5 commits into
mainfrom
felixmcfelix/firewall-nonempty-ranges
Jul 11, 2025
Merged

Port/ICMP parameter ranges should enforce first <= last#8578
FelixMcFelix merged 5 commits into
mainfrom
felixmcfelix/firewall-nonempty-ranges

Conversation

@FelixMcFelix

@FelixMcFelix FelixMcFelix commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

The console correctly prevents ranges like 3000-1000 for L4PortRanges, but we don't catch this in the API itself. This PR enforces that on the frontend, with some allowances for the fact that we might still have such rows in CRDB.

I was torn between enforcing this using transparent types to apply the first/last constraint, which worked in terms of being invisible in the JsonSchema, versus what I did here which is just checking the invariant on conversion to a db::VpcFirewallRule. Unfortunately the former was far messier, and ended up splitting the logic such that it was a little harder to intuit what was checked and where. So, we validate this next to the filter array length checks, which felt fairly natural.

Sort of confirms where we're at -- we're accepting mis-specofoed ranges.
Now we just need to make sure that bad values in the database don't get
us in trouble.
@FelixMcFelix FelixMcFelix marked this pull request as ready for review July 11, 2025 15:40

@david-crespo david-crespo 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.

LGTM!

@FelixMcFelix FelixMcFelix merged commit 37dd38a into main Jul 11, 2025
16 checks passed
@FelixMcFelix FelixMcFelix deleted the felixmcfelix/firewall-nonempty-ranges branch July 11, 2025 16:35
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.

2 participants