Skip to content

Add the CelCidr opaque value representation (net.CIDR) to support CIDR prefix parsing, host-bit masking, and IP/CIDR containment checks in CEL Java with parity against cel-go and cel-spec. - #1485

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1024996981

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Add the CelCidr opaque value representation (net.CIDR) to support CIDR prefix parsing, host-bit masking, and IP/CIDR containment checks in CEL Java with parity against cel-go and cel-spec.

CelCidr extends OpaqueValue directly using immutable fields, rejects leading zeros in prefix lengths, zone identifiers, and IPv4-mapped IPv6 addresses, and preserves unmasked host bits while masking during prefix containment checks via CelIp prefix helpers. Also register net.CIDR in DefaultTypeProvider so type identifiers resolve during evaluation.

… CIDR prefix parsing, host-bit masking, and IP/CIDR containment checks in CEL Java with parity against `cel-go` and `cel-spec`.

`CelCidr` extends `OpaqueValue` directly using immutable fields, rejects leading zeros in prefix lengths, zone identifiers, and IPv4-mapped IPv6 addresses, and preserves unmasked host bits while masking during prefix containment checks via `CelIp` prefix helpers. Also register `net.CIDR` in `DefaultTypeProvider` so type identifiers resolve during evaluation.

PiperOrigin-RevId: 1024996981
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.

1 participant