Skip to content

Commit 951af83

Browse files
authored
lib,src: remove --experimental-policy
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #52583 Refs: #52575 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent 9a1df15 commit 951af83

File tree

90 files changed

+116
-5720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+116
-5720
lines changed

benchmark/policy/policy-startup.js

-51
This file was deleted.

doc/api/cli.md

-25
Original file line numberDiff line numberDiff line change
@@ -881,16 +881,6 @@ following permissions are restricted:
881881
* Child Process - manageable through [`--allow-child-process`][] flag
882882
* Worker Threads - manageable through [`--allow-worker`][] flag
883883

884-
### `--experimental-policy`
885-
886-
<!-- YAML
887-
added: v11.8.0
888-
-->
889-
890-
> Stability: 0 - Deprecated: Will be removed shortly.
891-
892-
Use the specified file as a security policy.
893-
894884
### `--experimental-require-module`
895885

896886
<!-- YAML
@@ -1508,18 +1498,6 @@ unless either the `--pending-deprecation` command-line flag, or the
15081498
are used to provide a kind of selective "early warning" mechanism that
15091499
developers may leverage to detect deprecated API usage.
15101500

1511-
### `--policy-integrity=sri`
1512-
1513-
<!-- YAML
1514-
added: v12.7.0
1515-
-->
1516-
1517-
> Stability: 0 - Deprecated: Will be removed shortly.
1518-
1519-
Instructs Node.js to error prior to running any code if the policy does not have
1520-
the specified integrity. It expects a [Subresource Integrity][] string as a
1521-
parameter.
1522-
15231501
### `--preserve-symlinks`
15241502

15251503
<!-- YAML
@@ -2622,7 +2600,6 @@ one is included in the list below.
26222600
* `--experimental-modules`
26232601
* `--experimental-network-imports`
26242602
* `--experimental-permission`
2625-
* `--experimental-policy`
26262603
* `--experimental-print-required-tla`
26272604
* `--experimental-require-module`
26282605
* `--experimental-shadow-realm`
@@ -2664,7 +2641,6 @@ one is included in the list below.
26642641
* `--openssl-legacy-provider`
26652642
* `--openssl-shared-config`
26662643
* `--pending-deprecation`
2667-
* `--policy-integrity`
26682644
* `--preserve-symlinks-main`
26692645
* `--preserve-symlinks`
26702646
* `--prof-process`
@@ -3136,7 +3112,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
31363112
[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage
31373113
[ShadowRealm]: https://github.com/tc39/proposal-shadowrealm
31383114
[Source Map]: https://sourcemaps.info/spec.html
3139-
[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
31403115
[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
31413116
[V8 code cache]: https://v8.dev/blog/code-caching-for-devs
31423117
[`"type"`]: packages.md#type

doc/api/deprecations.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ Type: Documentation-only (supports [`--pending-deprecation`][])
23542354
`process.binding()` is for use by Node.js internal code only.
23552355

23562356
While `process.binding()` has not reached End-of-Life status in general, it is
2357-
unavailable when [policies][] or the [permission model][] are enabled.
2357+
unavailable when the [permission model][] is enabled.
23582358

23592359
### DEP0112: `dgram` private APIs
23602360

@@ -3836,7 +3836,6 @@ is deprecated to better align with recommendations per [NIST SP 800-38D][].
38363836
[legacy URL API]: url.md#legacy-url-api
38373837
[legacy `urlObject`]: url.md#legacy-urlobject
38383838
[permission model]: permissions.md#permission-model
3839-
[policies]: permissions.md#policies
38403839
[static methods of `crypto.Certificate()`]: crypto.md#class-certificate
38413840
[subpath exports]: packages.md#subpath-exports
38423841
[subpath imports]: packages.md#subpath-imports

doc/api/errors.md

+94-63
Original file line numberDiff line numberDiff line change
@@ -2159,68 +2159,6 @@ added:
21592159
An ESM loader hook returned without calling `next()` and without explicitly
21602160
signaling a short circuit.
21612161

2162-
<a id="ERR_MANIFEST_ASSERT_INTEGRITY"></a>
2163-
2164-
### `ERR_MANIFEST_ASSERT_INTEGRITY`
2165-
2166-
An attempt was made to load a resource, but the resource did not match the
2167-
integrity defined by the policy manifest. See the documentation for [policy][]
2168-
manifests for more information.
2169-
2170-
<a id="ERR_MANIFEST_DEPENDENCY_MISSING"></a>
2171-
2172-
### `ERR_MANIFEST_DEPENDENCY_MISSING`
2173-
2174-
An attempt was made to load a resource, but the resource was not listed as a
2175-
dependency from the location that attempted to load it. See the documentation
2176-
for [policy][] manifests for more information.
2177-
2178-
<a id="ERR_MANIFEST_INTEGRITY_MISMATCH"></a>
2179-
2180-
### `ERR_MANIFEST_INTEGRITY_MISMATCH`
2181-
2182-
An attempt was made to load a policy manifest, but the manifest had multiple
2183-
entries for a resource which did not match each other. Update the manifest
2184-
entries to match in order to resolve this error. See the documentation for
2185-
[policy][] manifests for more information.
2186-
2187-
<a id="ERR_MANIFEST_INVALID_RESOURCE_FIELD"></a>
2188-
2189-
### `ERR_MANIFEST_INVALID_RESOURCE_FIELD`
2190-
2191-
A policy manifest resource had an invalid value for one of its fields. Update
2192-
the manifest entry to match in order to resolve this error. See the
2193-
documentation for [policy][] manifests for more information.
2194-
2195-
<a id="ERR_MANIFEST_INVALID_SPECIFIER"></a>
2196-
2197-
### `ERR_MANIFEST_INVALID_SPECIFIER`
2198-
2199-
A policy manifest resource had an invalid value for one of its dependency
2200-
mappings. Update the manifest entry to match to resolve this error. See the
2201-
documentation for [policy][] manifests for more information.
2202-
2203-
<a id="ERR_MANIFEST_PARSE_POLICY"></a>
2204-
2205-
### `ERR_MANIFEST_PARSE_POLICY`
2206-
2207-
An attempt was made to load a policy manifest, but the manifest was unable to
2208-
be parsed. See the documentation for [policy][] manifests for more information.
2209-
2210-
<a id="ERR_MANIFEST_TDZ"></a>
2211-
2212-
### `ERR_MANIFEST_TDZ`
2213-
2214-
An attempt was made to read from a policy manifest, but the manifest
2215-
initialization has not yet taken place. This is likely a bug in Node.js.
2216-
2217-
<a id="ERR_MANIFEST_UNKNOWN_ONERROR"></a>
2218-
2219-
### `ERR_MANIFEST_UNKNOWN_ONERROR`
2220-
2221-
A policy manifest was loaded, but had an unknown value for its "onerror"
2222-
behavior. See the documentation for [policy][] manifests for more information.
2223-
22242162
<a id="ERR_MEMORY_ALLOCATION_FAILED"></a>
22252163

22262164
### `ERR_MEMORY_ALLOCATION_FAILED`
@@ -3436,6 +3374,100 @@ removed: v21.1.0
34363374

34373375
An import attribute is not supported by this version of Node.js.
34383376

3377+
<a id="ERR_MANIFEST_ASSERT_INTEGRITY"></a>
3378+
3379+
### `ERR_MANIFEST_ASSERT_INTEGRITY`
3380+
3381+
<!-- YAML
3382+
removed: REPLACEME
3383+
-->
3384+
3385+
An attempt was made to load a resource, but the resource did not match the
3386+
integrity defined by the policy manifest. See the documentation for policy
3387+
manifests for more information.
3388+
3389+
<a id="ERR_MANIFEST_DEPENDENCY_MISSING"></a>
3390+
3391+
### `ERR_MANIFEST_DEPENDENCY_MISSING`
3392+
3393+
<!-- YAML
3394+
removed: REPLACEME
3395+
-->
3396+
3397+
An attempt was made to load a resource, but the resource was not listed as a
3398+
dependency from the location that attempted to load it. See the documentation
3399+
for policy manifests for more information.
3400+
3401+
<a id="ERR_MANIFEST_INTEGRITY_MISMATCH"></a>
3402+
3403+
### `ERR_MANIFEST_INTEGRITY_MISMATCH`
3404+
3405+
<!-- YAML
3406+
removed: REPLACEME
3407+
-->
3408+
3409+
An attempt was made to load a policy manifest, but the manifest had multiple
3410+
entries for a resource which did not match each other. Update the manifest
3411+
entries to match in order to resolve this error. See the documentation for
3412+
policy manifests for more information.
3413+
3414+
<a id="ERR_MANIFEST_INVALID_RESOURCE_FIELD"></a>
3415+
3416+
### `ERR_MANIFEST_INVALID_RESOURCE_FIELD`
3417+
3418+
<!-- YAML
3419+
removed: REPLACEME
3420+
-->
3421+
3422+
A policy manifest resource had an invalid value for one of its fields. Update
3423+
the manifest entry to match in order to resolve this error. See the
3424+
documentation for policy manifests for more information.
3425+
3426+
<a id="ERR_MANIFEST_INVALID_SPECIFIER"></a>
3427+
3428+
### `ERR_MANIFEST_INVALID_SPECIFIER`
3429+
3430+
<!-- YAML
3431+
removed: REPLACEME
3432+
-->
3433+
3434+
A policy manifest resource had an invalid value for one of its dependency
3435+
mappings. Update the manifest entry to match to resolve this error. See the
3436+
documentation for policy manifests for more information.
3437+
3438+
<a id="ERR_MANIFEST_PARSE_POLICY"></a>
3439+
3440+
### `ERR_MANIFEST_PARSE_POLICY`
3441+
3442+
<!-- YAML
3443+
removed: REPLACEME
3444+
-->
3445+
3446+
An attempt was made to load a policy manifest, but the manifest was unable to
3447+
be parsed. See the documentation for policy manifests for more information.
3448+
3449+
<a id="ERR_MANIFEST_TDZ"></a>
3450+
3451+
### `ERR_MANIFEST_TDZ`
3452+
3453+
<!-- YAML
3454+
removed: REPLACEME
3455+
-->
3456+
3457+
An attempt was made to read from a policy manifest, but the manifest
3458+
initialization has not yet taken place. This is likely a bug in Node.js.
3459+
3460+
<a id="ERR_MANIFEST_UNKNOWN_ONERROR"></a>
3461+
3462+
### `ERR_MANIFEST_UNKNOWN_ONERROR`
3463+
3464+
<!-- YAML
3465+
removed: REPLACEME
3466+
-->
3467+
3468+
A policy manifest was loaded, but had an unknown value for its "onerror"
3469+
behavior. See the documentation for policy manifests for more information.
3470+
34393471
<a id="ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST"></a>
34403472

34413473
### `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`
@@ -4016,7 +4048,6 @@ An error occurred trying to allocate memory. This should never happen.
40164048
[domains]: domain.md
40174049
[event emitter-based]: events.md#class-eventemitter
40184050
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor
4019-
[policy]: permissions.md#policies
40204051
[relative URL]: https://url.spec.whatwg.org/#relative-url-string
40214052
[self-reference a package using its name]: packages.md#self-referencing-a-package-using-its-name
40224053
[special scheme]: https://url.spec.whatwg.org/#special-scheme

doc/api/policy.md

-11
This file was deleted.

doc/node.1

-6
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ Enable experimental support for loading modules using `import` over `https:`.
174174
.It Fl -experimental-permission
175175
Enable the experimental permission model.
176176
.
177-
.It Fl -experimental-policy
178-
Use the specified file as a security policy.
179-
.
180177
.It Fl -experimental-shadow-realm
181178
Use this flag to enable ShadowRealm support.
182179
.
@@ -334,9 +331,6 @@ Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is
334331
.It Fl -pending-deprecation
335332
Emit pending deprecation warnings.
336333
.
337-
.It Fl -policy-integrity Ns = Ns Ar sri
338-
Instructs Node.js to error prior to running any code if the policy does not have the specified integrity. It expects a Subresource Integrity string as a parameter.
339-
.
340334
.It Fl -preserve-symlinks
341335
Instructs the module loader to preserve symbolic links when resolving and caching modules other than the main module.
342336
.

lib/internal/errors.js

-35
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
const {
1414
AggregateError,
15-
ArrayFrom,
1615
ArrayIsArray,
1716
ArrayPrototypeFilter,
1817
ArrayPrototypeIncludes,
@@ -1555,40 +1554,6 @@ E(
15551554
' `shortCircuit: true` in the hook\'s return.',
15561555
Error,
15571556
);
1558-
E('ERR_MANIFEST_ASSERT_INTEGRITY',
1559-
(moduleURL, realIntegrities) => {
1560-
let msg = `The content of "${
1561-
moduleURL
1562-
}" does not match the expected integrity.`;
1563-
if (realIntegrities.size) {
1564-
const sri = ArrayPrototypeJoin(
1565-
ArrayFrom(realIntegrities.entries(),
1566-
({ 0: alg, 1: dgs }) => `${alg}-${dgs}`),
1567-
' ',
1568-
);
1569-
msg += ` Integrities found are: ${sri}`;
1570-
} else {
1571-
msg += ' The resource was not found in the policy.';
1572-
}
1573-
return msg;
1574-
}, Error);
1575-
E('ERR_MANIFEST_DEPENDENCY_MISSING',
1576-
'Manifest resource %s does not list %s as a dependency specifier for ' +
1577-
'conditions: %s',
1578-
Error);
1579-
E('ERR_MANIFEST_INTEGRITY_MISMATCH',
1580-
'Manifest resource %s has multiple entries but integrity lists do not match',
1581-
SyntaxError);
1582-
E('ERR_MANIFEST_INVALID_RESOURCE_FIELD',
1583-
'Manifest resource %s has invalid property value for %s',
1584-
TypeError);
1585-
E('ERR_MANIFEST_INVALID_SPECIFIER',
1586-
'Manifest resource %s has invalid dependency mapping %s',
1587-
TypeError);
1588-
E('ERR_MANIFEST_TDZ', 'Manifest initialization has not yet run', Error);
1589-
E('ERR_MANIFEST_UNKNOWN_ONERROR',
1590-
'Manifest specified unknown error behavior "%s".',
1591-
SyntaxError);
15921557
E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error);
15931558
E('ERR_MISSING_ARGS',
15941559
(...args) => {

0 commit comments

Comments
 (0)