C
C#•10mo ago
Rodersnow

Avoid commit and push sensative infomation

What are best practices for securely storing sensitive strings or secrets within a project to prevent them from being committed to a GitHub repository by version control systems?
12 Replies
Pobiega
Pobiega•10mo ago
* dotnet new gitignore * User secrets instead of appsettings for secrets during dev * Azure KeyVault/AWS SecretManager/k8s secrets or similar for production
Safe storage of app secrets in development in ASP.NET Core
Learn how to store and retrieve sensitive information during the development of an ASP.NET Core app.
mtreit
mtreit•10mo ago
GitHub
detect-secrets Action - GitHub Marketplace
Scans your GitHub repository for accidentally committed secrets, enhances code security, and aids in secret cleanup
mtreit
mtreit•10mo ago
We use something similar, except it's for Azure Dev Ops repos. And I've accidentally committed secrets before we had it in place. :catshy:
Pobiega
Pobiega•10mo ago
discord has something that scans all github repos for bot tokens. I accidentally pushed one and it was immediately invalidated and I got a message here on discord about it 🙂
Rodersnow
RodersnowOP•10mo ago
wow, this was something I have been searching for. Thanks mate:)
Pobiega
Pobiega•10mo ago
yw
Rodersnow
RodersnowOP•10mo ago
haha, yeah I just commited accidentally jwt secret key to a public repository. that is why I'm looking for a way to avoid it in the future😂
Pobiega
Pobiega•10mo ago
regenerate and remove 🙂
mtreit
mtreit•10mo ago
Having the code read secrets from environment variables instead of config files or the like is a good way to help avoid that.
Rodersnow
RodersnowOP•10mo ago
yeah that is true
Petris
Petris•10mo ago
Or just having config files outside of the repo
mindhardt
mindhardt•10mo ago
I myself just put some placeholder values in app settings (just to portray config structure) but actual configs are stored in the .env file on my server (my projects are deployed with docker-compose)
Want results from more Discord servers?
Add your server