Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge e56189e as of 2018-01-30
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
chakrabot committed Feb 9, 2018
2 parents 086bab5 + e56189e commit 4a4520e
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 33 deletions.
9 changes: 9 additions & 0 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,14 @@ received _authentication tag_. If no tag is provided, or if the cipher text
has been tampered with, [`decipher.final()`][] will throw, indicating that the
cipher text should be discarded due to failed authentication.

Note that this Node.js version does not verify the length of GCM authentication
tags. Such a check *must* be implemented by applications and is crucial to the
authenticity of the encrypted data, otherwise, an attacker can use an
arbitrarily short authentication tag to increase the chances of successfully
passing authentication (up to 0.39%). It is highly recommended to associate one
of the values 16, 15, 14, 13, 12, 8 or 4 bytes with each key, and to only permit
authentication tags of that length, see [NIST SP 800-38D][].

The `decipher.setAuthTag()` method must be called before
[`decipher.final()`][].

Expand Down Expand Up @@ -2424,6 +2432,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
[HTML5's `keygen` element]: https://www.w3.org/TR/html5/forms.html#the-keygen-element
[NIST SP 800-131A]: http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf
[NIST SP 800-132]: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
[NIST SP 800-38D]: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
[Nonce-Disrespecting Adversaries]: https://github.com/nonce-disrespect/nonce-disrespect
[OpenSSL's SPKAC implementation]: https://www.openssl.org/docs/man1.0.2/apps/spkac.html
[RFC 2412]: https://www.rfc-editor.org/rfc/rfc2412.txt
Expand Down
4 changes: 2 additions & 2 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ node \- Server-side JavaScript runtime
.RI [ script.js \ |
.B -e
.RI \&" script \&"
.R |
.RI |
.B -
.R ]
.RI ]
.B [--]
.RI [ arguments ]
.br
Expand Down
4 changes: 2 additions & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
if (((state.pipesCount === 1 && state.pipes === dest) ||
(state.pipesCount > 1 && state.pipes.indexOf(dest) !== -1)) &&
!cleanedUp) {
debug('false write response, pause', src._readableState.awaitDrain);
src._readableState.awaitDrain++;
debug('false write response, pause', state.awaitDrain);
state.awaitDrain++;
increasedAwaitDrain = true;
}
src.pause();
Expand Down
2 changes: 1 addition & 1 deletion lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Writable.prototype.write = function(chunk, encoding, cb) {
if (typeof cb !== 'function')
cb = nop;

if (state.ended)
if (state.ending)
writeAfterEnd(this, cb);
else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
Expand Down
24 changes: 24 additions & 0 deletions test/parallel/test-stream-writable-write-writev-finish.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,27 @@ const stream = require('stream');
};
rs.pipe(ws);
}

{
const w = new stream.Writable();
w._write = (chunk, encoding, cb) => {
process.nextTick(cb);
};
w.on('error', common.mustCall());
w.on('prefinish', () => {
w.write("shouldn't write in prefinish listener");
});
w.end();
}

{
const w = new stream.Writable();
w._write = (chunk, encoding, cb) => {
process.nextTick(cb);
};
w.on('error', common.mustCall());
w.on('finish', () => {
w.write("should't write in finish listener");
});
w.end();
}
55 changes: 54 additions & 1 deletion test/parallel/test-vm-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const vm = require('vm');

Expand Down Expand Up @@ -69,3 +69,56 @@ assert.strictEqual(result, 'undefined');
const sandbox3 = {};
const context2 = vm.createContext(sandbox3);
assert.strictEqual(sandbox3, context2);

// Test 6: invalid arguments
common.expectsError(() => {
vm.createContext({}, null);
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "options" argument must be of type object. Received type null'
});

common.expectsError(() => {
vm.createContext({}, 'string');
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "options" argument must be of type object. Received type string'
});

common.expectsError(() => {
vm.createContext({}, { name: null });
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "options.name" property must be of type string. ' +
'Received type null'
});

common.expectsError(() => {
vm.createContext({}, { origin: null });
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "options.origin" property must be of type string. ' +
'Received type null'
});

common.expectsError(() => {
vm.runInNewContext('', {}, { contextName: null });
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "options.contextName" property must be of type string. ' +
'Received type null'
});

common.expectsError(() => {
vm.runInNewContext('', {}, { contextOrigin: null });
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "options.contextOrigin" property must be of type string. ' +
'Received type null'
});
61 changes: 34 additions & 27 deletions tools/icu/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Notes about the icu directory.
# Notes about the `tools/icu` subdirectory

This directory contains tools, data, and information about the [http://icu-project.org](ICU) (International Components for Unicode) integration. ICU is used to provide internationalization functionality.

- `patches/` are one-off patches, actually entire source file replacements, organized by ICU version number.
- `icu_small.json` controls the "small" (English only) ICU. It is input to `icutrim.py`
- `icu-generic.gyp` is the build file used for most ICU builds within ICU. <!-- have fun -->
- `icu-system.gyp` is an alternate build file used when `--with-intl=system-icu` is invoked. It builds against the `pkg-config` located ICU.
- `iculslocs.cc` is source for the `iculslocs` utility, invoked by `icutrim.py` as part of repackaging. Not used separately. See source for more details.
- `no-op.cc` — empty function to convince gyp to use a C++ compiler.
- `README.md` — you are here
- `shrink-icu-src.py` — this is used during upgrade (see guide below)

## How to upgrade ICU

Expand All @@ -12,13 +23,13 @@
make
```

(The equivalent `vcbuild.bat` commands should work also. Note that we use the `.tgz` and not the `.zip` here,
that is because of line endings.)
> _Note_ in theory, the equivalent `vcbuild.bat` commands should work also,
> but the commands below are makefile-centric.
- (note- may need to make changes in `icu-generic.gyp` or `tools/icu/patches` for
version specific stuff)
- If there are ICU version-specific changes needed, you may need to make changes in `icu-generic.gyp` or add patch files to `tools/icu/patches`.
- Specifically, look for the lists in `sources!` in the `icu-generic.gyp` for files to exclude.

- Verify the node build works
- Verify the node build works:

```shell
make test-ci
Expand All @@ -27,13 +38,12 @@ make test-ci
Also running

<!-- eslint-disable strict -->

```js
new Intl.DateTimeFormat('es', {month: 'long'}).format(new Date(9E8));
```

…Should return `January` not `enero`.
(TODO here: improve [testing](https://github.com/nodejs/Intl/issues/16))


- Now, copy `deps/icu` over to `deps/icu-small`

Expand All @@ -43,25 +53,25 @@ python tools/icu/shrink-icu-src.py

- Now, do a clean rebuild of node to test:

(TODO: fix this when these options become default)

```shell
./configure --with-intl=small-icu --with-icu-source=deps/icu-small
make -k distclean
./configure
make
```

- Test this newly default-generated Node.js

<!-- eslint-disable strict -->

```js
process.versions.icu;
new Intl.DateTimeFormat('es', {month: 'long'}).format(new Date(9E8));
```

(should return your updated ICU version number, and also `January` again.)
(This should print your updated ICU version number, and also `January` again.)

- You are ready to check in the updated `deps/small-icu`.
This is a big commit, so make this a separate commit from other changes.
You are ready to check in the updated `deps/small-icu`. This is a big commit,
so make this a separate commit from the smaller changes.

- Now, rebuild the Node license.

Expand All @@ -85,30 +95,27 @@ make test-ci

- commit the change to `configure` along with the updated `LICENSE` file.

- Note: To simplify review, I often will “pre-land” this patch, meaning that I run the patch through `curl -L https://github.com/nodejs/node/pull/xxx.patch | git am -3 --whitespace=fix` per the collaborator’s guide… and then push that patched branch into my PR's branch. This reduces the whitespace changes that show up in the PR, since the final land will eliminate those anyway.

-----

## Notes about these tools
## Postscript about the tools

The files in this directory were written for the node.js effort. It's
the intent of their author (Steven R. Loomis / srl295) to merge them
upstream into ICU, pending much discussion within the ICU-PMC.
The files in this directory were written for the node.js effort.
It was the intent of their author (Steven R. Loomis / srl295) to
merge them upstream into ICU, pending much discussion within the
ICU-TC.

`icu_small.json` is somewhat node-specific as it specifies a "small ICU"
configuration file for the `icutrim.py` script. `icutrim.py` and
`iculslocs.cpp` may themselves be superseded by components built into
ICU in the future.

The following tickets were opened during this work, and their
resolution may inform the reader as to the current state of icu-trim
upstream:
ICU in the future. As of this writing, however, the tools are separate
entities within Node, although theyare being scrutinized by interested
members of the ICU-TC. The “upstream” ICU bugs are given below.

* [#10919](http://bugs.icu-project.org/trac/ticket/10919)
(experimental branch - may copy any source patches here)
* [#10922](http://bugs.icu-project.org/trac/ticket/10922)
(data packaging improvements)
* [#10923](http://bugs.icu-project.org/trac/ticket/10923)
(rewrite data building in python)

When/if components (not including the `.json` file) are merged into
ICU, this code and `configure` will be updated to detect and use those
variants rather than the ones in this directory.

0 comments on commit 4a4520e

Please sign in to comment.