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

Create secrets manager API against Google Secrets store, feature flag #6113

Merged
merged 13 commits into from
Sep 17, 2021

Conversation

airbyte-jenny
Copy link
Contributor

Create secrets manager API against Google Secrets store, plus feature flag on use.

What

Adds an api for retrieving/storing secrets in google secrets. Adds a feature flag for whether configs are stored with secrets in google secrets, versus prior behavior of storing the whole config in the database.

How

This provides just the core of the secrets manager API, but not the full implementation for moving configs. That's pending in another PR. This is being moved ahead to support development of per-secret separated storage.

Recommended reading order

  1. GoogleSecretsManager.java
  2. Everything else.

@airbyte-jenny airbyte-jenny temporarily deployed to more-secrets September 16, 2021 20:46 Inactive
@airbyte-jenny airbyte-jenny temporarily deployed to more-secrets September 16, 2021 21:25 Inactive
@airbyte-jenny airbyte-jenny temporarily deployed to more-secrets September 16, 2021 21:50 Inactive
Copy link
Contributor

@jrhizor jrhizor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll touch this up a bit but let's merge it now to unblock you.

Comment on lines +54 to +79
/**
* Manual test fixture to make sure you've got your project id set in env and have appropriate creds
* to reach/write the secret store.
*/
public static void main(String[] args) throws Exception {
// Check that we're configured to a usable GCP project.
EnvConfigs envConfig = new EnvConfigs();
String projectId = envConfig.getSecretStoreGcpProjectId();
Preconditions.checkNotNull(projectId, "Project ID must not be empty");
Preconditions.checkNotNull(Long.parseLong(projectId), "Project ID must be purely numeric, not %s".format(projectId));

// Check that we can read an existing one from that project / have permissions etc.
Preconditions.checkArgument(existsSecret("zzzzzz") == false, "Secret doesn't exist, should return false.");
Preconditions.checkArgument(existsSecret("dev_practice_sample_secret"), "Secret already exists, should return true.");
String content = readSecret("dev_practice_sample_secret");
Preconditions.checkArgument("ThisIsMyTest".equals(content));

// Try creating a new one and reading it back.
String rand = UUID.randomUUID().toString();
String key = "dev_practice_sample_" + rand;
saveSecret(key, rand);
String rand2 = readSecret(key);
Preconditions.checkArgument(rand.equals(rand2), "Values should have matched after writing and re-reading a new key.");
saveSecret(key, "foo");
deleteSecret(key);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be in src/test instead? i think it's a test.

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.

None yet

3 participants