Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protecting Properties file?

Do you guys know of any way that I could go about protecting my properties file so that only my program can alter it? I wouldn't want someone to be able to read the properties file either if it was possible.

like image 699
user2388169 Avatar asked Dec 21 '22 05:12

user2388169


1 Answers

You are asking a question in terms of absolutes, and there is no absolute way to do it. If your program can read and modify your file, then there must be a way for some other program or person to do it too.

File permissions may help, but can you trust the root or admin user?

Even if the permissions are right, can you trust other programs that run as your username?

Encrypting the file will make it more difficult for someone to read the file, but not to corrupt it. And a 'determined' person with access to your program will be able to find the decryption key (otherwise you could not read it yourself).

Bottom line is that you need to ask yourself "what reasonable steps can I take to make it not worth trying to access/read/change the file?"

like image 143
rolfl Avatar answered Jan 10 '23 22:01

rolfl