Is there a way to limit file and internet access in Matlab?

22 views (last 30 days)
The use case I am thinking of is:
If you are running code that you found online, it might be smart to run it in an "isolated" version of Matlab, just in case someone snuck in any malicious lines of code.
It seems like blocking internet access and restricting file access to the current directory (and perhaps any subdirectories within the current directory) would provide a "safe space" to test a code, and shouldn't be problematic for the vast majority of the vast majority of codes. Ideally, if any directories outside of the current one absolutely required file access (such as where the main Matlab program files are stored) then these would be set to read-only.
Is there any good way to accomplish this?
Thankfully I haven't had any issues with this type of thing, but I recently saw it suggested somewhere that you should carefully go through any code you didn't personally write to check for any malicious code, which is something that I hadn't even considered. While going through code you didn't write is a good idea regardless, there is still the possibility that you overlook something and/or that the code is just too long and complex to go through line-by-line, so setting up an isolated space to run the code (at least for the 1st time you run it) seems like a good safety measure.

Answers (1)

Sudarshan Kolar
Sudarshan Kolar on 24 Apr 2017
Hello Anthony,
I understand that you want to run an isolated version of Matlab. You can use Matlab online or Matlab running in a remoted PC for such scripts/models. To the best of my knowledge, Matlab does not seem to have the feature to restrict internet and file access.
Sudarshan

Categories

Find more on Debugging and Analysis in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!