1
- # Policies
1
+ # Permissions
2
+
3
+ This section exposes security features available to be adopted in a
4
+ Node.js application. The available scopes are:
5
+
6
+ * [ Resource-based permissions] ( #resource-based-permissions )
7
+ * [ Process-based permissions] ( #process-based-permissions )
8
+
9
+ Resource-based permissions stands for the managment of modules using
10
+ policies. A policy can guarantee which module/resource is available
11
+ during the application execution.
12
+
13
+ Process-based permissions stands for the management of resources such
14
+ as _ File System_ or _ Network_ . A permission can be configured to restrict
15
+ access to specific resources, for instance, one can restrict access to
16
+ all the _ File System_ write.
17
+
18
+ Both permissions can be used together to provide a safer environment.
19
+
20
+ ** Note** : if you find a potential security vulnerability on Node.js,
21
+ refer to our [ Security Policy] [ ] .
22
+
23
+ ## Resource-based permissions
24
+
25
+ ## Policies
2
26
3
27
<!-- introduced_in=v11.8.0-->
4
28
@@ -22,7 +46,7 @@ by the running Node.js application in any way. A typical setup would be to
22
46
create the policy file as a different user id than the one running Node.js
23
47
and granting read permissions to the user id running Node.js.
24
48
25
- ## Enabling
49
+ ### Enabling
26
50
27
51
<!-- type=misc -->
28
52
@@ -48,9 +72,9 @@ even if the file is changed on disk.
48
72
node --experimental-policy=policy.json --policy-integrity=" sha384-SggXRQHwCG8g+DktYYzxkXRIkTiEYWBHqev0xnpCxYlqMBufKZHAHQM3/boDaI/0" app.js
49
73
```
50
74
51
- ## Features
75
+ ### Features
52
76
53
- ### Error behavior
77
+ #### Error behavior
54
78
55
79
When a policy check fails, Node.js by default will throw an error.
56
80
It is possible to change the error behavior to one of a few possibilities
@@ -74,7 +98,7 @@ available to change the behavior:
74
98
}
75
99
```
76
100
77
- ### Integrity checks
101
+ #### Integrity checks
78
102
79
103
Policy files must use integrity checks with Subresource Integrity strings
80
104
compatible with the browser
@@ -116,7 +140,7 @@ body for the resource which can be useful for local development. It is not
116
140
recommended in production since it would allow unexpected alteration of
117
141
resources to be considered valid.
118
142
119
- ### Dependency redirection
143
+ #### Dependency redirection
120
144
121
145
An application may need to ship patched versions of modules or to prevent
122
146
modules from allowing all modules access to all other modules. Redirection
@@ -423,6 +447,9 @@ not adopt the origin of the `blob:` URL.
423
447
Additionally, import maps only work on ` import ` so it may be desirable to add a
424
448
` "import" ` condition to all dependency mappings.
425
449
450
+ ## Process-based permissions
451
+
426
452
[ import maps ] : https://url.spec.whatwg.org/#relative-url-with-fragment-string
427
453
[ relative-url string ] : https://url.spec.whatwg.org/#relative-url-with-fragment-string
428
454
[ special schemes ] : https://url.spec.whatwg.org/#special-scheme
455
+ [ Security Policy ] : https://github.com/nodejs/node/blob/main/SECURITY.md
0 commit comments