Masking sensitive values in source control

When you push a project to Git, Cloudera SQL Stream Builder (SSB) checks its tables, data sources, and jobs for sensitive values, such as passwords. Keep these values in environment variables, so that they never reach the repository.

Environments are not pushed with the project. When the properties of a table, data source, or job reference an environment variable, such as ${ssb.env.db_password}, the repository receives the reference, not the value.

When you push a project that contains sensitive values written as plain text, SSB stops the push. The message Sensitive information in project! is displayed, with a list of the affected resources. Click a resource in the list to open it, and replace each sensitive value with an environment variable.

To replace sensitive values with environment variables:

  1. In the Streaming SQL Console, click Projects in the left navigation pane, and click the name of your project.
    The project opens, with the Explorer panel on the left. To open the Streaming SQL Console, see Accessing Cloudera SQL Stream Builder.
  2. Create an environment, for example dev, with a variable for each sensitive value, for example the key psql_password with the password as its value. Turn on Secure for the variable.
    For the full steps, see Managing project environments.
  3. Activate the environment.
  4. In your tables, data sources, and jobs, replace each sensitive value with a reference to its variable.
    For example:
    CREATE TABLE orders_cdc (
      order_id INT,
      city VARCHAR(2147483647),
      amount INT,
      order_time TIMESTAMP(3),
      order_status VARCHAR(2147483647)
    ) WITH (
      'connector' = 'postgres-cdc',
      'hostname' = '${ssb.env.psql_host}',
      'username' = '${ssb.env.psql_user}',
      'password' = '${ssb.env.psql_password}',
      ...
    );
  5. Push the project.
    See Using source control with projects.
    The push succeeds, and the repository contains the variable references instead of the values.

In each deployment where you import the project, create an environment with the same keys and the values for that deployment.