buildkite / elastic-ci-stack-s3-secrets-hooks

🕵️‍♀️ Expose secrets to your buildkite build steps via Amazon S3
MIT License
24 stars 17 forks source link

No private_ssh_key in s3 bucket caused Download secrets step in global environment hook to fail #24

Closed avi-beetul closed 4 years ago

avi-beetul commented 5 years ago

The global environment hook check for these secrets files in the s3 secret bucket:

The problem is that environment hook is tight in having a private ssh key to be present in the secret bucket, otherwise fails and exit the build. Hence the rest of the files (environment/env or git-credentials) aren't being checked.

screen shot 2018-12-16 at 1 33 07 pm

The check condition happens at this line - https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/blob/master/hooks/environment#L45

I believe line 45 should only throw a warning message (remove the exit 1). The reason is the someone may choose to use git-credential for git over https rather than git over ssh. In addition, in my case, due to security reasons, I can only pull the ssh key from the organisation's internal vault and do a ssh-add. Thus, the env script is more appropriate for me.

Perhaps, exit 1 at the end if none of the files exist would make more sense?

pda commented 4 years ago

Thanks @avi-beetul, more than a year later but I think we agree. Pull request #32 proposes removing the exit 1 to make it a soft warning instead of a hard failure.