Skip to content

RFC: Package capability declarations - #933

Open
Jacob-Nuwamanya77 wants to merge 2 commits into
npm:mainfrom
Jacob-Nuwamanya77:package-capability-declarations
Open

Jacob-Nuwamanya77 wants to merge 2 commits into
npm:mainfrom
Jacob-Nuwamanya77:package-capability-declarations

Conversation

@Jacob-Nuwamanya77

Copy link
Copy Markdown

I'm Jacob Nuwamanya. I built TreeCustodian, an open-source static security tool for npm (https://gitlab.com/treecustodian/treecustodian), as part of my Master's in Information Technology at ISBAT University. This proposal comes from measuring its false alarms on legitimate packages, where most came from capabilities that a security tool cannot tell apart from an attack without knowing what the package author intended.

This RFC proposes an optional capabilities field in package.json, in which a package author declares what the package accesses by itself at install and when it is loaded. The four kinds are network hosts, files, programs it starts and environment variables. A runtime phase is reserved for a later version. The field grants no permission and enforces nothing. It gives package managers something to show, and security tools a statement of intent to compare with what they observe and with the previous published version.

It also strengthens RFC #54 (install scripts opt-in). Approval decides whether an install script runs, and a declaration says what it does.

An example implementation that reads the field is on a branch of TreeCustodian, https://gitlab.com/treecustodian/treecustodian/-/tree/18-capability-declarations. The measurement behind the motivation is described at https://gitlab.com/treecustodian/treecustodian/-/blob/main/docs/EVALUATION.md.

Feedback I would especially value:

  • whether install and load are the right phases, and whether the rule that a phase is set by what makes code run is clear
  • the four capability categories and the path placeholders
  • where npm could show declarations and their changes, which the RFC leaves to the npm maintainers

@Jacob-Nuwamanya77
Jacob-Nuwamanya77 requested a review from a team as a code owner November 27, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant