-
-
Notifications
You must be signed in to change notification settings - Fork 763
feat: do not log secret variables #2514
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
base: main
Are you sure you want to change the base?
Conversation
|
Would it be potentially interesting to represent secrets as their own objects within the schema? Similar to GitHub (and others). Potentially interfacing with secret stores (via sh commands, or code integrations). version: '3'
secrets:
USER: '{{ .FOO }}'
tasks:
user:
env:
USER: {{ secrets.USER }}
cmds:
- echo User is: {{ secrets.USER }}
- echo User really is: $USERtask user -- FOO=bar
User is: ******
User really is: bar <--- this might also be hidden, with an output package supporting "scrubbing", and
configured with the secrets used. |
|
Thanks for the proposal! I like the idea of aligning with patterns from GitHub Actions and other CI/CD tools. I actually considered this approach myself when designing the feature. The philosophy I adopted treats a secret as simply a variable with special handling (masking), which is why I chose secret: true rather than a separate section. First, it already integrates seamlessly with secret managers via the sh: syntax: vars:
DB_PASSWORD:
sh: "vault kv get -field=password secret/db"
secret: true
AWS_KEY:
sh: "aws secretsmanager get-secret-value --secret-id prod/api --query SecretString -o text"
secret: trueSecond, the architecture stays simple, no native provider integrations or SDK dependencies are needed, since any secret manager with a CLI works out of the box. Last, it maintains consistency: A separate
I intentionally chose not to hide this output for two reasons:
That said, this could potentially be hidden using an output package that supports "scrubbing" and is configured with the relevant secrets. I think it's a first good step anyway. Any thought on this @andreynering / @pd93 ? |
|
Internally, a secret might be the same base type as a vars & envar (both of which are the same type internally) . So the implementation would also be clean, and none of the capability's you mention are lost (they are essential). But then you do have a bit more capability programmatically, in dealing with those objects (reflection etc). I think you are correct in those observations. Details aside, the GitHub way is more familiar, from a user perspective. |
|
The idea of having a separate Some thoughts:
|
Env are not shown in our logger, I've added an example with a Golden.
I totally agree with this! |
3a2a33c to
b4187af
Compare
🔐 Add secret variable masking support
Problem
Sensitive values (API keys, passwords, tokens) were exposed in Task command logs, creating security risks when logs are shared or stored.
I’ve done a few talks on Task, and people always ask about secret variables. This fixes #2066
Solution
This PR adds a secret: true flag for variables that masks their values as ***** in command logs while keeping the actual execution unchanged.
Key features:
Example
Before:
task: [deploy] echo "Deploying myapp with key secret-key-123"
After:
task: [deploy] echo "Deploying myapp with key *****"
Changes
Documentation