Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to specify exempt CIDRs in Security Policy #5272

Open
Thakurvaibhav opened this issue Feb 13, 2025 · 1 comment
Open

Ability to specify exempt CIDRs in Security Policy #5272

Thakurvaibhav opened this issue Feb 13, 2025 · 1 comment
Labels

Comments

@Thakurvaibhav
Copy link

Description:
I have a security policy that I would like to apply to all source IPs except for a certain CIDR. Example:
A security policy for my backend which would:

  1. Allow traffic if it originates from a certain CIDR and has certain claims in the JWT
  2. Allow traffic if it originates from CIDR, not in 1

The following policy will not work:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: SecurityPolicy
metadata:
  name: authorization-jwt-claim
spec:
  targetRefs:
  - group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: backend
  jwt:
    providers:
    - name: example
      issuer: https://foo.bar.com/
      remoteJWKS:
        uri: https://raw.githubusercontent.com/envoyproxy/gateway/refs/heads/main/examples/kubernetes/jwt/jwks.json
  authorization:
    defaultAction: Deny
    rules:
    - name: "conditional-allow-for-customer-1"
      action: Allow
      principal:
        clientCIDRs:
        - 10.0.1.0/24
        jwt:
          provider: example
          scopes: ["read", "add", "modify"]
          claims:
          - name: user.name
            values: ["John Doe"]
    - name: "allow-for-other-customers"
      action: Allow

because blocklist cidr condition will match the second rule

Relevant Slack Conversation: https://envoyproxy.slack.com/archives/C03E6NHLESV/p1739480718458779

@Thakurvaibhav
Copy link
Author

It would be nice to have a not principal supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant