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

feat(chart): update default policies #36

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ file in the Carbyne Stack

### Robert Bosch GmbH

- Becker Sebastian
[[email protected]](mailto:[email protected])
- Trieflinger Sven
[[email protected]](mailto:[email protected])
75 changes: 67 additions & 8 deletions charts/thymus/templates/access-control/default-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,85 @@
#

# Default OPA policies
---
apiVersion: v1
kind: ConfigMap
metadata:
name: default-policies
labels:
opa.stackable.tech/bundle: "true"
data:
donor-read.rego: |
package play
defaults.rego: |
package carbynestack.def

import rego.v1

default read := false
default delete := false
default tag.read := false
default tag.create := false
default tag.update := false
default tag.delete := false
default use := false
default execute := false
owner-access.rego: |
package carbynestack.def

import rego.v1

tags contains tag if {
tag := {"key": "derived-from", "value": input.inputs[_].owner}
is_owner if {
some i
input.tags[i].key == "owner"
input.tags[i].value == input.subject
}

default read := false
read if is_owner
delete if is_owner
tag.read if is_owner
tag.create if is_owner
tag.update if is_owner
tag.delete if is_owner
donor-read.rego: |
package carbynestack.def

import rego.v1

read if {
tags := [
{
"key": "derived-from",
"value": concat(", ", {x |
some i
x := input.inputs[i].owner
})
}, {
"key": "owner",
"value": input.executor
}
]

provided_input if {
some i
tags[i].key == "derived-from"
tags[i].value == input.subject
input.tags[i].key == "derived-from"
contributor := split(input.tags[i].value, ",")
trim(contributor[_], " ") == input.subject
}

read if provided_input
tag.read if provided_input
ephemeral-use.rego: |
package carbynestack.def

import rego.v1

use if {
some i
input.tags[i].key == "authorizedPrograms"
programIds := split(input.tags[i].value, ",")
programIds[_] == input.subject
}
ephemeral-execute.rego: |
package carbynestack.def

import rego.v1

execute if input.playerCount >= 2
Loading