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

[datadog_sensitive_data_scanner_rule] Proof of concept for test patterns #2429

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexandre-pocquet
Copy link
Contributor

This is a proof of concept to support pattern unit tests in datadog_sensitive_data_scanner_rule resources, replicating the testing feature already available in the SDS UI.

Here's what an SDS rule with tests would look like:

resource datadog_sensitive_data_scanner_rule my_rule {
	name = "Detect my_secret_token in logs"
	group_id = datadog_sensitive_data_scanner_group.my_group.id

	pattern = "my_secret_token[=:]\w+"
	pattern_test {
		input = "my_secret_token=aaaaaaaaaaa"
	}
	pattern_test {
		input = "my_secret_token:bbbbbbbbbb"
	}
	pattern_test {
		input = "my_secret_token_hash=ccccccccc"
		matches = false
	}
}

It's not functional at the moment, mostly because the API endpoint used by the regular SDS UI is semi-private and restricted to UI usages.

TODO:

  • stabilize the SDS testing API endpoint
  • add it to the public Datadog API bindings
  • support more than pattern tests (include the replacement options ?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant