Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 36.4k
Feature Request: Package Permissions #24908
Copy link
Copy link
Closed
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Description
Metadata
Metadata
Assignees
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Problem: Malicious packages
With the recent news of the
event-stream/flatmap-streamattack (summary), it seems like now would be a good time to discuss defending against these kind of attacks.Presently available defences:
While a lockfile is generally good practice, it would require auditing to be effective. There lies the issue, auditing is not feasible. Dependency graphs are too large in most modern projects to effectively audit manually.
Suggestion
One defence is to introduce permissions for node core modules such as
fs,http,process, and others.A
package.jsonwould need to specify which core modules it uses, ex:Restrict import/require such that requiring
httpin this package would throw an error, butfswould be permitted.Each package would be provided a uniquely restricted import/require.
For backwards compatibility packages without a permissions, would be considered to have all permissions. This could be deprecated in favour of always requiring a permissions field.
Additionally tooling could be developed for package managers such as yarn and npm. Users could be alerted when permissions have changed anywhere in their dependency graph. Upon install of a dependency the user could be prompted with accepting the permissions for all packages added to the dependency graph.
This is not intended to eliminate the need for auditing, but could reduce the amount of packages needing audits to a reasonable level.
Outstanding Issues
Other Defences