0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

188 Commits

Author SHA1 Message Date
P.S.V.R
00bffa6c75 crypto: check for OpenSSL errors when signing
Errors might be injected into OpenSSL's error stack
without the return value of `PEM_read_bio_PrivateKey` being set to
`nullptr`. See the test of `test_bad_rsa_privkey.pem` for an
example.

PR-URL: https://github.com/nodejs/node/pull/2342
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-08-17 21:38:12 -07:00
Jeremiah Senkpiel
ceee8d2807 test: add tests for persistent repl history
PR-URL: https://github.com/nodejs/io.js/pull/2224
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-08-04 11:56:18 -07:00
Sakthipriyan Vairamani
9cd44bb2b6 util: prepend '(node) ' to deprecation messages
Changes included in this commit are

   1. Making the deprecation messages consistent. The messages will be in
      the following format

           x is deprecated. Use y instead.

      If there is no alternative for `x`, then the ` Use y instead.` part
      will not be there in the message.

   2. All the internal deprecation messages are printed with the prefix
      `(node) `, except when the `--trace-deprecation` flag is set.

Fixes: https://github.com/nodejs/io.js/issues/1883
PR-URL: https://github.com/nodejs/io.js/pull/1892
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-03 16:32:29 +02:00
Shigeki Ohtsu
3beb880716 crypto: add cert check to CNNIC Whitelist
When client connect to the server with certification issued by either
CNNIC Root CA or CNNIC EV Root CA, check hash of server
certification in the list of CNNICHashWhitelist.inc. If it's not,
CERT_REVOKED error returns.

See for details in
https://blog.mozilla.org/security/2015/04/02/distrusting-new-cnnic-certificates/

PR-URL: https://github.com/nodejs/io.js/pull/1895
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-16 23:26:29 +09:00
Rich Trott
7c79490bfb test: only refresh tmpDir for tests that need it
Expose `common.refreshTmpDir()` and only call it
for tests that use common.tmpDir or common.PIPE.

A positive side effect is the removal of a code
smell where child processes were detected by the
presence of `.send()`. Now each process can decide
for itself if it needs to refresh tmpDir.

PR-URL: https://github.com/nodejs/io.js/pull/1954
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-06-13 22:27:17 -07:00
Rich Trott
a6b8ee19b8 test: create temp dir in common.js
Move creation of temporary directories for tests
out of the Python harness and into common.js. This
allows all tests to be run reliably outside of the
Python wrapper.

PR-URL: https://github.com/nodejs/io.js/pull/1877
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-06-12 10:27:29 +10:00
Ali Ijaz Sheikh
5759722cfa src: fix module search path for preload modules
When the preload module is not a abs/relative path, we should use
the standard search mechanism of looking into the node_modules folders
outwards. The current working directory is deemed to be the 'requiring
module', i.e. parent. The search path starts from cwd outwards.

Fixes: https://github.com/nodejs/io.js/issues/1803
PR-URL: https://github.com/nodejs/io.js/pull/1812
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-30 10:36:09 -04:00
Roman Reiss
f29762f4dd test: enable linting for tests
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.

test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.

PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 21:21:27 +02:00
Fedor Indutny
550c2638c0 tls: use SSL_set_cert_cb for async SNI/OCSP
Do not enable ClientHello parser for async SNI/OCSP. Use new
OpenSSL-1.0.2's API `SSL_set_cert_cb` to pause the handshake process and
load the cert/OCSP response asynchronously. Hopefuly this will make
whole async SNI/OCSP process much faster and will eventually let us
remove the ClientHello parser itself (which is currently used only for
async session, see #1462 for the discussion of removing it).

NOTE: Ported our code to `SSL_CTX_add1_chain_cert` to use
`SSL_CTX_get0_chain_certs` in `CertCbDone`. Test provided for this
feature.

Fix: https://github.com/iojs/io.js/issues/1423
PR-URL: https://github.com/iojs/io.js/pull/1464
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
2015-05-01 16:56:55 +02:00
Shigeki Ohtsu
3a69b7689b benchmark: add rsa/aes-gcm performance test
PR-URL: https://github.com/iojs/io.js/pull/1325
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-04 12:37:26 +09:00
Ali Ijaz Sheikh
b6e22c4bd5 src: setup cluster workers before preloading
We need to process cluster workers before any preload modules is
executed. Otherwise, the child processes are not correctly disovered
as clustered workers inside the preloaded modules.

Fixes: https://github.com/iojs/io.js/issues/1269
PR-URL: https://github.com/iojs/io.js/pull/1314
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-04-04 00:53:45 +02:00
Vladimir Kurchatkin
2db758c562 iojs: introduce internal modules
Internal modules can be used to share private code between
public modules without risk to expose private APIs to the
user.

PR-URL: https://github.com/iojs/io.js/pull/848
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-03-25 22:12:18 +03:00
Ben Noordhuis
10a9c00563 test: fix timing issue in signal test
Change sequential/test-signal-unregister so it doesn't use fixed
timeouts for sending the signal and expecting the child to quit.

Fixes: https://github.com/iojs/io.js/issues/1223
PR-URL: https://github.com/iojs/io.js/pull/1227
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-03-23 00:55:34 +01:00
Ben Noordhuis
cf081a4712 vm: fix crash on fatal error in debug context
Ensure that the debug context has an Environment assigned in case
a fatal error is raised.

The fatal exception handler in node.cc is not equipped to deal with
contexts that don't have one and can't easily be taught that due to
a deficiency in the V8 API: there is no way for the embedder to tell
if the data index is in use.

Fixes: https://github.com/iojs/io.js/issues/1190
PR-URL: https://github.com/iojs/io.js/pull/1229
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-03-22 20:07:49 +01:00
Michaël Zasso
6fc5e95354 module: allow require('.')
Previously, the minimal argument to require the current directory was
require('./'). This commits allows to skip the trailing slash.

Fixes: https://github.com/iojs/io.js/issues/1178
PR-URL: https://github.com/iojs/io.js/pull/1185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-03-20 18:17:25 +01:00
Ali Ijaz Sheikh
1514b82355 src: add -r/--require flags for preloading modules
This patch adds a command line option (-r/--require) that allows one
to provide modules on the command line that will be 'required' during
node startup. This can be useful for debugging, tracing, memory leak
analysis etc. to be preloaded without explicit changes to the user
script. The option can be repeated to preload multiple modules.

PR-URL: https://github.com/iojs/io.js/pull/881
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-03-19 21:42:16 +11:00
Chris Dickinson
056ed4b0c9 src: revert -r/--require flags
This reverts commit 7bde3f1a8f.

The added test (test/parallel/test-preload.js) fails on Windows.

PR-URL: https://github.com/iojs/io.js/pull/1150
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-03-13 15:16:00 -07:00
Ali Ijaz Sheikh
7bde3f1a8f src: add -r/--require flags for preloading modules
-r/--require can be used to preload modules on node startup. The option
takes a single module name. The option can be repeated as necessary to
preload multiple modules.

This patch allows 'vendors' (such a cloud host) to inject functionality
that gets executed at application startup without requiring an explicit
require from the user's application. This can be useful to load vendor
specific application monitoring APIs transparently.

PR-URL: https://github.com/iojs/io.js/pull/881
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-03-13 13:54:34 -07:00
Bert Belder
abd3ecfbd1 win,test: fix test-stdin-from-file
The test-stdin-from-from-file test runs a subprocess that verifies stdin
can be piped from a file.

The subprocess additionally attempts to verify that the file descriptor
for stdin never gets closed. It used to do this by creating a TCP server
and asserting that the associated file descriptor is greater than two.
However this strategy doesn't work on windows, because servers don't
have an associated file descriptor. With this patch an ordinary file is
opened instead of creating a server.

PR: https://github.com/iojs/io.js/pull/1067
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
2015-03-05 15:30:52 +01:00
Brendan Ashworth
0df54303c1 test: common.js -> common
This commit changes many test styles to change all references
from require('./common.js'); to require('./common');.

The latter is much more common, with the former only being used in 50
tests. It is just a stylistic change, and it seems that `common.js` was
introduced by a rogue test and copied and pasted into the rest.

Semver: patch
PR-URL: https://github.com/iojs/io.js/pull/917
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-22 19:34:17 -08:00
isaacs
3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Fedor Indutny
0e19476595 test: split test in parallel/sequential
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/172
Fix: iojs/io.js#139
2014-12-17 20:45:02 +07:00
Evan Lucas
78a7dc2b8f module: fix regression in require ../
Fixes regression in require system that prevented loading relative
packages via main property in package.json where the file is not
index.{ext}. The regression was introduced in commit 36777d2.

PR-URL: https://github.com/iojs/io.js/pull/145
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-11 10:18:00 +01:00
Fedor Indutny
687dfc9875 crypto: separate altname extensions with ", "
In newly introduced `SafeX509ExtPrint` I forgot to insert separators
between extensions, which lead to the "DNS:...DNS:..." thing for npm.

Fix: iojs/io.js#105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/113.patch
2014-12-11 00:07:58 +07:00
Robert Kowalski
36777d2a5f module: test for directories, fix require with ..
Given my home-directory is `/Users/rocko` - and I have a file named
`npm.json` in it and also a repository with name `npm`, which is a
folder for the node-module.

When try to require the `/Users/rocko/npm/index.js` two direcotry
levels down in the npm folder (e.g. `/Users/rocko/npm/test/tap`)
with require("../../") node will load `/Users/rocko/npm/index.json`.

When I use require("../..") node will load `/Users/rocko/npm.json`
which is fixed by this commit.

PR-URL: https://github.com/iojs/io.js/pull/58
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2014-12-06 22:14:05 +01:00
Rod Vagg
28c4520bb7 test: fix test-cluster-eaccess to work on windows
properly create an EADDRINUSE condition rather than
simulating one with a plain file

PR-URL: https://github.com/node-forward/node/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2014-11-18 17:58:10 +01:00
Fedor Indutny
1bb0aeb8f2 crypto: escape DNS altname
Vulnerability credit goes to:

    Calvin Liang conradjliang@hotmail.com

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: ...private
2014-11-08 02:24:07 +03:00
Fedor Indutny
25e8adefa3 test: fix debug-signal-cluster after da update
The cluster children are hitting breakpoint at `cluster.onread` and
hanging on a Semaphore wait now. This prevents them from disconnecting
gracefully. Considering that the test is checking different thing, the
cluster children needs to be force killed from the grand parent process.

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476
2014-10-08 15:36:16 +04:00
Adam Lippai
11d57a535c tls: fix encoding in certificate-related functions
Strings are treated as UTF8 instead of one-byte strings when
names are processed and when OpenSSL's ..._print functions are used.

This commit fixes simple/test-tls-peer-certificate-encoding test.

fix #8366
2014-09-15 17:42:20 +04:00
Shigeki Ohtsu
0dfedb7127 tls, crypto: add DHE support
In case of an invalid DH parameter file, it is sliently discarded. To
use auto DH parameter in a server and DHE key length check in a
client, we need to wait for the next release of OpenSSL-1.0.2.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-29 00:36:48 +04:00
Yazhong Liu
6b09f9cd41 node: fix #7841 by overlooking the spare sourceline
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 16:09:52 +04:00
Fedor Indutny
b3ef289ffb tls: support OCSP on client and server 2014-04-18 02:21:16 +04:00
Fedor Indutny
fc26fd6b38 node: do not ever close stdio
Even if stdio streams are opened as file streams, we should not ever try
to close them. This could be accomplished by passing `autoClose: false`
in options on their creation.
2014-01-29 03:27:23 +04:00
Fedor Indutny
cc4b6e6e58 crypto: clear error in GetPeerCertificate
fix #6945
2014-01-26 03:48:36 +04:00
Sam Roberts
cb1646f44e test: fix assumption of worker exit on disconnect
Master was disconnecting its workers as soon as they both started up.
Meanwhile, the workers were trying to listen. Its a race, sometimes the
disconnect would happen between when worker gets the response message,
and acks that message with a 'listening'. This worked OK after v0.11
introduced a behaviour where disconnect would always exit the worker,
but once that backwards-incompatible behaviour is removed, the worker
lives long enough to try and respond to the master, and child_process
errors at the attempt to send from a disconnected child.
2013-12-31 11:43:44 -08:00
Alexis Campailla
f9e3364a47 test: fix create-file test fixture
This was failing if the file didn't already exist.

Fixes unit tests on Windows:

* test\simple\test-http-curl-chunk-problem.js
* test\simple\test-pipe-file-to-http.js
2013-12-10 20:09:07 +04:00
Erik Dubbelboer
bb909ad642 tls: add ECDH ciphers support
Switch test fixtures to 1024 bit keys.
2013-10-30 08:34:47 +01:00
Thom Seddon
f755ecf484 src: accept passphrase when crypto signing with private key
Previous behaviour was to drop to an openssl prompt
("Enter PEM pass phrase:") when supplying a private key with a
passphrase. This change adds a fourth, optional, paramter that
will be used as the passphrase.
To include this parameter in a backwards compatible way it was
necessary to expose the previously undocumented (and unexposed)
feature of being able to explitly setting the output encoding.
2013-10-29 14:19:47 +04:00
Jason Gerfen
7bf46ba4ce crypto: add SPKAC support
Implements new class 'Certificate' within crypto object for working
with SPKAC's (signed public key & challenge) natively.
2013-10-16 09:43:19 -07:00
isaacs
d9b4cc323f Revert "crypto: add SPKAC support"
This reverts commit 7f66e44dc1.
2013-10-15 15:58:58 -07:00
Jason Gerfen
7f66e44dc1 crypto: add SPKAC support
Implements new class 'Certificate' within crypto object for working
with SPKAC's (signed public key & challenge) natively.
2013-10-13 10:31:20 +02:00
Ben Noordhuis
81655a224a test: don't call process.exit() in debugger tests
process.exit() tends to hide bugs, both in tests and node.js.
Rewrite the tests so that the event loop exits naturally.
2013-09-06 04:40:24 +02:00
Miroslav Bajtos
c16963b977 src: break on uncaught exception
Most TryCatch blocks have SetVerbose flag on, this tells V8 to report
uncaught exceptions to debugger.

FatalException handler is called from V8 Message listener instead from
the place where TryCatch was used. Otherwise uncaught exceptions are
logged twice.

See comment in `deps/v8/include/v8.h` for explanation of SetVerbose
flag:

>  By default, exceptions that are caught by an external exception
>  handler are not reported.  Call SetVerbose with true on an
>  external exception handler to have exceptions caught by the
>  handler reported as if they were not caught.

The flag is used by `Isolate::ShouldReportException()`, which is called
by `Isolate::DoThrow()` to decide whether an exception is considered
uncaught.
2013-06-26 19:54:31 +02:00
isaacs
52adc0d963 test: Fix test-deprecation-flags
Test typos missed in util deprecation commit
2013-05-22 11:46:52 -07:00
Miroslav Bajtoš
43ec1b1c2e debugger, cluster: each worker has new debug port
Implement support for debugging cluster workers. Each worker process
is assigned a new debug port in an increasing sequence.

I.e. when master process uses port 5858, then worker 1 uses port 5859,
worker 2 uses port 5860, and so on.

Introduce new command-line parameter '--debug-port=' which sets debug_port
but does not start debugger. This option works for all node processes, it
is not specific to cluster workers.

Fixes joyent/node#5318.
2013-05-08 16:53:52 -07:00
Miroslav Bajtoš
5db936d2ae debugger: breakpoints in scripts not loaded yet
When developer calls setBreakpoint with an unknown script name,
we convert the script name into regular expression matching all
paths ending with given name (name can be a relative path too).

To create such breakpoint in V8, we use type `scriptRegEx`
instead of `scriptId` for `setbreakpoint` request.

To restore such breakpoint, we save the original script name
send by the user. We use this original name to set (restore)
breakpoint in the new child process.
2013-04-27 12:51:22 +02:00
Manav Rathi
d20576165a tls: expose SSL_CTX_set_timeout via tls.createServer
Add the `sessionTimeout` integral value to the list of options
recognized by `tls.createServer`.

This option will be useful for applications which need frequently
establish short-lived TLS connections to the same endpoint. The TLS
tickets RFC is an ideal option to reduce the socket setup overhead
for such scenarios, but the default ticket timeout value (5
minutes) is too low to be useful.
2013-03-26 01:37:49 +01:00
isaacs
ec378aaa69 test: Fix debugger repl tests
This makes the output of simple/test-debugger-repl and
simle/test-debugger-repl-utf8 mirror an actual debugger session, so it's
a bit easier to reason about.

Also, it uses the same code for both, and fixes it so that it doesn't
leave zombie processes lying around when it crashes.

Run 1000 times without any failures or zombies.
2013-02-26 16:49:17 -08:00
isaacs
f3f4e290e0 test: 2 resume() calls needed to flush streams 2012-12-19 10:55:23 -08:00
isaacs
acfb0ef908 test: fixture for streams2 testing 2012-12-13 17:00:28 -08:00