-
Notifications
You must be signed in to change notification settings - Fork 24
Redacting secret values in the configuration summary #1922
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ee1c95b
rename folder to be snakecase
KevyVo 46c0ecd
Reproduce the secret from the env and env files
KevyVo 147bde8
Implement fix for redacting secrets
KevyVo 9aa62af
Update redact-config golden
KevyVo 04ad570
Update golden file for ENCRYPTION_KEY
KevyVo 877579b
isSecret to return ds as well
KevyVo fbb3ede
lower entropy value slightly to capture hex
KevyVo 6c39aa0
use yaml instead of json because it is a superset
KevyVo 6add32f
update IsSecret callers
KevyVo f8bd39c
Add fake ENCRYPTION_KEY to test
KevyVo 1d7a5cd
Avoid fully revealing very short secrets
KevyVo 7ba774d
match masked length
KevyVo 3e68372
update golden file for new mask value
KevyVo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
src/pkg/cli/testdata/config-resolution/defang-config-only/compose.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [95m * Service environment variables resolution summary: | ||
| [0m[1m | ||
| SERVICE ENVIRONMENT SOURCE VALUE[0m | ||
| service1 API_TOKEN Config ****** | ||
| service1 DB_USER Config ****** | ||
| service1 SECRET_KEY Config ****** |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
src/pkg/cli/testdata/configresolution/defang-config-only/compose.yaml.golden
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| services: | ||
| backend: | ||
| image: node | ||
| environment: | ||
| APP_NAME: my-application | ||
| API_KEY: api-key=50m34p1k3y | ||
| SECRET_TOKEN: secret_token=ab12cd34ef56 | ||
| AUTH_PASSWORD: password=hunter12345 | ||
| NORMAL_CONFIG: debug |
8 changes: 8 additions & 0 deletions
8
src/pkg/cli/testdata/redact-config/api-keys/compose.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [95m * Service environment variables resolution summary: | ||
| [0m[1m | ||
| SERVICE ENVIRONMENT SOURCE VALUE[0m | ||
| backend API_KEY Compose api-** | ||
| backend APP_NAME Compose my-application | ||
| backend AUTH_PASSWORD Compose pass** | ||
| backend NORMAL_CONFIG Compose debug | ||
| backend SECRET_TOKEN Compose secr** |
9 changes: 9 additions & 0 deletions
9
src/pkg/cli/testdata/redact-config/cloud-credentials/compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| services: | ||
| deployer: | ||
| image: alpine | ||
| environment: | ||
| GITHUB_TOKEN: ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890 | ||
| AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE | ||
| AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY | ||
| AWS_CLIENT_ID: AROA1234567890ABCDEF | ||
| REGION: us-east-1 |
8 changes: 8 additions & 0 deletions
8
src/pkg/cli/testdata/redact-config/cloud-credentials/compose.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [95m * Service environment variables resolution summary: | ||
| [0m[1m | ||
| SERVICE ENVIRONMENT SOURCE VALUE[0m | ||
| deployer AWS_ACCESS_KEY_ID Compose AKIA** | ||
| deployer AWS_CLIENT_ID Compose AROA** | ||
| deployer AWS_SECRET_ACCESS_KEY Compose wJal** | ||
| deployer GITHUB_TOKEN Compose ghp_** | ||
| deployer REGION Compose us-east-1 |
10 changes: 10 additions & 0 deletions
10
src/pkg/cli/testdata/redact-config/database-urls/compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| services: | ||
| api: | ||
| image: node | ||
| environment: | ||
| DATABASE_URL: postgres://dbuser:p455w0rd@db.example.com:5432/myapp | ||
| MONGO_URI: mongodb://admin:s3cretP4ss@mongo.example.com:27017/mydb | ||
| MYSQL_URL: mysql://root:r00tP4ssw0rd@mysql.example.com:3306/app | ||
| REDIS_URL: rediss://default:p41fce90d44ac1d891bd21fdbc5dfc1bd7f163e33a6934c30093eaf56c1c23937@redis.example.com:6380 | ||
| DB_HOST: db.example.com | ||
| DB_PORT: "5432" |
9 changes: 9 additions & 0 deletions
9
src/pkg/cli/testdata/redact-config/database-urls/compose.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [95m * Service environment variables resolution summary: | ||
| [0m[1m | ||
| SERVICE ENVIRONMENT SOURCE VALUE[0m | ||
| api DATABASE_URL Compose post** | ||
| api DB_HOST Compose db.example.com | ||
| api DB_PORT Compose 5432 | ||
| api MONGO_URI Compose mong** | ||
| api MYSQL_URL Compose mysq** | ||
| api REDIS_URL Compose redi** |
12 changes: 12 additions & 0 deletions
12
src/pkg/cli/testdata/redact-config/empty-values/compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| services: | ||
| service1: | ||
| image: nginx | ||
| environment: | ||
| EMPTY_VAR: | ||
| WITH_VALUE: some_value | ||
| service2: | ||
| image: nginx | ||
| environment: | ||
| - EMPTY_STRING= | ||
| - EMPTY_VAR | ||
| - WITH_VALUE=some_value |
8 changes: 8 additions & 0 deletions
8
src/pkg/cli/testdata/redact-config/empty-values/compose.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [95m * Service environment variables resolution summary: | ||
| [0m[1m | ||
| SERVICE ENVIRONMENT SOURCE VALUE[0m | ||
| service1 EMPTY_VAR Config | ||
| service1 WITH_VALUE Compose some_value | ||
| service2 EMPTY_STRING Compose | ||
| service2 EMPTY_VAR Config | ||
| service2 WITH_VALUE Compose some_value |
9 changes: 9 additions & 0 deletions
9
src/pkg/cli/testdata/redact-config/high-entropy-strings/compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| services: | ||
| app: | ||
| image: python | ||
| environment: | ||
| SESSION_SECRET: VEfk5vO0Q53VkK_uicor | ||
| ENCRYPTION_KEY: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 | ||
| SIGNING_KEY: xK9mPqR7sT2vW5yZ8aB3cD6eF | ||
| APP_ENV: production | ||
| LOG_LEVEL: info |
8 changes: 8 additions & 0 deletions
8
src/pkg/cli/testdata/redact-config/high-entropy-strings/compose.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [95m * Service environment variables resolution summary: | ||
| [0m[1m | ||
| SERVICE ENVIRONMENT SOURCE VALUE[0m | ||
| app APP_ENV Compose production | ||
| app ENCRYPTION_KEY Compose 9f86** | ||
| app LOG_LEVEL Compose info | ||
| app SESSION_SECRET Compose VEfk** | ||
| app SIGNING_KEY Compose xK9m** |
16 changes: 16 additions & 0 deletions
16
src/pkg/cli/testdata/redact-config/mixed-secrets-and-plain/compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| services: | ||
| frontend: | ||
| image: nginx | ||
| environment: | ||
| APP_NAME: my-frontend | ||
| PORT: "3000" | ||
| backend: | ||
| image: node | ||
| environment: | ||
| APP_NAME: my-backend | ||
| PORT: "8080" | ||
| DATABASE_URL: postgres://admin:p455w0rd@db.example.com:5432/myapp | ||
| GITHUB_TOKEN: ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890 | ||
| API_KEY: api-key=50m34p1k3y | ||
| LOG_LEVEL: info | ||
| NODE_ENV: production |
12 changes: 12 additions & 0 deletions
12
src/pkg/cli/testdata/redact-config/mixed-secrets-and-plain/compose.yaml.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [95m * Service environment variables resolution summary: | ||
| [0m[1m | ||
| SERVICE ENVIRONMENT SOURCE VALUE[0m | ||
| backend API_KEY Compose api-** | ||
| backend APP_NAME Compose my-backend | ||
| backend DATABASE_URL Compose post** | ||
| backend GITHUB_TOKEN Compose ghp_** | ||
| backend LOG_LEVEL Compose info | ||
| backend NODE_ENV Compose production | ||
| backend PORT Compose 8080 | ||
| frontend APP_NAME Compose my-frontend | ||
| frontend PORT Compose 3000 |
11 changes: 11 additions & 0 deletions
11
src/pkg/cli/testdata/redact-config/not-secrets/compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| services: | ||
| web: | ||
| image: nginx | ||
| environment: | ||
| APP_ENV: production | ||
| LOG_LEVEL: info | ||
| PORT: "8080" | ||
| API_URL: https://api.example.com | ||
| DOCS_PATH: /leaderboard/api/hubs | ||
| NODE_ENV: production | ||
| GREETING: not a secret |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.