Skip to content

fix(ip): let a configured whitelist decide alone in route checks and isIpAllowed - #140

Merged
rennf93 merged 2 commits into
masterfrom
fix/ip-list-precedence
Oct 15, 2026
Merged

rennf93 merged 2 commits into
masterfrom
fix/ip-list-precedence

Conversation

@rennf93

@rennf93 rennf93 commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Closes #139

I aligned the two TypeScript IP list checks that still ran the blacklist first with the reference engine, where a configured whitelist decides alone and the blacklist applies only when no whitelist is configured.

  • checkRouteIpAccess now consults the route blacklist only when the route has no whitelist.
  • isIpAllowed now consults the blacklist only when no whitelist is configured.

The global pipeline path (checkIpAccess, IpSecurityCheck) already matched, and the new table asserts it. I added tests/test-utils/ip-list-precedence.test.ts with 120 rows generated by running the reference (check_ip_access, is_ip_allowed, check_route_ip_access): whitelist only, blacklist only, both with the IP in both, in neither, exact and CIDR forms, IPv4-mapped clients (evaluated after the canonical identity resolution the pipeline performs) and the unknown identity. On master 22 of the 320 assertions fail, all in isIpAllowed and checkRouteIpAccess. A second table of 243 rows composes route and global lists through the pipeline (a configured route whitelist skips the global lists) and already passes on master. Build, lint, test, coverage and conformance pass locally.

@github-actions github-actions Bot added area: checks Touches packages/core/src/core/checks/ area: utils Touches packages/core/src/utils.ts package: core Changes inside @guardcore/core tests Test suite changes (vitest) labels Oct 15, 2026
@rennf93
rennf93 merged commit 0f13b9f into master Oct 15, 2026
17 checks passed
@rennf93
rennf93 deleted the fix/ip-list-precedence branch October 15, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: checks Touches packages/core/src/core/checks/ area: utils Touches packages/core/src/utils.ts package: core Changes inside @guardcore/core tests Test suite changes (vitest)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IP blacklist is checked before the whitelist in route-level checks and isIpAllowed

1 participant