aboutsummaryrefslogtreecommitdiff
path: root/lib/internal/errors.js
diff options
context:
space:
mode:
authorBradley Farias <bradley.meck@gmail.com>2018-09-13 14:27:12 -0500
committerBradley Farias <bradley.meck@gmail.com>2019-01-17 09:43:42 -0600
commit9d5fbeb55fb1927928237e09475d39346d9c3ad9 (patch)
treeca2f567ff647c9a1706f39e93e54caa03cd98c1d /lib/internal/errors.js
parent7b6e9aedaf8c9aa219ff759bed6b1680910eefe0 (diff)
downloadandroid-node-v8-9d5fbeb55fb1927928237e09475d39346d9c3ad9.tar.gz
android-node-v8-9d5fbeb55fb1927928237e09475d39346d9c3ad9.tar.bz2
android-node-v8-9d5fbeb55fb1927928237e09475d39346d9c3ad9.zip
policy: manifest with subresource integrity checks
This enables code loaded via the module system to be checked for integrity to ensure the code loaded matches expectations. PR-URL: https://github.com/nodejs/node/pull/23834 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/internal/errors.js')
-rw-r--r--lib/internal/errors.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index 7002776300..45701c8252 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -818,6 +818,28 @@ E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed', Error);
E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected', Error);
E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe', Error);
E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks', Error);
+E('ERR_MANIFEST_ASSERT_INTEGRITY',
+ (moduleURL, realIntegrities) => {
+ let msg = `The content of "${
+ moduleURL
+ }" does not match the expected integrity.`;
+ if (realIntegrities.size) {
+ const sri = [...realIntegrities.entries()].map(([alg, dgs]) => {
+ return `${alg}-${dgs}`;
+ }).join(' ');
+ msg += ` Integrities found are: ${sri}`;
+ } else {
+ msg += ' The resource was not found in the policy.';
+ }
+ return msg;
+ }, Error);
+E('ERR_MANIFEST_INTEGRITY_MISMATCH',
+ 'Manifest resource %s has multiple entries but integrity lists do not match',
+ SyntaxError);
+E('ERR_MANIFEST_TDZ', 'Manifest initialization has not yet run', Error);
+E('ERR_MANIFEST_UNKNOWN_ONERROR',
+ 'Manifest specified unknown error behavior "%s".',
+ SyntaxError);
E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error);
E('ERR_MISSING_ARGS',
(...args) => {
@@ -889,6 +911,9 @@ E('ERR_SOCKET_BUFFER_SIZE',
E('ERR_SOCKET_CANNOT_SEND', 'Unable to send data', Error);
E('ERR_SOCKET_CLOSED', 'Socket is closed', Error);
E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running', Error);
+E('ERR_SRI_PARSE',
+ 'Subresource Integrity string %s had an unexpected at %d',
+ SyntaxError);
E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error);
E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error);
E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);