@@ -103,6 +103,47 @@ If this flag is passed, the behavior can still be set to not abort through
103
103
[ ` process.setUncaughtExceptionCaptureCallback() ` ] [ ] (and through usage of the
104
104
` node:domain ` module that uses it).
105
105
106
+ ### ` --allow-addons `
107
+
108
+ <!-- YAML
109
+ added: REPLACEME
110
+ -->
111
+
112
+ > Stability: 1.1 - Active development
113
+
114
+ When using the [ Permission Model] [ ] , the process will not be able to use
115
+ native addons by default.
116
+ Attempts to do so will throw an ` ERR_DLOPEN_DISABLED ` unless the
117
+ user explicitly passes the ` --allow-addons ` flag when starting Node.js.
118
+
119
+ Example:
120
+
121
+ ``` cjs
122
+ // Attempt to require an native addon
123
+ require (' nodejs-addon-example' );
124
+ ```
125
+
126
+ ``` console
127
+ $ node --experimental-permission --allow-fs-read=* index.js
128
+ node:internal/modules/cjs/loader:1319
129
+ return process.dlopen(module, path.toNamespacedPath(filename));
130
+ ^
131
+
132
+ Error: Cannot load native addon because loading addons is disabled.
133
+ at Module._extensions..node (node:internal/modules/cjs/loader:1319:18)
134
+ at Module.load (node:internal/modules/cjs/loader:1091:32)
135
+ at Module._load (node:internal/modules/cjs/loader:938:12)
136
+ at Module.require (node:internal/modules/cjs/loader:1115:19)
137
+ at require (node:internal/modules/helpers:130:18)
138
+ at Object.<anonymous> (/home/index.js:1:15)
139
+ at Module._compile (node:internal/modules/cjs/loader:1233:14)
140
+ at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
141
+ at Module.load (node:internal/modules/cjs/loader:1091:32)
142
+ at Module._load (node:internal/modules/cjs/loader:938:12) {
143
+ code: 'ERR_DLOPEN_DISABLED'
144
+ }
145
+ ```
146
+
106
147
### ` --allow-child-process `
107
148
108
149
<!-- YAML
@@ -2369,6 +2410,7 @@ Node.js options that are allowed are:
2369
2410
2370
2411
<!-- node-options-node start -->
2371
2412
2413
+ * ` --allow-addons `
2372
2414
* ` --allow-child-process `
2373
2415
* ` --allow-fs-read `
2374
2416
* ` --allow-fs-write `
0 commit comments