Skip to content

Sanitized hashing algorithm #786

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions docs/concepts/policy/terraform-plan-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ In addition to our [helper functions](./README.md#helper-functions), we provide

## String Sanitization

Sensitive properties in `"before"` and `"after"` objects will be sanitized to protect secret values. Sanitization hashes the value and takes the last 8 bytes of the hash.
Sensitive properties in `"before"` and `"after"` objects will be sanitized to protect secret values. Sanitization hashes the value with the sha256 algorithm and takes the last 8 bytes of the hash.

If you need to compare a string property to a constant, you can use the `sanitized(string)` helper function.

Expand Down Expand Up @@ -271,7 +271,7 @@ deny[sprintf(message, [resource.address])] {

Here's a minimal example of this rule in the [Rego playground](https://play.openpolicyagent.org/p/kNUYOa4vX4){: rel="nofollow"}.

If that makes sense, let's try defining a policy that implements a slightly more sophisticated piece of knowledge - that when some resources are recreated, they should be [created before they're destroyed](https://www.terraform.io/docs/configuration/resources.html#create_before_destroy){: rel="nofollow"} or an outage will follow. We found that to be the case with the [`aws_batch_compute_environment`](https://www.terraform.io/docs/providers/aws/r/batch_compute_environment.html){: rel="nofollow"}, among others. So here it is:
If that makes sense, let's try defining a policy that implements a slightly more sophisticated piece of knowledge - that when some resources are recreated, they should be [created before they're destroyed](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#create_before_destroy){: rel="nofollow"} or an outage will follow. We found that to be the case with the [`aws_batch_compute_environment`](https://www.terraform.io/docs/providers/aws/r/batch_compute_environment.html){: rel="nofollow"}, among others. So here it is:

```opa
package spacelift
Expand Down
Loading