Skip to content

Mark sensitive environment variables for runners #665

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions iterative/resource_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,23 @@ sudo tee /usr/bin/cml.sh << 'EOF'
export AWS_SECRET_ACCESS_KEY={{escape .AWS_SECRET_ACCESS_KEY}}
export AWS_ACCESS_KEY_ID={{escape .AWS_ACCESS_KEY_ID}}
export AWS_SESSION_TOKEN={{escape .AWS_SESSION_TOKEN}}
export _CML_RUNNER_SENSITIVE_ENV=AWS_SECRET_ACCESS_KEY:AWS_ACCESS_KEY_ID:AWS_SESSION_TOKEN
{{- end}}
{{- if eq .cloud "azure"}}
export AZURE_CLIENT_ID={{escape .AZURE_CLIENT_ID}}
export AZURE_CLIENT_SECRET={{escape .AZURE_CLIENT_SECRET}}
export AZURE_SUBSCRIPTION_ID={{escape .AZURE_SUBSCRIPTION_ID}}
export AZURE_TENANT_ID={{escape .AZURE_TENANT_ID}}
export _CML_RUNNER_SENSITIVE_ENV=AZURE_CLIENT_ID:AZURE_CLIENT_SECRET:AZURE_SUBSCRIPTION_ID:AZURE_TENANT_ID
{{- end}}
{{- if eq .cloud "gcp"}}
export GOOGLE_APPLICATION_CREDENTIALS_DATA={{escape .GOOGLE_APPLICATION_CREDENTIALS_DATA}}
export CML_GCP_ACCESS_TOKEN={{escape .CML_GCP_ACCESS_TOKEN}}
export _CML_RUNNER_SENSITIVE_ENV=GOOGLE_APPLICATION_CREDENTIALS_DATA:CML_GCP_ACCESS_TOKEN
{{- end}}
{{- if eq .cloud "kubernetes"}}
export KUBERNETES_CONFIGURATION={{escape .KUBERNETES_CONFIGURATION}}
export _CML_RUNNER_SENSITIVE_ENV=KUBERNETES_CONFIGURATION
{{- end}}
{{- end}}

Expand Down
1 change: 1 addition & 0 deletions iterative/testdata/script_template_cloud_aws.golden
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sudo tee /usr/bin/cml.sh << 'EOF'
export AWS_SECRET_ACCESS_KEY='0 value with "quotes" and spaces'
export AWS_ACCESS_KEY_ID='1 value with "quotes" and spaces'
export AWS_SESSION_TOKEN='2 value with "quotes" and spaces'
export _CML_RUNNER_SENSITIVE_ENV=AWS_SECRET_ACCESS_KEY:AWS_ACCESS_KEY_ID:AWS_SESSION_TOKEN

while lsof /var/lib/dpkg/lock; do sleep 1; done

Expand Down
1 change: 1 addition & 0 deletions iterative/testdata/script_template_cloud_azure.golden
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export AZURE_CLIENT_ID='3 value with "quotes" and spaces'
export AZURE_CLIENT_SECRET='4 value with "quotes" and spaces'
export AZURE_SUBSCRIPTION_ID='5 value with "quotes" and spaces'
export AZURE_TENANT_ID='6 value with "quotes" and spaces'
export _CML_RUNNER_SENSITIVE_ENV=AZURE_CLIENT_ID:AZURE_CLIENT_SECRET:AZURE_SUBSCRIPTION_ID:AZURE_TENANT_ID

while lsof /var/lib/dpkg/lock; do sleep 1; done

Expand Down
1 change: 1 addition & 0 deletions iterative/testdata/script_template_cloud_gcp.golden
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ sudo tee /usr/bin/cml.sh << 'EOF'
#!/bin/sh
export GOOGLE_APPLICATION_CREDENTIALS_DATA=''
export CML_GCP_ACCESS_TOKEN=''
export _CML_RUNNER_SENSITIVE_ENV=GOOGLE_APPLICATION_CREDENTIALS_DATA:CML_GCP_ACCESS_TOKEN

while lsof /var/lib/dpkg/lock; do sleep 1; done

Expand Down
1 change: 1 addition & 0 deletions iterative/testdata/script_template_cloud_kubernetes.golden
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sudo systemctl is-enabled cml.service && return 0
sudo curl --location https://github.com/iterative/terraform-provider-iterative/releases/latest/download/leo_linux_amd64 --output /usr/bin/leo
sudo chmod a+x /usr/bin/leo
export KUBERNETES_CONFIGURATION='8 value with "quotes" and spaces'
export _CML_RUNNER_SENSITIVE_ENV=KUBERNETES_CONFIGURATION

while lsof /var/lib/dpkg/lock; do sleep 1; done

Expand Down