Skip to content

Commit

Permalink
docs: Update log masking policy examples to be Rego v1 compatible
Browse files Browse the repository at this point in the history
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
  • Loading branch information
ashutosh-narkar committed Jan 24, 2024
1 parent 0738022 commit 56d2707
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions docs/content/management-decision-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@ resources, supply the following policy to OPA:
```ruby
package system.log
mask["/input/password"] {
# OPA provides the entire decision log event as input to the masking policy.
# Refer to the original input document under input.input.
input.input.resource == "user"
import rego.v1
mask contains "/input/password" if {
# OPA provides the entire decision log event as input to the masking policy.
# Refer to the original input document under input.input.
input.input.resource == "user"
}
# To mask certain fields unconditionally, omit the rule body.
mask["/input/ssn"]
mask contains "/input/ssn"
```

When the masking policy generates one or more JSON Pointers, they will be erased
Expand Down Expand Up @@ -211,10 +213,11 @@ operations
```ruby
package system.log
mask[{"op": "upsert", "path": "/input/password", "value": x}] {
# conditionally upsert password if it existed in the original event
input.input.password
x := "**REDACTED**"
import rego.v1
mask contains {"op": "upsert", "path": "/input/password", "value": "**REDACTED**"} if {
# conditionally upsert password if it existed in the original event
input.input.password
}
```

Expand All @@ -224,10 +227,10 @@ the following rule format can be used.
```ruby
package system.log
import rego.v1
# always upsert, no conditions in rule body
mask[{"op": "upsert", "path": "/input/password", "value": x}] {
x := "**REDACTED**"
}
mask contains {"op": "upsert", "path": "/input/password", "value": "**REDACTED**"}
```

The result of this mask operation on the decision log event produces
Expand Down

0 comments on commit 56d2707

Please sign in to comment.