News for hackers. Stuff that matters.
Re:Show HN: A tool to seed your dev database with real data by kodah on Wednesday April 27, 2022 @06:43PM (#31186747)
Credentials in a config file can be mistakenly checked into a repository. They're easy to exfiltrate from files, say I write a script with well known configuration locations for thousands of applications and just dumbly pull them all from a compromised system. I now have little bits of access to the wider system where I can now jump from system to system.

The best way to store ephemeral secrets is in an environment variable or /dev/shm. This locks the secret behind the scope of the parent process (shell instance) and the user.

Re:Show HN: A tool to seed your dev database with real data by dvt on Wednesday April 27, 2022 @07:28PM (#31187091)
I don't get this logic, that's what .gitignore is for. I've been using .env files for years and never mistakenly checked one into a repo.
Re:Show HN: A tool to seed your dev database with real data by mountainriver on Wednesday April 27, 2022 @08:54PM (#31187659)
This happens literally all the time in large organizations. People make mistakes
Re:Show HN: A tool to seed your dev database with real data by bottled_poe on Thursday April 28, 2022 @01:13AM (#31188979)
And should be easily caught in code reviews and CI jobs?
Re:Show HN: A tool to seed your dev database with real data by viraptor on Thursday April 28, 2022 @02:01AM (#31189203)
Sure, and it will be caught by CI (if you set it up (properly)) and code review (if it happens (and nobody misses it (and no commits are pushed as a cleanup after (...)))).

So basically if everything works perfectly, you won't have that problem. We know processes don't work perfectly, so it's better to avoid that issue in the first place by never leaving the literal tokens in the config.

Also, even if your CI catches the problem, it's too late - your credentials are now in the repo and in the CI system and likely in your log collector attached to the CI. You'll need to roll them. Same with reviews.

Re:Show HN: A tool to seed your dev database with real data by dotancohen on Thursday April 28, 2022 @02:52AM (#31189475)
Which occur after the code is in git and pushed.
Re:Show HN: A tool to seed your dev database with real data by bottled_poe on Thursday April 28, 2022 @10:07AM (#31192618)
So change the secrets and/or find professional developers? Sorry, not sorry, it’s an amateur mistake, not acceptable in a professional environment. Why would an amateur possess the secrets in the first place?
Re:Show HN: A tool to seed your dev database with real data by dotancohen on Thursday April 28, 2022 @11:15AM (#31193502)
I prefer a security model slightly more robust than "None of the professionals working on this project will ever make a mistake".
Re:Show HN: A tool to seed your dev database with real data by mountainriver on Thursday April 28, 2022 @03:00PM (#31196754)
You too?
Re:Show HN: A tool to seed your dev database with real data by d4mi3n on Thursday April 28, 2022 @02:08AM (#31189229)
Ever try cleaning Git commit history? How about having GitHub clear a repository cache containing a secret?

You’re not wrong, but this is a whole class of issue that can be avoided for trivial levels of effort.

Re:Show HN: A tool to seed your dev database with real data by kristjansson on Wednesday April 27, 2022 @11:26PM (#31188421)
It’s not just to protect secrets, it’s better architecture. Rely on an ACCESS_ID/SECRET_KEY pair and it’s easy to bind too tightly to that authentication mechanism. Then providing credentials in production is a pain. Use the standard credential provider chain and the transition to production settings is trivial.
Re:Show HN: A tool to seed your dev database with real data by sverhagen on Thursday April 28, 2022 @02:10AM (#31189233)
Even if you want your credentials in SOME file, you don't want them in THAT file. Because that configuration file contains enough valuable configuration that SHOULD be in Git, in which case the credentials would be in the way.
Re:Show HN: A tool to seed your dev database with real data by kodah on Wednesday April 27, 2022 @08:01PM (#31187300)
idk what to tell you. I work on a security team, one of the tools the team built finds and identifies secrets already checked into VCS or ones at the pre-commit stage. It's certainly not a seldomly used tool.
Re:Show HN: A tool to seed your dev database with real data by mdaniel on Wednesday April 27, 2022 @08:22PM (#31187432)
I believe GP's comment is at the intersection of "the chain is only as strong as its weakest link" and "defenders have to be correct every time, attackers just once"
Re:Show HN: A tool to seed your dev database with real data by fwip on Wednesday April 27, 2022 @08:23PM (#31187437)
Defense in depth. It only takes one person on your team accidentally committing one file for one service before your .gitignore safeguard is no longer guarding anything.
Re:Show HN: A tool to seed your dev database with real data by belthesar on Wednesday April 27, 2022 @09:17PM (#31187787)
Tell that to Solarwinds.
Re:Show HN: A tool to seed your dev database with real data by dboreham on Wednesday April 27, 2022 @08:00PM (#31187299)
Still a bad idea though.
Re:Show HN: A tool to seed your dev database with real data by osrec on Wednesday April 27, 2022 @06:52PM (#31186825)
How do you automate setting that environment variable?
Re:Show HN: A tool to seed your dev database with real data by dboreham on Wednesday April 27, 2022 @08:01PM (#31187306)
For a specific example of one way how : https://github.com/99designs/aws-vault
Re:Show HN: A tool to seed your dev database with real data by toomuchtodo on Wednesday April 27, 2022 @07:03PM (#31186901)
Injection into the environment (container config, Docker, k8s, etc) or the execution context. The actual mechanics are highly dependent on where your secrets are and where they’re going for use. On a dev workstation, could just be some bash or Python using the AWS cli, for example.