mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 13:47:16 +00:00

Adds a "dependencies" field to resources in policy manifest files. In order to ease development and testing while using manifests, wildcard values for both "dependencies" and "integrity" have been added using the boolean value "true" in the policy manifest. PR-URL: https://github.com/nodejs/node/pull/28767 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
91 lines
1.9 KiB
JavaScript
91 lines
1.9 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const assert = require('assert');
|
|
const { spawnSync } = require('child_process');
|
|
|
|
const dep = fixtures.path('policy', 'parent.js');
|
|
{
|
|
const depPolicy = fixtures.path(
|
|
'policy',
|
|
'dependencies',
|
|
'dependencies-redirect-policy.json');
|
|
const { status } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--experimental-policy', depPolicy, dep,
|
|
]
|
|
);
|
|
assert.strictEqual(status, 0);
|
|
}
|
|
{
|
|
const depPolicy = fixtures.path(
|
|
'policy',
|
|
'dependencies',
|
|
'dependencies-redirect-builtin-policy.json');
|
|
const { status } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--experimental-policy', depPolicy, dep,
|
|
]
|
|
);
|
|
assert.strictEqual(status, 0);
|
|
}
|
|
{
|
|
const depPolicy = fixtures.path(
|
|
'policy',
|
|
'dependencies',
|
|
'dependencies-redirect-unknown-builtin-policy.json');
|
|
const { status } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--experimental-policy', depPolicy, dep,
|
|
]
|
|
);
|
|
assert.strictEqual(status, 1);
|
|
}
|
|
{
|
|
const depPolicy = fixtures.path(
|
|
'policy',
|
|
'dependencies',
|
|
'dependencies-wildcard-policy.json');
|
|
const { status } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--experimental-policy', depPolicy, dep,
|
|
]
|
|
);
|
|
assert.strictEqual(status, 0);
|
|
}
|
|
{
|
|
const depPolicy = fixtures.path(
|
|
'policy',
|
|
'dependencies',
|
|
'dependencies-empty-policy.json');
|
|
const { status } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--experimental-policy', depPolicy, dep,
|
|
]
|
|
);
|
|
assert.strictEqual(status, 1);
|
|
}
|
|
{
|
|
const depPolicy = fixtures.path(
|
|
'policy',
|
|
'dependencies',
|
|
'dependencies-missing-policy.json');
|
|
const { status } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--experimental-policy', depPolicy, dep,
|
|
]
|
|
);
|
|
assert.strictEqual(status, 1);
|
|
}
|