How to allow/restrict external data push to OPA only for specific data #261
-
Hi All, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can have a system policy for authorization, see these docs. You can put anything into that policy, and it knows both the result of authentication (
Here's a sketch: package system.authz
default allow := {
"allowed": false,
"reason": "unauthorized resource access"
}
allow := { "allowed": true } {
input.identity == "system1"
is_v1_data
input.path[2] == "system1-stuff"
}
allow := { "allowed": true } {
input.identity == "system2"
is_v1_data
input.path[2] == "system-2-stuff"
}
allow := { "allowed": false, "reason": reason } {
not input.identity
reason := "no identity provided"
}
is_v1_data {
input.path[0] == "v1"
input.path[1] == "data"
} Now, this could of course become much more complex... 🎇 |
Beta Was this translation helpful? Give feedback.
You can have a system policy for authorization, see these docs. You can put anything into that policy, and it knows both the result of authentication (
input.identity
) and the request that's made (the rest ofinput
).Here's a sketch: