Skip to content

Commit 334ae10

Browse files
committed
test(cli): update allow-CIDR e2e for declaration-ceiling semantics
With http-client migrated to declare host = "*", a user rule that's CIDR-only (no host) has nothing to intersect with at the declaration layer — the effective allow becomes empty and the HTTP layer denies at decide_uri before DNS runs. Update the expected error from DnsError (old DNS-resolver-filter path) to HttpRequestDenied and rename the test to reflect that CIDR-only user rules are no longer effective against host-based declarations.
1 parent c3614f0 commit 334ae10

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

act-cli/tests/http_policy_e2e.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,14 @@ fn deny_cidr_blocks_with_dns_error() {
198198
}
199199

200200
#[test]
201-
fn allow_cidr_only_blocks_name_whose_ips_miss_cidr() {
202-
// Closes the allow-CIDR symmetry: mode=Allowlist with only an
203-
// allow-CIDR rule. HTTP layer defers to the DNS resolver for named
204-
// hosts; resolver drops IPs that aren't in the allow CIDR. example.com
205-
// resolves to public IPs well outside 10/8, so the request must fail
206-
// with DnsError.
201+
fn allow_cidr_only_blocks_when_no_host_match() {
202+
// A user rule that's CIDR-only (no host) doesn't intersect with the
203+
// component's host-based declaration (`host = "*"` or any other host
204+
// pattern). After the effective-policy filter, the effective allow
205+
// is empty, so the HTTP layer denies at decide_uri before DNS even
206+
// runs. This is correct under the declaration-as-ceiling model:
207+
// components declare peers by name, and user-policy CIDR-only rules
208+
// have no declared host to pair with.
207209
let Some(wasm) = skip_if_not_migrated() else {
208210
return;
209211
};
@@ -217,10 +219,10 @@ fn allow_cidr_only_blocks_name_whose_ips_miss_cidr() {
217219
"--args",
218220
r#"{"url":"https://example.com"}"#,
219221
]);
220-
assert!(!ok, "expected allow-CIDR to block; stderr: {stderr}");
222+
assert!(!ok, "expected allow-CIDR-only to block; stderr: {stderr}");
221223
assert!(
222-
stderr.contains("DnsError"),
223-
"expected DnsError from allow-CIDR filter, got: {stderr}"
224+
stderr.contains("HttpRequestDenied") || stderr.contains("blocked by ACT policy"),
225+
"expected HttpRequestDenied from effective-empty-allow, got: {stderr}"
224226
);
225227
}
226228

0 commit comments

Comments
 (0)