Bloomberg LP Interview Question
Software Engineer / DevelopersCheck the user permissions to the file and respond correspondingly
If the user tries a chmod command on the file to escalate his privileges ,reject the request
if the user tries to create a link to the file somewhere else in his directory , reject the request for sensitive files
If the user is the owner of the file only then allow to edit the file else don't
Open the file in a mode according to the privileges of the user like read-only, write-only,execute only, keep the default mode for all the files as read-only
Although not the only thing, one of the most dangerous things a user can do is replace the file that is being opened by some malicious program. Therefore even before opening the file one can first perform and lstat and check the various properties of the files to make sure it is the correct file. In other words, make sure the file has not been changed.
- Bajanfella June 17, 2009