-
Notifications
You must be signed in to change notification settings - Fork 0
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
[ACC-585] Verify vault secrets workflow #14
[ACC-585] Verify vault secrets workflow #14
Conversation
@@ -0,0 +1,55 @@ | |||
const envVarsRegex = /System\.fetch_env!\("([^"]+)"\)/g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also check for System.fetch_env
(without the bang) and System.get_env
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also I think this would fail in a cases like
generate_env_key()
|> System.fetch_env()
# or
|> Enum.map(&System.fetch_env/1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering, how far can we get with heuristic like "all caps, numbers, underscore, at least 2 in length"
So we can just get rid of all fetch_env elixir prefixes.
[A-Z_0-9]{2,}
@@ -1,4 +1,4 @@ | |||
const envVarsRegex = /System\.fetch_env!\("([^"]+)"\)/g; | |||
const envVarsRegex = /[A-Z0-9_]{2,}/g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I updated the regex to catch fetch_env, fetch_env!, and get_env - how's that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no button to resolve the comment weird, but looks good
Relevant ticket: https://thescore.atlassian.net/browse/ACC-585
Adding a shared workflow to verify that environment variables referenced in Elixir projects have values defined for all environments and edges in Vault.
The action takes inputs (example):
identity
)"['us-core']"
)"['common','kafka-worker','oban']"
)"['staging','demo','uat','audit1','ps','production']"
)APP_VERSION
)https://vault.prod.thescore.is
)https://vault.non-prod.thescore.is
)It will use those inputs to generate a matrix of jobs that pull secret names from Vault and store them as artifacts. Then we check per edge and environment that the retrieved keys include environment variables that are referenced in files changed in the relevant PR.
It uses a JS action to compare the referenced environment variables to the secret names retrieved from Vault. That JS action is tested and added to CI for this repo.