Skip to main content

Git for data import Data Source

Use the Git for data import Data Source to make JSON data available to policies using data in a Git repository and a Git data source that automatically reads JSON, YAML, XML, and .tfstate files from the Git repository.

Creating or Configuring the Data Source through the Styra DAS UI

Create or configure the Data Source through the Styra DAS UI.

  1. Login to the Styra DAS UI.
  2. Select the System to add the Data Source.
  3. Click the kebab icon (three dots ⋮) to the right of the System and select Add Data Source. The Add Data Source dialog box appears.
  4. Select Git for JSON object import.
  5. In Path type a new or existing path separated by /. For example, am/datasourcetypes.
  6. In Data Source name (required) type the name for the Data Source.
  7. (Optional) Type in a Description.
  8. In Git authentication select HTTPS or SSH authentication for Git.
  9. Git repository (required) type the subdirectory where you want to save the policies. Enter the Git repository. For example, https://github.com/username/test-rules.git.
  10. (HTTPS) In Username type in the Git username.
  11. (HTTPS) In Personal access token type in the Git Personal access token.
  12. (SSH) In SSH key (required) provide the SSH key.
  13. (SSH) In SSH key passphrase type the SSH key passphrase.
  14. In Reference type a tag or branch reference. For example, refs/heads/master.
  15. In Git Commit SHA type in the Git commit SHA.
  16. In Repository path type a relative path within the given repository. For example, example.json.
  17. In Refresh interval type a refresh interval which is the amount of time between polling intervals. Default is s.
  18. (Optional) Click the arrow to expand the Advanced field.
  19. (Optional) In Data transform: Specify a policy and write a query that allows you to apply Rego transformations before it is persisted as data. For Custom and fill in the following fields:
    • In Policy type an existing policy separated by /. For example, transform/transform.rego.
    • In Rego query type the path to the Rego rule to evaluate. For example, data.transform.query.
  20. Preview the Data Source in the right pane. If the data is over 1 MB, the Preview will display an error.
  21. Click the Add.

The following shows an example output which appears after the data source is created in Styra DAS.

{
"a":1,
"b":2,
"c":3
}