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

Detect ambiguous rules at compile time #23

Closed
charithe opened this issue Mar 25, 2021 · 0 comments
Closed

Detect ambiguous rules at compile time #23

charithe opened this issue Mar 25, 2021 · 0 comments
Labels
kind/enhancement New feature or request

Comments

@charithe
Copy link
Contributor

For example, given the following policy:

---
apiVersion: cerbos.dev/v1
resourcePolicy:
  version: "20210210"
  resource: leave_request
  rules:
  - action: approve
    derivedRoles:
    - direct_manager
    condition:
      match:
        expr:
        - request.resource.attr.status == "PENDING_APPROVAL"
    effect: EFFECT_ALLOW

  - action: approve
    derivedRoles:
    - employee_that_owns_the_record
    condition:
      match:
        expr:
        - request.resource.attr.status == "PENDING_APPROVAL"
    effect: EFFECT_DENY

A request like the following would match both rules and fail.

{
  "requestId": "460d1429-9798-4a6f-8505-170193909003",
  "principal": {
    "id": "maggie",
    "version": "20210210",
    "roles": [
      "employee",
      "manager"
    ],
    "attr": {
      "department": "marketing",
      "geography": "GB",
      "managed_geographies": "GB",
      "team": "design"
    }
  },
  "action": "approve",
  "resource": {
    "name": "leave_request",
    "version": "20210210",
    "attr": {
      "department": "marketing",
      "geography": "GB",
      "id": "XX125",
      "owner": "maggie",
      "status": "PENDING_APPROVAL",
      "team": "design"
    }
  }
}
@charithe charithe added the kind/enhancement New feature or request label Mar 25, 2021
@charithe charithe closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant