Change: move sensitive information to secrets.cfg and private information to private.cfg #9298
Motivation / Problem
While working on the STUN patch (#9017), I wanted to store a secret on the client. The only place we currently have to do this, is
In my case, this would mean that getting your hands on an
A closer look made us realise that storing secrets in
In result, I set out to find a way to create a
Additionally, as suggested by @rubidium42 , I also created a
Basically, everything with identifiable information. This information people shouldn't be sharing freely either, but aren't exactly secrets.
When you start the game the first time with/after this PR, while already having a settings file from before, it will automatically migrate the settings to the new files and remove it from
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
The text was updated successfully, but these errors were encountered:
I really would like to have the migration in this PR too, but my earlier attempts failed. But I now have an idea how I possibly can pull it off :) Tnx to some rewrites someone did :P
I like this approach. I will make it so :)
This current version doesn't work as I want it .. our ini-loader is rather annoying :P
I tried to load first from
Finally had a good idea how to do the migration ... by introducing an
That does mean that if you go back to before this PR, those fields reset. But if you go past this PR again, as
However, I am unsure if adding a IniFileVersion is really needed. I could also just add a flag or indicator. Not sure if this would ever be used again in the future. But I need at least something to know you have been past this PR with your configuration .. so alternatives for this are more than welcome.
Also, there is now
Can I suggest writing a short comment at the top of
To put IRC here:
I am not too worried that people confuse this
The small downside of this approach is, that it will always overwrite this comment, so if people manually alter it, it will be overwritten on next save. This shouldn't be a problem at all, but before this change, ini-files always kept what-ever spacing/comments was between groups.
Instead of creating the object on heap and use a pointer, create the object on stack and use a guaranteed-not-null pointer. The size of IniFile doesn't warrent the forcing to heap. Additionally, use a subclass instead of a function to do some initial bookkeeping on an IniFile meant to read a configuration.
…tion to private.cfg We often ask people for their openttd.cfg, which now includes their passwords, usernames, etc. It is easy for people to overlook this, unwillingly sharing information they shouldn't. By splitting this information over either private.cfg or secrets.cfg, we make it more obvious they shouldn't be sharing those files, and hint to what is inside them.