5

I have a cronjob that runs this command:

curl -s -G -H Authorization: Bearer ${mysecret} ${myurl}

I'm a ding dong--I just realized everyone can see my password when they issue a "ps -ef | grep curl". I tried using the -d option, but was unsuccessful. Do you know how I can hide the value for $mysecret?

user26241
  • 91
  • 2
  • 6

1 Answers1

8

See curl - Read headers from file. You've got two options.

  1. For new versions (7.55 and newer) of curl:

    curl -H @filename ${myurl}

    Where filename holds header and the secrets: Authorization: Bearer mysecret

  2. For older versions create a config file:

    curl -K filename ${myurl}

    Where filename holds the option: -H "Authorization: Bearer mysecret"

YuvGM
  • 414
  • 2
  • 6
  • 2
    Please note, that the double quotes in the second option are important. When I skip them or use single quotes, authentication fails. – Onnonymous Feb 24 '20 at 15:07