Re:Ask HN: My web app was hacked today – Bad experiences and...
by priom on Wednesday February 26, 2020 @11:28PM
(#22430458)
Sorry to hear about your situation, it really sucks. Curious, if you can shed more light on how the .env was exposed?
[ Parent
| on HN ]
Re:Ask HN: My web app was hacked today – Bad experiences and...
by thegoleffect on Wednesday February 26, 2020 @11:32PM
(#22430478)
I don’t know for certain, not op, but sounds like since they pushed the env file, it may have been accessible via URI and since it had all the credentials and host info to access the database, thats all the attacker messed with... and that is more than enough.
Re:Ask HN: My web app was hacked today – Bad experiences and...
by ngranja19 on Wednesday February 26, 2020 @11:36PM
(#22430497)
Haha exactly that was what happened (I guess). My mistake was not only pushing the .env file but also how I stored my Laravel files in the server leaving everything in a public directory where everyone can access to it... :Facepalm:
Re:Ask HN: My web app was hacked today – Bad experiences and...
by gentleman11 on Wednesday February 26, 2020 @11:46PM
(#22430548)
I usually make sure my .env files are in my .gitignore, but honestly its just my memory that prevents me from slipping up one day.
Is there an automated strategy that protects against slipups like this?
Re:Ask HN: My web app was hacked today – Bad experiences and...
by enitihas on Thursday February 27, 2020 @01:26AM
(#22431089)
Use a git template for .git/info/exclude. This will make sure that every new repo you create or clone will have by default exclude list. Git templates can be used for other stuff too. I use them for having a pre-push hook to run a clean build.
Re:Ask HN: My web app was hacked today – Bad experiences and...
by throwaway8941 on Thursday February 27, 2020 @06:29AM
(#22432362)
Put them into your global .gitignore
echo -e >>~/.config/git/config '[core]\n excludesFile = ~/.config/git/gitignore'
echo >>~/.config/git/gitignore '.env'