Skip to content

Adding filesystem and http(s) security #42546

@intervalia

Description

@intervalia

What is the problem this feature will solve?

I keep thinking that Node needs to add some level of security for both the filesystem and http(s) communications and probably other things too. I know that DENO makes great claims on security, though I admit not reading about HOW they do it.

This is just an idea to get people thinking and, hopefully, get something built into Node.

This would prevent rogue packages from doing things they are not allowed to do.

What is the feature you are proposing to solve the problem?

I would love to see node, by default, not allow any filesystem reads or writes and not allow any http(s) communications. This could be an option with a command line flag, but I would love to see it standard.

Then the developers would provide a "rights" file. This file would allow the developer to include read and write access folders in the file system as well as valid URLs that can be accessed. Again this model could extend to other things that could be abused.

The file could be a simple JSON file that provides the list of whitelisted folders and urls for this application. Something like this:

{
  "folders": {
    "./storage": "rw",
    "./options": "r",
    "./dowloads": "w"
  },
  "domains": {
    "www.something.com": "r",
    "www.myapisite.com": "rw"
  }
}

This is just an example to get people thinking.

You could also open things up 100% by doing something like this:

{
  "folders": {
    "/**": "rw"
  },
  "domains": {
    "*": "rw"
  }
}

I would love to see Node.js become more secure and this could be a great step to seeing that future.

What alternatives have you considered?

I don't know of any way to make the filesystem and http(s) secure in node. It allows access to anything the OS allows access to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions