Since we can’t simply be notified about random process’s termination1, the question arises: how to keep track of the processes in the permission table? If we don’t delete a permission table entry exactly before the process finishes, another process, intentionally or not, gets the same PID, it would gain unauthorized access to files.
The solution I offer involves writing down process’s start time:
This approach should make “permission hijacking” practically impossible, as it would take a considerable amount of time just to approve the permission. Even if our permissions could be approved instantly it would still take a few scheduler cycles to execute the original program, so the new ones must have a later start time.
This approach still has an issue: the table would be hoarded with old permissions, and therefore waste memory. This might be mitigated by regular cleanups (e.g. every time you create a new permission, check if the oldest one’s process is still running)
Another issue might be speed, because all of the table lookups take linear time. But considering that file opening isn’t exactly a time-critical operation and that the table could be sorted by PID, it does not seem to be that big of an issue.
As mentioned in the initial idea, the source files have to be protected from external access in some way.
Here I can see three solutions:
The first solution would definitely be preferable from the standpoint of compatibility, as it requires no special configuration, and because it mitigates the issue the best, as the attacker has to get encryption keys from the memory. Moreover, it could allow us to deny access for processes running as root
3. However, implementing encryption seems to be way out of scope of this project.
The second solution seems to work well in theory. There are some specific details to be clarified about it’s implementation, but generally it seems to work out.
Although the third solution looks like exactly what we are looking for, but it requires a kernel module that enforces MAC policies. Even though those modules are common on most distros, they are pretty different from each other, and I think their usage should be limited to being an additional layer on top of the second solution.
From the description of the software, it remains unclear what type of user interaction design is appropriate. Do we make a CLI? GUI?
I propose to deal with it like the Transmission did4 – create the backend with an integrated CLI first, and then make GUI wrapper in GTK after (if there would be time, of course :)
).
Programs that are run via shell can have an execution time of a fraction of a second, which means you would have to re-allow the access for them every time you run them. My solution is to give an option to set permissions for specific sessions, so that every command run from a specific terminal window would have the same permissions. Then the permission table would be populated with the session process’s data (e.g. the shell), or maybe this would necessitate a separate table just for the sessions. That might also imply a creation of two CLI tools:
sprequest [PERM]
– request a certain permission for the sessionspdrop
– drop all permissions given to the sessionIt would be annoying to go and allow access for each program every time one of them opens a new file. For example, if the file subsystem looks like this:
Documents/
| Work/
| | horalky_secret_recipe.pdf
| | colleagues.csv
| Notes/
| | set_theory.md
| | Peano_axioms.md
| | ...
| | Cantor_theorem.md
If I want to view my notes, I would want allow my markdown editor the access to all the files in the Documents/Notes
folder to make links work, but when I want to find a name of my colleague, I would like to only give the permission to the Documents/Work/colleagues.csv
file. The solution is obvious: to give an option for the user to give permissions for the entire folder, not just a specific file.
Another issue, severity of which I can’t assess properly, is whether this idea fits the Informatics degree, as it does not seem to be as much of an experimental or “theoretical” idea. In my opinion it sill holds enough water to entertain the possibility though.