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

Allow the "is" operator in the action scope #1238

Open
2 tasks
D-McAdams opened this issue Sep 27, 2024 · 0 comments
Open
2 tasks

Allow the "is" operator in the action scope #1238

D-McAdams opened this issue Sep 27, 2024 · 0 comments
Labels
papercut Small annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a fature request

Comments

@D-McAdams
Copy link

Category

Cedar language or syntax features/changes

Describe the feature you'd like to request

Submitting this on behalf of a customer who asked: "How would I express that a policy applies to any action in a particular namespace?"

Thought the "is" operator would work for this.

permit(
  principal,
  action is My::Namespace::Action,
  resource
) 
when {...};

But, it's prohibited.

cedar validate -s schema/admission.cedarschema -p schema/admission-policy.cedar
  × failed to parse policy set
  ╰─▶ `is` cannot appear in the action scope
    ╭─[10:5]
  9 │     principal,
 10 │     action is admission::Action,
    ·     ───────────────────────────
 11 │     resource
    ╰────
  help: try moving `action is ..` into a `when` condition

Research indicates this is because RFC 5 specifies that it is not allowed. (So the next question is, why was that explicitly written in RFC 5.)

Here's the discussion from the original RFC: cedar-policy/rfcs#5 (comment)

It is related to a discussion a while back about whether it's possible to have more than one action type. And indeed it is because of namespaces. Given that, it seems like we should allow is everywhere in Rust. (Already done in Lean: https://github.com/cedar-policy/cedar-spec/blob/884737200b12da3a22e1763a5aed9e09d350a766/cedar-lean/Cedar/Spec/Policy.lean#L42)

Re-reading the discussion I don't think there's any reason we couldn't add action is to the scope. ISTM that we took this option precisely because we could relax it later if needed.

Describe alternatives you've considered

See discussion in original RFC: cedar-policy/rfcs#5 (comment)

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@D-McAdams D-McAdams added pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. feature-request This issue requets a substantial new feature backlog papercut Small annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a fature request and removed pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. feature-request This issue requets a substantial new feature labels Sep 27, 2024
@D-McAdams D-McAdams changed the title All the "is" operator in the action scope Allow the "is" operator in the action scope Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
papercut Small annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a fature request
Projects
None yet
Development

No branches or pull requests

2 participants