FAILURE MAP
← Case archive

FA-74171 / Feature flag rollout bucketing / Open access

Network allowlist clause: Entries with host bits never match · case 01

An entry written as 10.1.2.77/24 silently matches nothing.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The masked ip is compared with the unmasked entry address.

VERIFIED REPAIR

Mask both the ip and the entry address before comparing.

Unsuccessful approach: Excluding the network address itself rejects a legitimate member of the range.

Case contract

ip is dotted-quad IPv4 with octets 0..255 (else return None). Each cidr is "a.b.c.d/n" with 0 <= n <= 32, or a bare address meaning /32; malformed entries are skipped. An entry matches when the top n bits of ip and of its address agree (host bits of the entry are ignored). Return [True, index of first match] or [False, -1].

Why this case matters

Office and VPN allowlists gate internal features by source network.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(ip, cidrs):
    def parse(s):
        parts = s.split('.')
        if len(parts) != 4 or not all(p.isdigit() and int(p) <= 255 for p in parts):
            return None
        v = 0
        for p in parts:
            v = v * 256 + int(p)
        return v
    addr = parse(ip)
    if addr is None:
        return None
    for i, c in enumerate(cidrs):
        net, _, bits = c.partition('/')
        bits = bits or '32'
        base = parse(net)
        if base is None or not bits.isdigit() or int(bits) > 32:
            continue
        n = int(bits)
        mask = ((1 << n) - 1) << (32 - n)
        if addr & mask == base:
            return [True, i]
    return [False, -1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('slash 24 matches inside the network', ['10.1.2.3', ['192.168.0.0/16', '10.1.2.0/24']], [True, 1]),
  ('slash 0 matches everything', ['8.8.8.8', ['0.0.0.0/0']], [True, 0]),
  ('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 1', ['10.1.2.0', ['8.8.8.0', '10.1.2.3/32', '10.0.0.0/8']], [True, 2])],
 [('slash 0 matches everything', ['8.8.8.8', ['0.0.0.0/0']], [True, 0]),
  ('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 6', ['172.16.5.4', ['192.168.0.0/16', '8.8.8.0', '10.1.2.77/24']], [False, -1]),
  ('network sample 7', ['10.1.2.0', ['0.0.0.0/0']], [True, 0])],
 [('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 4', ['10.1.2.0', ['10.1.2.0/31']], [True, 0]),
  ('network sample 11', ['10.1.2.3', ['192.168.1.0/24']], [False, -1]),
  ('network sample 12', ['0.0.0.0', ['0.0.0.0/0', '172.16.0.0/12']], [True, 0])],
 [('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('invalid ip returns None', ['10.0.0.300', ['0.0.0.0/0']], None),
  ('network sample 12', ['0.0.0.0', ['0.0.0.0/0', '172.16.0.0/12']], [True, 0]),
  ('network sample 16', ['10.1.2.0', ['1.0.0.256/8']], [False, -1]),
  ('network sample 17', ['10.1.2.0', ['192.168.1.0/24', '10.1.2.3/32', '1.0.0.256/8']], [False, -1])],
 [('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('invalid ip returns None', ['10.0.0.300', ['0.0.0.0/0']], None),
  ('prefix longer than 32 is skipped', ['10.0.0.1', ['10.0.0.0/33', '10.0.0.0/8']], [True, 1]),
  ('network sample 21', ['10.1.2.3', ['10.1.2.3', '192.168.1.0/24']], [True, 0]),
  ('network sample 22', ['10.1.2.0', ['192.168.0.0/16', '10.0.0.0/8', '8.8.8.0']], [True, 1]),
  ('network sample 23', ['172.16.5.4', ['10.1.2.0/24', '10.0.0.0/8', '10.1.2.3']], [False, -1])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
slash 24 matches inside the network[True, 1][True, 1]Passed
slash 0 matches everything[True, 0][True, 0]Passed
octet 256 in an entry is malformed[False, -1][False, -1]Passed
octet 255 is valid[True, 0][True, 0]Passed
bare address means host route[False, -1][False, -1]Passed
entry with host bits still matches its network[False, -1][True, 0]Failed
network address itself matches[True, 0][True, 0]Passed
network sample 1[True, 2][True, 2]Passed

SHA-256 / 1579ff152c327b719e0a5d7810be6d5fcd7c9541b4989074db746582f2b57c3b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(ip, cidrs):
    def parse(s):
        parts = s.split('.')
        if len(parts) != 4 or not all(p.isdigit() and int(p) <= 255 for p in parts):
            return None
        v = 0
        for p in parts:
            v = v * 256 + int(p)
        return v
    addr = parse(ip)
    if addr is None:
        return None
    for i, c in enumerate(cidrs):
        net, _, bits = c.partition('/')
        bits = bits or '32'
        base = parse(net)
        if base is None or not bits.isdigit() or int(bits) > 32:
            continue
        n = int(bits)
        mask = ((1 << n) - 1) << (32 - n)
        if addr & mask == base & mask and addr != base & mask:
            return [True, i]
    return [False, -1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('slash 24 matches inside the network', ['10.1.2.3', ['192.168.0.0/16', '10.1.2.0/24']], [True, 1]),
  ('slash 0 matches everything', ['8.8.8.8', ['0.0.0.0/0']], [True, 0]),
  ('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 1', ['10.1.2.0', ['8.8.8.0', '10.1.2.3/32', '10.0.0.0/8']], [True, 2])],
 [('slash 0 matches everything', ['8.8.8.8', ['0.0.0.0/0']], [True, 0]),
  ('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 6', ['172.16.5.4', ['192.168.0.0/16', '8.8.8.0', '10.1.2.77/24']], [False, -1]),
  ('network sample 7', ['10.1.2.0', ['0.0.0.0/0']], [True, 0])],
 [('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 4', ['10.1.2.0', ['10.1.2.0/31']], [True, 0]),
  ('network sample 11', ['10.1.2.3', ['192.168.1.0/24']], [False, -1]),
  ('network sample 12', ['0.0.0.0', ['0.0.0.0/0', '172.16.0.0/12']], [True, 0])],
 [('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('invalid ip returns None', ['10.0.0.300', ['0.0.0.0/0']], None),
  ('network sample 12', ['0.0.0.0', ['0.0.0.0/0', '172.16.0.0/12']], [True, 0]),
  ('network sample 16', ['10.1.2.0', ['1.0.0.256/8']], [False, -1]),
  ('network sample 17', ['10.1.2.0', ['192.168.1.0/24', '10.1.2.3/32', '1.0.0.256/8']], [False, -1])],
 [('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('invalid ip returns None', ['10.0.0.300', ['0.0.0.0/0']], None),
  ('prefix longer than 32 is skipped', ['10.0.0.1', ['10.0.0.0/33', '10.0.0.0/8']], [True, 1]),
  ('network sample 21', ['10.1.2.3', ['10.1.2.3', '192.168.1.0/24']], [True, 0]),
  ('network sample 22', ['10.1.2.0', ['192.168.0.0/16', '10.0.0.0/8', '8.8.8.0']], [True, 1]),
  ('network sample 23', ['172.16.5.4', ['10.1.2.0/24', '10.0.0.0/8', '10.1.2.3']], [False, -1])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
slash 24 matches inside the network[True, 1][True, 1]Passed
slash 0 matches everything[True, 0][True, 0]Passed
octet 256 in an entry is malformed[False, -1][False, -1]Passed
octet 255 is valid[False, -1][True, 0]Failed
bare address means host route[False, -1][False, -1]Passed
entry with host bits still matches its network[True, 0][True, 0]Passed
network address itself matches[False, -1][True, 0]Failed
network sample 1[True, 2][True, 2]Passed

SHA-256 / 849904def40deb1da9eeb921f9d7456b4b88b9f44a90aaf85e7062b72e4270d9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(ip, cidrs):
    def parse(s):
        parts = s.split('.')
        if len(parts) != 4 or not all(p.isdigit() and int(p) <= 255 for p in parts):
            return None
        v = 0
        for p in parts:
            v = v * 256 + int(p)
        return v
    addr = parse(ip)
    if addr is None:
        return None
    for i, c in enumerate(cidrs):
        net, _, bits = c.partition('/')
        bits = bits or '32'
        base = parse(net)
        if base is None or not bits.isdigit() or int(bits) > 32:
            continue
        n = int(bits)
        mask = ((1 << n) - 1) << (32 - n)
        if addr & mask == base & mask:
            return [True, i]
    return [False, -1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('slash 24 matches inside the network', ['10.1.2.3', ['192.168.0.0/16', '10.1.2.0/24']], [True, 1]),
  ('slash 0 matches everything', ['8.8.8.8', ['0.0.0.0/0']], [True, 0]),
  ('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 1', ['10.1.2.0', ['8.8.8.0', '10.1.2.3/32', '10.0.0.0/8']], [True, 2])],
 [('slash 0 matches everything', ['8.8.8.8', ['0.0.0.0/0']], [True, 0]),
  ('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 6', ['172.16.5.4', ['192.168.0.0/16', '8.8.8.0', '10.1.2.77/24']], [False, -1]),
  ('network sample 7', ['10.1.2.0', ['0.0.0.0/0']], [True, 0])],
 [('octet 256 in an entry is malformed', ['1.0.0.0', ['1.0.0.256/8']], [False, -1]),
  ('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('network sample 4', ['10.1.2.0', ['10.1.2.0/31']], [True, 0]),
  ('network sample 11', ['10.1.2.3', ['192.168.1.0/24']], [False, -1]),
  ('network sample 12', ['0.0.0.0', ['0.0.0.0/0', '172.16.0.0/12']], [True, 0])],
 [('octet 255 is valid', ['192.168.0.255', ['192.168.0.255']], [True, 0]),
  ('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('invalid ip returns None', ['10.0.0.300', ['0.0.0.0/0']], None),
  ('network sample 12', ['0.0.0.0', ['0.0.0.0/0', '172.16.0.0/12']], [True, 0]),
  ('network sample 16', ['10.1.2.0', ['1.0.0.256/8']], [False, -1]),
  ('network sample 17', ['10.1.2.0', ['192.168.1.0/24', '10.1.2.3/32', '1.0.0.256/8']], [False, -1])],
 [('bare address means host route', ['10.1.2.4', ['10.1.2.3']], [False, -1]),
  ('entry with host bits still matches its network', ['10.1.2.9', ['10.1.2.77/24']], [True, 0]),
  ('network address itself matches', ['10.1.2.0', ['10.1.2.0/24']], [True, 0]),
  ('invalid ip returns None', ['10.0.0.300', ['0.0.0.0/0']], None),
  ('prefix longer than 32 is skipped', ['10.0.0.1', ['10.0.0.0/33', '10.0.0.0/8']], [True, 1]),
  ('network sample 21', ['10.1.2.3', ['10.1.2.3', '192.168.1.0/24']], [True, 0]),
  ('network sample 22', ['10.1.2.0', ['192.168.0.0/16', '10.0.0.0/8', '8.8.8.0']], [True, 1]),
  ('network sample 23', ['172.16.5.4', ['10.1.2.0/24', '10.0.0.0/8', '10.1.2.3']], [False, -1])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
slash 24 matches inside the network[True, 1][True, 1]Passed
slash 0 matches everything[True, 0][True, 0]Passed
octet 256 in an entry is malformed[False, -1][False, -1]Passed
octet 255 is valid[True, 0][True, 0]Passed
bare address means host route[False, -1][False, -1]Passed
entry with host bits still matches its network[True, 0][True, 0]Passed
network address itself matches[True, 0][True, 0]Passed
network sample 1[True, 2][True, 2]Passed

SHA-256 / a97c2bf66e7059d38c3dca19e67231a72ffa660069e6be158a5003d1bf34e69b

Verification & scope

A deterministic toy flag-evaluation model with a stipulated contract; it does not reproduce any vendor SDK byte for byte. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:48:54.246844+00:00.

Case digest / 578cfee911315138dbe63c148011609922db08e44ef7f1bf57612ea97b57431b