Skip to content

Avoid repetition of whitelisted modules #11

@arrustamyan

Description

@arrustamyan

First of all - great idea! I can definitely see myself integrating something like this in my codebases.

But this got me thinking about modules that are required across many files (e.g. something like request). It's going to be unmanageable repeating secureRequire("awesomeModule", ["dep1", "dep2", ...]) all over the code.

Obvious solution that comes to mind is having a configuration file that will hold whitelists:

{
  "awesomeModule": ["dep1", "dep2", ...]
}

so you can just go with secureRequire("awesomeModule").

I know this might sound like a stretch, but it the future this might even part of package.json as a vital part of your module's definition:

package.json

{
...
  "dependencies": [...],
  "security": {
    "awesomeModule": ["dep1", "dep2", ...]
  }
...
}

Or maybe you already have a solution in your mind that addresses this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions