Live data from Hacker News

Git-secret – store private data in a Git repo

coderwall.com

31–40 of 74 posts

Re: Git-secret – store private data in a Git repo

#31
I used to put .gpg files in my repos that stored sensitive information like database passwords and such.

I don't do that anymore. The main problem as I saw it was that you basically liberate your security to an environment you can't monitor or send rejections to (if someone downloads your gpg file). Compare this to an ssh server which affords both those abilities.

Re: Git-secret – store private data in a Git repo

#32

I've been using https://github.com/ahoward/sekrets in private repos for years. Great tool. I definitely agree this should be used with heavy caution and only in private repos.

This should not even be used in private repos unless the only person who will ever access the repo is you.

Re: Git-secret – store private data in a Git repo

#33
post #21

Earlier quoted context omitted.

It's a bad practice, because git makes keys practically irrevocable. It's not enough to rotate encryption keys, because the old ciphertexts are in the git history; you have to rotate the underlying secrets as well (people don't do this and shouldn't have to). Don't store encrypted secrets in git if you can avoid it.

The problem is you need some repository to store this information and it's incredibly helpful to store the configuration along with the code. If someone has access to a shared secret and then shouldn't you should assume the secret is now compromised and rotate it. Rotating the keys doesn't solve this problem.

No. If that were the case, there would be no purpose to rotating keys. The problem is that despite rotating keys, your old crypto keys have permanent access to secrets, because the old ciphertexts are by default retained in the git history.

It's a bad idea to store secrets in any form in your source code repository.

Re: Git-secret – store private data in a Git repo

#34
post #21

Earlier quoted context omitted.

It's a bad practice, because git makes keys practically irrevocable. It's not enough to rotate encryption keys, because the old ciphertexts are in the git history; you have to rotate the underlying secrets as well (people don't do this and shouldn't have to). Don't store encrypted secrets in git if you can avoid it.

The problem is you need some repository to store this information and it's incredibly helpful to store the configuration along with the code. If someone has access to a shared secret and then shouldn't you should assume the secret is now compromised and rotate it. Rotating the keys doesn't solve this problem.

> The problem is you need some repository to store this information

This doesn't have to be a Git repository, nor does it have to be the same repository as the code which uses the secrets.

> it's incredibly helpful to store the configuration along with the code

It's helpful, but ultimately means that the ciphertext is potentially available to the world and existing keys may decipher it in perpetuity. Thus this is not a recommended tradeoff to make.

Re: Git-secret – store private data in a Git repo

#35
post #21

Earlier quoted context omitted.

It's a bad practice, because git makes keys practically irrevocable. It's not enough to rotate encryption keys, because the old ciphertexts are in the git history; you have to rotate the underlying secrets as well (people don't do this and shouldn't have to). Don't store encrypted secrets in git if you can avoid it.

The problem is you need some repository to store this information and it's incredibly helpful to store the configuration along with the code. If someone has access to a shared secret and then shouldn't you should assume the secret is now compromised and rotate it. Rotating the keys doesn't solve this problem.

It is helpful to store configuration with code, but you don't have to include secret values in your code. It's much better to use a purpose built service like credstash[0] to store secret values while you keep the name of the secret and (possibly) version in a repo with your code.

[0] https://github.com/fugue/credstash

Re: Git-secret – store private data in a Git repo

#36
post #21
post #19

Earlier quoted context omitted.

Perhaps it's an alternative practice/behavior rather than a "bad" practice?

It's a bad practice, because git makes keys practically irrevocable. It's not enough to rotate encryption keys, because the old ciphertexts are in the git history; you have to rotate the underlying secrets as well (people don't do this and shouldn't have to). Don't store encrypted secrets in git if you can avoid it.

Hmmm, I'm thinking you'd have the same problem storing secrets in a blockchain.

Re: Git-secret – store private data in a Git repo

#37
post #21
post #19

Earlier quoted context omitted.

Perhaps it's an alternative practice/behavior rather than a "bad" practice?

It's a bad practice, because git makes keys practically irrevocable. It's not enough to rotate encryption keys, because the old ciphertexts are in the git history; you have to rotate the underlying secrets as well (people don't do this and shouldn't have to). Don't store encrypted secrets in git if you can avoid it.

why shouldn't people have to rotate the underlying secrets?

a rogue employee who created a secret, or any engineer who had to access that secret to get their job done, is always going to be able to use that secret value, regardless of where the encrypted blob is stored.

seems like we should be making it easier to rotate secret values often and automatically.

Re: Git-secret – store private data in a Git repo

#38
post #2

Nice work! I've been using https://github.com/AGWA/git-crypt until now, always good to have more alternatives. Can you tell us what is different about your approach with this project?

I've started using git-crypt for deploying configuration. It keeps things simple and ensures that keys are not in plain text on bit-bucket which is basically good enough right now.

Re: Git-secret – store private data in a Git repo

#39
post #19
post #18

This project scares me because it helps foster a bad practice -- keeping secrets in a repo. You really shouldn't be keeping secrets in the repo. You should be using a secrets service that is designed for such a purpose, like Hashicorp's Vault[0], so that you never have to keep a secret in the code. [0] https://github.com/hashicorp/vault

Perhaps it's an alternative practice/behavior rather than a "bad" practice?

In addition to what others are saying, for many types of secrets (API credentials, salts, keys, etc.) it's good practice to make them different in production vs development. This has the advantage of keeping your production secrets in the domain of ops, and your developers never even need to have them.

This is built on the assumption that you only ever have one set of secrets, or that you don't mind distributing your prod secrets to your engineers, both of which I would consider to be bad practice.

Re: Git-secret – store private data in a Git repo

#40
post #28
post #8

I've been using ansible-vault to solve this problem in our infrastructure repository. A symmetric vault key is encrypted using gpg, and Ansible's vault_password_file is set to to an executable shell script containing `gpg --batch --use-agent --descrypt vault_key.gpg`. Very specific to Ansible, but works fine. It's a shame only files containing variables (we're using group_vars) can be encrypted, and not arbitrary fil…

More things about Ansible vault that are a shame: - no file encryption, only YML - no separate values, only entire file - OMG it's s...l...o...w... - password based instead of certs - only one password - password cannot even stored in an env var More: http://jpmens.net/2014/02/22/my-thoughts-on-ansible-s-vault/

re: your last bullet point, I put my password as the only thing in a text file, then point the environment variable to that. Same effect, although it is one (small) extra step.
Post reply on HN