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

Secrets are printed in logs #181

Closed
rahfar opened this issue Mar 23, 2024 · 2 comments
Closed

Secrets are printed in logs #181

rahfar opened this issue Mar 23, 2024 · 2 comments

Comments

@rahfar
Copy link
Contributor

rahfar commented Mar 23, 2024

Hi,

Noticed that in dry mode secrets are printed in logs (actualy without dry also)

> spot --dry --secrets.provider=spot --secrets.key=1
spot latest
dry run - no changes will be made and no commands will be executed
[12377.ru:22] run task "backup", commands: 3
[12377.ru:22] completed command "daily" {script: /bin/sh -c 'AWS_ACCESS_KEY_ID="123"; AWS_SECRET_ACCESS_KEY="123"; DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/123"; s3cmd --no-progress --storage-class=COLD sync /path s3://bucket'} (0s)

playbook

user: root
ssh_key: ~/.ssh/id_rsa
ssh_shell: /bin/bash
local_shell: /bin/bash

tasks:
  - name: backup
    on_error: 'curl -X POST -H "Content-Type:application/json" --data "{\"content\": \"backup upload unsuccessfull. Pls check logs\"}" $DISCORD_WEBHOOK_URL'
    targets: ["example.com"]
    options:
      secrets: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "DISCORD_WEBHOOK_URL"]
    commands:
      - name: daily
        script: s3cmd --no-progress --storage-class=COLD sync /path s3://bucket
@umputun
Copy link
Owner

umputun commented Mar 23, 2024

Good catch, thanks for the report. The issue was related to how a single-line, colorized logger's Printf handled secrets. The fix is now on the master branch and has been covered with additional tests. Let me know if everything looks good in your tests.

@rahfar
Copy link
Contributor Author

rahfar commented Mar 23, 2024

Super, my test cases are now working as expected, thanks!

@rahfar rahfar closed this as completed Mar 23, 2024
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

No branches or pull requests

2 participants