Role Per Region
Requirement: a contractor may read claims only for the region they are staffed to, and only while their contract is open. New regions are added roughly monthly and contracts start and end every week. Two candidate policies:
# policy A
package authz
import rego.v1
default allow := false
allow if {
input.action == "read"
"claims_reader_emea" in data.roles[input.subject.id]
input.resource.region == "emea"
}
# policy B
package authz
import rego.v1
default allow := false
allow if {
input.action == "read"
input.subject.staffed_region == input.resource.region
time.now_ns() < input.subject.contract_ends_ns
}
Which is the honest assessment?
Sign in to answer questions and track your progress
Sign In