We know that many of you publish their projects on Github, Bitbucket or other Git repository platforms — which is great! Unfortunately it happens too often, that sensitive data ends up in those public repositories and thus becomes public as well. It’s not just a Kirby issue. You can find all sorts of horrible database connection credentials and API keys all over Github. It’s not even something to be ashamed of. It’s often really hard to think of all the places where sensitive data could be stored and then excluding it. But it’s really really important to do so.
That’s why we wanted to send you an extra reminder to check your repositories and remove everything that shouldn’t be stored in there. If you find something, you should also remove the history for it from your repository in order to completely get rid of traces of such data. Github has a great guide for it: https://help.github.com/articles/remove-sensitive-data/
In our starterkits, we include a default gitignore file, which should skip all the critical parts. But please still check for the following:
Never ever include any account file in /site/accounts
Don’t include your /site/config/config.php
Don’t include cache files in /site/cache
Suggestions for additional checks:
check your htaccess for critical server setup rules before you include it.
do you store any sensitive data in your content files? if yes, please exclude them.
think about places where API keys for 3rd party services could be stored and exclude them
do you have additional database credentials stored somewhere?
do you store any server credentials with your projects? (hint: never do that)
We hope that such posts and guides help to keep you and your sites from unnecessary troubles. Let us know if you have additional suggestions, what other users should keep in mind.
It’s not a highly critical advice in terms of security, but cache files should be ignored because they will be different on your local machine and on your server (urls and stuff) By excluding them, you avoid possible issues.
It might also make sense to store sensitive data in environment variables, so that anything private is in one place (an .env file) that can easily be excluded in .gitignore, phpdotenv to the help.
I don’t know, whether someone needs this file on their webserver, but this file is very small and very usefull for the security on every webserver, if (may be much later !!!) someone wants to publish their projects on Github, Bitbucket or other Git repository platforms, regardless of whether they remember this posts or not!
If the webmasters want, they can change every line, if they know what they do!
But this addition to these files would be safe I think.