Imagine a web application that performs two main functions:
- Serves data from a file that requires the above privileges to read from
- Serves data from a file that requires lower privileges to read from
My guess: To allow reading of both files, I will need to start node using an account that could read both files.
If node is running under an account that has access to both files, then a user who does not have to read any file that requires higher permissions can potentially read these files due to a lack of security in the web application code. This will be disastrous in my imaginary world of web applications.
Ideally, a node process can run with a minimal set of rights, and then temporarily escalate these rights before accessing a system resource.
Questions: Can node temporarily increase privileges? Or is there a better way?
If not, I'm considering starting two different servers (one with higher privileges and one with lower privileges), and then both of them behind a proxy server that authenticates / authorizes before sending the request.
Thanks.
Tim stewart
source share