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

docs: Update log masking policy examples to be Rego v1 compatible #6545

Merged
Merged
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
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
Loading