I think you guys are missing that I am simply defining my own edit and delete programs. Not in ROM, but in my own OS's filesystem. This custom edit and delete prevents users editing important OS files or viewing the users files.
The solution I have chosen works perfectly because you now cannot run, edit or use the old methods of editing/deleting.
Since the user has to use my edit and delete, I can rebuild edit and delete to not allow editing or deletion of my own OS files.
As of this moment, I have found my solution.
Might be better to do something similar for your os files, where they can be read but not written to. It would be easy to write up a short edit program using your edit program, to edit os files, or even doing it manually with the fs api.
it would be something like this:
local blockedPaths = { --1 is read only, 2 is no access
["/rom/programs/edit"] = 2,
["/myOS/file"] = 1,
["/myOs/otherFile"] = 1
}
local open = fs.open
local combine = fs.combine
fs.open = function(path,mode)
for k,v in pairs(blockedPaths) do
if combine("/",path) == k then
if v == 1 then
return open(path,"r") -- defaulting to read mode
elseif v==2 then
return nil
end
end
end
return open(path,mode) -- the path is not blocked
end
This would just be a matter of further preventing the editing of your files. Just know by limiting to read only the file can still be run it just can not be written to. So this would not work for the blocking of the edit program.
With the current restriction someone could use pastebin to get the old edit program (assuming it is enabled). They could also use one of the many auto typers on the forums to enter the program for them. Either way blocking access only in the edit program is bypassable.
edit:
Also something I did not notice at first, simply blocking the delete program in the rom does not block the deleting of files. You would want to overwrite fs.delete similar to how you overwrite fs.open. As long as the user has access to create and run programs, they will have access to these functions. Which means only blocking the program and not the api leaves security holes.