Is fs the only built-in module that can access the filesystem?

I know there are other things like require

that that can access the real filesystem, but this isfs

what is used for this .

Did I understand correctly that there are no other built-in functions that have direct disk access?

That is, if I could globally rewrite all the methods with fs

my own macs that read from (and write) the virtual file system in memory, then there would be no way to access the real file system - is that right?

+3


source to share


2 answers


In principle, this is correct. But other modules can start processes to access the filesystem, or they can use some of their own addons that use the filesystem. If you want to do this as a security measure, it won't be enough. If you want to make sure that no module can access the real filesystem, you will have to capture system calls at the OS level and ensure that no external process can be started. Not an easy task. Probably the same could be facilitated by using containers that would operate on an in-memory filesystem and not have access to an external filesystem on the host system, not at the JavaScript level.



+2


source


There are many ways to access the file system.
Executing a child process

ls
cd ..
nano filename

      



and get the result.

0


source







All Articles