Skip to content

Commit 11b5dfb

Browse files
RafaelGSSmhdawsonfacutuescaUlisesGasconfraxken
committed
doc: add Node.js Threat Model
Co-authored-by: Michael Dawson <[email protected]> Co-authored-by: Facundo Tuesca <[email protected]> Co-authored-by: Ulises Gascon <[email protected]> Co-authored-by: Thomas Gentilhomme <[email protected]>
1 parent 5815e3e commit 11b5dfb

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

SECURITY.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,86 @@ Here is the security disclosure policy for Node.js
5353
the release process above to ensure that the disclosure is handled in a
5454
consistent manner.
5555

56+
## What does Node.js trust/not trust
57+
58+
Being able to cause a negative outcome in a way that requires control of the
59+
elements that are trusted by Node.js is not considered a vulnerability in
60+
Node.js.
61+
62+
Being able to cause the following through control of the elements that Node.js
63+
does not trust is considered a vulnerability:
64+
65+
* Disclosure or loss of integrity or confidentiality of data protected through
66+
the correct use of Node.js APIs.
67+
* The unavailability of the runtime, including the unbounded degradation of its
68+
performance.
69+
70+
If Node.js loads configuration files or runs code by default (without a
71+
specific request from the user), and this is not documented, it is considered a
72+
vulnerability.
73+
Vulnerabilities related to this case may be fixed by a documentation update.
74+
75+
**Node.js does NOT trust**
76+
77+
1. The data from network connections that are created through the use of Node.js
78+
APIs and which is transformed/validated by Node.js before being passed to the
79+
application. This includes:
80+
* HTTP APIs (all flavors) client and server APIs.
81+
* DNS APIs.
82+
2. Consumers of data protected through the use of Node.js APIs (for example
83+
people who have access to data encrypted through the Node.js crypto apis).
84+
3. The file content or other IO that is opened for reading or writing by the use
85+
of Node.js APIs (ex: stdin, stdout, stderr). In other words, Node.js doesn’t
86+
interpret buffers unless explicitly set by the user.
87+
88+
**Node.js trusts everything else**. As some examples this includes:
89+
90+
1. The developers and infrastructure that runs it.
91+
2. The operating system that Node.js is running under and its configuration,
92+
along with anything under control of the operating system.
93+
3. The code it is asked to run including JavaScript and native code, even if
94+
said code is dynamically loaded. The code run inherits all the privileges of
95+
the execution user.
96+
4. Inputs provided to it by the code it is asked to run, as it is the
97+
responsibility of the application to perform the required input validations.
98+
5. Any connection used for inspector (debugger protocol) regardless of being
99+
opened by command line options or Node.js APIs, and regardless of the remote
100+
end being on the local machine or remote.
101+
6. The file system when requiring a module.
102+
See <https://nodejs.org/api/modules.html#all-together>.
103+
104+
Any unexpected behavior from the data manipulation from Node.js Internal
105+
functions are considered a vulnerability.
106+
107+
In addition to addressing vulnerabilities based on the above, the project works
108+
to avoid APIs and internal implementations that make it “easy” for application
109+
code to use the APIs incorrectly in a way that results in vulnerabilities within
110+
the application code itself. While we don’t consider those vulnerabilities in
111+
Node.js itself and will not necessarily issue a CVE we do want them to be
112+
reported privately to Node.js first.
113+
We often choose to work to improve our APIs based on those reports and issue
114+
fixes either in regular or security releases depending on how much of a risk to
115+
the community they pose.
116+
117+
### Some examples of applying this thread model include:
118+
119+
#### Malicious Third-Party Modules (CWE-1357)
120+
121+
* Code is trusted by Node.js, therefore any scenario that requires a malicious
122+
third-party module cannot result in a vulnerability in Node.js.
123+
124+
#### Prototype Pollution Attacks (CWE-1321)
125+
126+
* Node.js trusts the inputs provided to it by application code.
127+
It is up to the application to sanitize appropriately, therefore any scenario
128+
that requires control over user input is not considered a vulnerability.
129+
130+
#### Uncontrolled Search Path Element (CWE-427)
131+
132+
* Node.js trusts the file system in the environment accessible to it.
133+
Therefore, it is not a vulnerability if it accesses/loads files from any path
134+
that is accessible to it.
135+
56136
## Receiving security updates
57137

58138
Security notifications will be distributed via the following methods.

0 commit comments

Comments
 (0)