-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from cedar-policy/bug/hakanson/16
bug: highlight issue with quoted string #16
- Loading branch information
Showing
12 changed files
with
340 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// inspired by https://www.cedarpolicy.com/blog/cedar-for-kubernetes | ||
forbid ( | ||
principal is k8s::User, | ||
action in [k8s::Action::"list", k8s::Action::"update"], | ||
resource is k8s::Resource | ||
) when { | ||
principal in k8s::Group::"block-list" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<span class="token comment">// inspired by https://www.cedarpolicy.com/blog/cedar-for-kubernetes</span> | ||
<span class="token keyword">forbid</span> <span class="token punctuation">(</span> | ||
<span class="token variable">principal</span> <span class="token operator">is</span> <span class="token class-name">k8s::User</span><span class="token punctuation">,</span> | ||
<span class="token variable">action</span> <span class="token operator">in</span> <span class="token punctuation">[</span><span class="token class-name">k8s::Action</span>::<span class="token string">"list"</span><span class="token punctuation">,</span> <span class="token class-name">k8s::Action</span>::<span class="token string">"update"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> | ||
<span class="token variable">resource</span> <span class="token operator">is</span> <span class="token class-name">k8s::Resource</span> | ||
<span class="token punctuation">)</span> <span class="token keyword">when</span> <span class="token punctuation">{</span> | ||
<span class="token variable">principal</span> <span class="token operator">in</span> <span class="token class-name">k8s::Group</span>::<span class="token string">"block-list"</span> | ||
<span class="token punctuation">}</span><span class="token punctuation">;</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
// you "must" be 54" tall to ride (wink) | ||
@id("54\" rule") // 54" is 4' 6" | ||
@id("54\" rule") // 54" is 4' 6" | ||
forbid (principal, action, resource) | ||
when { resource.restriction == "54\"" && principal.height < 54 }; | ||
when | ||
{ | ||
resource.restriction == "54\"" && | ||
principal.height < 54 && | ||
principal.attrSet.contains({ | ||
"key": "height", | ||
"values": ["54\"", "4' 6\""] | ||
}) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<span class="token comment">// you "must" be 54" tall to ride (wink)</span> | ||
@id<span class="token punctuation">(</span><span class="token string">"54\" rule"</span><span class="token punctuation">)</span> <span class="token comment">// 54" is 4' 6" </span> | ||
@id<span class="token punctuation">(</span><span class="token string">"54\" rule"</span><span class="token punctuation">)</span> <span class="token comment">// 54" is 4' 6"</span> | ||
<span class="token keyword">forbid</span> <span class="token punctuation">(</span><span class="token variable">principal</span><span class="token punctuation">,</span> <span class="token variable">action</span><span class="token punctuation">,</span> <span class="token variable">resource</span><span class="token punctuation">)</span> | ||
<span class="token keyword">when</span> <span class="token punctuation">{</span> <span class="token variable">resource</span>.restriction <span class="token operator">==</span> <span class="token string">"54\""</span> <span class="token operator">&&</span> <span class="token variable">principal</span>.height <span class="token operator"><</span> <span class="token number">54</span> <span class="token punctuation">}</span><span class="token punctuation">;</span> | ||
<span class="token keyword">when</span> | ||
<span class="token punctuation">{</span> | ||
<span class="token variable">resource</span>.restriction <span class="token operator">==</span> <span class="token string">"54\""</span> <span class="token operator">&&</span> | ||
<span class="token variable">principal</span>.height <span class="token operator"><</span> <span class="token number">54</span> <span class="token operator">&&</span> | ||
<span class="token variable">principal</span>.attrSet.<span class="token function">contains</span><span class="token punctuation">(</span><span class="token punctuation">{</span> | ||
<span class="token string">"key"</span>: <span class="token string">"height"</span><span class="token punctuation">,</span> | ||
<span class="token string">"values"</span>: <span class="token punctuation">[</span><span class="token string">"54\""</span><span class="token punctuation">,</span> <span class="token string">"4' 6\""</span><span class="token punctuation">]</span> | ||
<span class="token punctuation">}</span><span class="token punctuation">)</span> | ||
<span class="token punctuation">}</span><span class="token punctuation">;</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters