@contrast/agent 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/bin/VERSION +1 -1
  2. package/bin/linux/contrast-service +0 -0
  3. package/bin/mac/contrast-service +0 -0
  4. package/bin/windows/contrast-service.exe +0 -0
  5. package/lib/assess/membrane/source-membrane.js +4 -18
  6. package/lib/assess/policy/propagators.json +11 -21
  7. package/lib/assess/policy/rules.json +5 -0
  8. package/lib/assess/policy/signatures.json +15 -0
  9. package/lib/assess/propagators/dustjs/escape-html.js +22 -0
  10. package/lib/assess/propagators/dustjs/escape-js.js +22 -0
  11. package/lib/assess/propagators/encode-uri/encode-uri-component.js +22 -0
  12. package/lib/assess/propagators/encode-uri/encode-uri.js +22 -0
  13. package/lib/assess/propagators/index.js +0 -2
  14. package/lib/assess/propagators/joi/values.js +26 -11
  15. package/lib/assess/propagators/mustache/escape.js +22 -0
  16. package/lib/assess/propagators/path/common.js +155 -46
  17. package/lib/assess/propagators/path/join.js +5 -1
  18. package/lib/assess/propagators/path/normalize.js +1 -2
  19. package/lib/assess/propagators/path/resolve.js +11 -2
  20. package/lib/assess/propagators/template-escape.js +84 -0
  21. package/lib/assess/propagators/templates.js +2 -3
  22. package/lib/assess/sinks/dustjs-linkedin-xss.js +131 -0
  23. package/lib/core/arch-components/dynamodb.js +1 -2
  24. package/lib/core/arch-components/dynamodbv3.js +44 -0
  25. package/lib/core/arch-components/index.js +1 -0
  26. package/lib/core/arch-components/rethinkdb.js +53 -0
  27. package/lib/core/async-storage/hooks/bluebird.js +20 -0
  28. package/lib/core/config/options.js +2 -1
  29. package/lib/core/stacktrace.js +3 -4
  30. package/lib/feature-set.js +2 -1
  31. package/lib/hooks/frameworks/base.js +8 -2
  32. package/lib/hooks/frameworks/http.js +23 -16
  33. package/lib/hooks/frameworks/http2.js +73 -0
  34. package/lib/hooks/frameworks/index.js +8 -3
  35. package/lib/hooks/http.js +112 -128
  36. package/lib/hooks/patcher.js +69 -48
  37. package/lib/hooks/require.js +16 -22
  38. package/lib/instrumentation.js +0 -3
  39. package/lib/protect/rules/cmd-injection-command-backdoors/backdoor-detector.js +3 -3
  40. package/lib/protect/rules/signatures/reflected-xss/helpers/function-call.js +1 -1
  41. package/lib/protect/rules/xss/helpers/function-call.js +1 -1
  42. package/lib/util/clean-stack.js +1 -1
  43. package/lib/util/clean-string/brackets.js +3 -3
  44. package/lib/util/ip-analyzer.js +1 -1
  45. package/lib/util/some.js +27 -0
  46. package/lib/util/source-map.js +1 -1
  47. package/lib/util/xml-analyzer/external-entity-finder.js +1 -1
  48. package/package.json +14 -16
  49. package/lib/hooks/frameworks/https.js +0 -42
  50. package/node_modules/bindings/LICENSE.md +0 -22
  51. package/node_modules/bindings/README.md +0 -98
  52. package/node_modules/bindings/bindings.js +0 -221
  53. package/node_modules/bindings/package.json +0 -32
  54. package/node_modules/file-uri-to-path/.npmignore +0 -1
  55. package/node_modules/file-uri-to-path/.travis.yml +0 -30
  56. package/node_modules/file-uri-to-path/History.md +0 -21
  57. package/node_modules/file-uri-to-path/LICENSE +0 -20
  58. package/node_modules/file-uri-to-path/README.md +0 -74
  59. package/node_modules/file-uri-to-path/index.d.ts +0 -2
  60. package/node_modules/file-uri-to-path/index.js +0 -66
  61. package/node_modules/file-uri-to-path/package.json +0 -36
  62. package/node_modules/file-uri-to-path/test/test.js +0 -24
  63. package/node_modules/file-uri-to-path/test/tests.json +0 -13
  64. package/node_modules/glossy/LICENSE +0 -19
  65. package/node_modules/glossy/README.md +0 -129
  66. package/node_modules/glossy/index.js +0 -12
  67. package/node_modules/glossy/lib/glossy/parse.js +0 -520
  68. package/node_modules/glossy/lib/glossy/produce.js +0 -459
  69. package/node_modules/glossy/package.json +0 -47
  70. package/node_modules/glossy/test/decide.js +0 -7
  71. package/node_modules/glossy/test/decode_pri.js +0 -24
  72. package/node_modules/glossy/test/parse_3164.js +0 -104
  73. package/node_modules/glossy/test/parse_5424.js +0 -106
  74. package/node_modules/glossy/test/parse_5848.js +0 -40
  75. package/node_modules/glossy/test/parse_8601.js +0 -14
  76. package/node_modules/glossy/test/parse_rfc3339.js +0 -9
  77. package/node_modules/glossy/test/produce.js +0 -162
  78. package/node_modules/glossy/test/runner.js +0 -40
  79. package/node_modules/glossy/test/structure_data.js +0 -24
  80. package/node_modules/nan/CHANGELOG.md +0 -537
  81. package/node_modules/nan/LICENSE.md +0 -13
  82. package/node_modules/nan/README.md +0 -455
  83. package/node_modules/nan/doc/asyncworker.md +0 -146
  84. package/node_modules/nan/doc/buffers.md +0 -54
  85. package/node_modules/nan/doc/callback.md +0 -76
  86. package/node_modules/nan/doc/converters.md +0 -41
  87. package/node_modules/nan/doc/errors.md +0 -226
  88. package/node_modules/nan/doc/json.md +0 -62
  89. package/node_modules/nan/doc/maybe_types.md +0 -583
  90. package/node_modules/nan/doc/methods.md +0 -664
  91. package/node_modules/nan/doc/new.md +0 -147
  92. package/node_modules/nan/doc/node_misc.md +0 -123
  93. package/node_modules/nan/doc/object_wrappers.md +0 -263
  94. package/node_modules/nan/doc/persistent.md +0 -296
  95. package/node_modules/nan/doc/scopes.md +0 -73
  96. package/node_modules/nan/doc/script.md +0 -38
  97. package/node_modules/nan/doc/string_bytes.md +0 -62
  98. package/node_modules/nan/doc/v8_internals.md +0 -199
  99. package/node_modules/nan/doc/v8_misc.md +0 -85
  100. package/node_modules/nan/include_dirs.js +0 -1
  101. package/node_modules/nan/nan.h +0 -2898
  102. package/node_modules/nan/nan_callbacks.h +0 -88
  103. package/node_modules/nan/nan_callbacks_12_inl.h +0 -514
  104. package/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
  105. package/node_modules/nan/nan_converters.h +0 -72
  106. package/node_modules/nan/nan_converters_43_inl.h +0 -68
  107. package/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
  108. package/node_modules/nan/nan_define_own_property_helper.h +0 -29
  109. package/node_modules/nan/nan_implementation_12_inl.h +0 -430
  110. package/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
  111. package/node_modules/nan/nan_json.h +0 -166
  112. package/node_modules/nan/nan_maybe_43_inl.h +0 -356
  113. package/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
  114. package/node_modules/nan/nan_new.h +0 -340
  115. package/node_modules/nan/nan_object_wrap.h +0 -156
  116. package/node_modules/nan/nan_persistent_12_inl.h +0 -132
  117. package/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
  118. package/node_modules/nan/nan_private.h +0 -73
  119. package/node_modules/nan/nan_string_bytes.h +0 -305
  120. package/node_modules/nan/nan_typedarray_contents.h +0 -96
  121. package/node_modules/nan/nan_weak.h +0 -437
  122. package/node_modules/nan/package.json +0 -41
  123. package/node_modules/nan/tools/1to2.js +0 -412
  124. package/node_modules/nan/tools/README.md +0 -14
  125. package/node_modules/nan/tools/package.json +0 -19
  126. package/node_modules/unix-dgram/LICENSE +0 -13
  127. package/node_modules/unix-dgram/README.md +0 -107
  128. package/node_modules/unix-dgram/binding.gyp +0 -20
  129. package/node_modules/unix-dgram/build/Makefile +0 -324
  130. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram/src/unix_dgram.o.d +0 -58
  131. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram.node.d +0 -1
  132. package/node_modules/unix-dgram/build/Release/.deps/Release/unix_dgram.node.d +0 -1
  133. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram/src/unix_dgram.o +0 -0
  134. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram.node +0 -0
  135. package/node_modules/unix-dgram/build/Release/unix_dgram.node +0 -0
  136. package/node_modules/unix-dgram/build/binding.Makefile +0 -6
  137. package/node_modules/unix-dgram/build/config.gypi +0 -213
  138. package/node_modules/unix-dgram/build/unix_dgram.target.mk +0 -159
  139. package/node_modules/unix-dgram/lib/unix_dgram.js +0 -168
  140. package/node_modules/unix-dgram/package.json +0 -36
  141. package/node_modules/unix-dgram/src/unix_dgram.cc +0 -404
  142. package/node_modules/unix-dgram/src/win_dummy.cc +0 -7
  143. package/node_modules/unix-dgram/test/test-connect-callback.js +0 -68
  144. package/node_modules/unix-dgram/test/test-connect.js +0 -53
  145. package/node_modules/unix-dgram/test/test-dgram-unix.js +0 -58
  146. package/node_modules/unix-dgram/test/test-send-error.js +0 -26
  147. package/node_modules/winston-syslog/.eslintrc +0 -7
  148. package/node_modules/winston-syslog/.travis.yml +0 -14
  149. package/node_modules/winston-syslog/CHANGELOG.md +0 -9
  150. package/node_modules/winston-syslog/LICENSE +0 -20
  151. package/node_modules/winston-syslog/README.md +0 -135
  152. package/node_modules/winston-syslog/lib/utils.js +0 -26
  153. package/node_modules/winston-syslog/lib/winston-syslog.js +0 -385
  154. package/node_modules/winston-syslog/package.json +0 -56
  155. package/node_modules/winston-syslog/test/format-test.js +0 -122
  156. package/node_modules/winston-syslog/test/syslog-test.js +0 -95
  157. package/node_modules/winston-syslog/test/unix-connect-test.js +0 -133
@@ -1,122 +0,0 @@
1
- 'use strict';
2
-
3
- const vows = require('vows');
4
- const assert = require('assert');
5
- const winston = require('winston');
6
- const dgram = require('dgram');
7
- const parser = require('glossy').Parse;
8
-
9
- const PORT = 11229;
10
- let server;
11
- let transport;
12
-
13
- const { MESSAGE, LEVEL } = require('triple-beam');
14
-
15
- vows.describe('syslog messages').addBatch({
16
- 'opening fake syslog server': {
17
- 'topic': function () {
18
- const self = this;
19
- server = dgram.createSocket('udp4');
20
- server.on('listening', function () {
21
- self.callback();
22
- });
23
-
24
- server.bind(PORT);
25
- },
26
- 'default format': {
27
- 'topic': function () {
28
- const self = this;
29
- server.once('message', function (msg) {
30
- parser.parse(msg, function (d) {
31
- self.callback(null, d);
32
- });
33
- });
34
-
35
- transport = new winston.transports.Syslog({
36
- port: PORT
37
- });
38
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: 'ping' }, function (err) {
39
- assert.ifError(err);
40
- });
41
- },
42
- 'should have host field set to localhost': function (msg) {
43
- assert.equal(msg.host, 'localhost');
44
- transport.close();
45
- },
46
- 'setting locahost option to a different falsy value (null)': {
47
- 'topic': function () {
48
- const self = this;
49
- server.once('message', function (msg) {
50
- parser.parse(msg, function (d) {
51
- self.callback(null, d);
52
- });
53
- });
54
-
55
- transport = new winston.transports.Syslog({
56
- port: PORT,
57
- localhost: null
58
- });
59
-
60
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: 'ping2' }, function (err) {
61
- assert.ifError(err);
62
- });
63
- },
64
- 'should have host different from localhost': function (msg) {
65
- assert.notEqual(msg.host, 'localhost');
66
- transport.close();
67
- },
68
- 'setting appName option to hello': {
69
- 'topic': function () {
70
- const self = this;
71
- server.once('message', function (msg) {
72
- parser.parse(msg, function (d) {
73
- self.callback(null, d);
74
- });
75
- });
76
-
77
- transport = new winston.transports.Syslog({
78
- port: PORT,
79
- type: '5424',
80
- appName: 'hello'
81
- });
82
-
83
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: 'app name test' }, function (err) {
84
- assert.ifError(err);
85
- });
86
- },
87
- 'should have appName field set to hello': function (msg) {
88
- assert.equal(msg.appName, 'hello');
89
- transport.close();
90
- },
91
- 'setting app_name option to hello': {
92
- 'topic': function () {
93
- const self = this;
94
- server.once('message', function (msg) {
95
- parser.parse(msg, function (d) {
96
- self.callback(null, d);
97
- });
98
- });
99
-
100
- transport = new winston.transports.Syslog({
101
- port: PORT,
102
- type: '5424',
103
- app_name: 'hello'
104
- });
105
-
106
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: 'app name test' }, function (err) {
107
- assert.ifError(err);
108
- });
109
- },
110
- 'should have appName field set to hello': function (msg) {
111
- assert.equal(msg.appName, 'hello');
112
- transport.close();
113
- }
114
- }
115
- }
116
- }
117
- },
118
- 'teardown': function () {
119
- server.close();
120
- }
121
- }
122
- }).export(module);
@@ -1,95 +0,0 @@
1
- /* eslint new-cap: ["error", { "newIsCapExceptions": ["createLogger"] }] */
2
- /*
3
- * syslog-test.js: Tests for instances of the Syslog transport
4
- *
5
- * (C) 2010 Charlie Robbins
6
- * MIT LICENSE
7
- *
8
- */
9
-
10
- const vows = require('vows');
11
- const assert = require('assert');
12
- const winston = require('winston');
13
- const Syslog = require('../lib/winston-syslog').Syslog;
14
-
15
- function assertSyslog(transport) {
16
- assert.instanceOf(transport, Syslog);
17
- assert.isFunction(transport.log);
18
- assert.isFunction(transport.connect);
19
- }
20
-
21
- function closeTopicInfo() {
22
- const transport = new winston.transports.Syslog();
23
- const logger = new winston.createLogger({ transports: [transport] });
24
-
25
- logger.log('info', 'Test message to actually use socket');
26
- logger.remove(transport);
27
-
28
- return transport;
29
- }
30
-
31
- function closeTopicDebug() {
32
- const transport = new winston.transports.Syslog();
33
- const logger = new winston.createLogger({ transports: [transport] });
34
-
35
- logger.log('debug', 'Test message to actually use socket');
36
- logger.remove(transport);
37
-
38
- return transport;
39
- }
40
-
41
- const transport = new Syslog();
42
-
43
- vows.describe('winston-syslog').addBatch({
44
- 'An instance of the Syslog Transport': {
45
- 'should have the proper methods defined': function () {
46
- assertSyslog(transport);
47
- },
48
- 'teardown': function () {
49
- transport.close();
50
- },
51
- 'on close after not really writing': {
52
- topic: closeTopicDebug,
53
- on: {
54
- closed: {
55
- 'closes the socket': function (socket) {
56
- assert.isNull(socket);
57
- }
58
- }
59
- }
60
- },
61
- 'on close after really writing': {
62
- topic: closeTopicInfo,
63
- on: {
64
- closed: {
65
- 'closes the socket': function (socket) {
66
- assert.isNull(socket._handle);
67
- }
68
- }
69
- }
70
- },
71
- 'localhost option': {
72
- 'should default to localhost': function () {
73
- const transportLocal = new winston.transports.Syslog();
74
- assert.equal(transportLocal.localhost, 'localhost');
75
- transportLocal.close();
76
- },
77
- 'should accept other falsy entries as valid': function () {
78
- let transportNotLocal = new winston.transports.Syslog({ localhost: null });
79
- assert.isNull(transportNotLocal.localhost);
80
- transportNotLocal.close();
81
- transportNotLocal = new winston.transports.Syslog({ localhost: false });
82
- assert.equal(transportNotLocal.localhost, false);
83
- transportNotLocal.close();
84
- }
85
- },
86
- 'adding / removing transport to syslog': {
87
- 'should just work': function () {
88
- winston.add(new winston.transports.Syslog());
89
- winston.remove(new winston.transports.Syslog());
90
- winston.add(new winston.transports.Syslog());
91
- winston.remove(new winston.transports.Syslog());
92
- }
93
- }
94
- }
95
- }).export(module);
@@ -1,133 +0,0 @@
1
- /* eslint no-sync: "off" */
2
-
3
- const fs = require('fs');
4
- const vows = require('vows');
5
- const assert = require('assert');
6
- const unix = require('unix-dgram');
7
- const parser = require('glossy').Parse;
8
- const Syslog = require('../lib/winston-syslog').Syslog;
9
-
10
- const { MESSAGE, LEVEL } = require('triple-beam');
11
-
12
- const SOCKNAME = '/tmp/unix_dgram.sock';
13
-
14
- const transport = new Syslog({
15
- protocol: 'unix-connect',
16
- path: SOCKNAME
17
- });
18
-
19
- try {
20
- fs.unlinkSync(SOCKNAME);
21
- } catch (e) {
22
- /* swallow */
23
- }
24
-
25
- let times = 0;
26
- let server;
27
-
28
- vows.describe('unix-connect').addBatch({
29
- 'Trying to log to a non-existant log server': {
30
- 'topic': function () {
31
- const self = this;
32
- transport.once('error', function (err) {
33
- self.callback(null, err);
34
- });
35
-
36
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: `data${++times}` }, function (err) {
37
- assert(err);
38
- assert.equal(err.syscall, 'connect');
39
- assert.equal(transport.queue.length, 1);
40
- });
41
- },
42
- 'should enqueue the log message': function (err) {
43
- assert(err);
44
- assert.equal(err.syscall, 'connect');
45
- }
46
- }
47
- }).addBatch({
48
- 'Logging when log server is up': {
49
- 'topic': function () {
50
- const self = this;
51
- let n = 0;
52
- server = unix.createSocket('unix_dgram', function (buf) {
53
- parser.parse(buf, function (d) {
54
- ++n;
55
- assert(n <= 2);
56
- assert.equal(d.message, 'node[' + process.pid + ']: data' + n);
57
- assert.equal(d.severity, 'debug');
58
- if (n === 2) {
59
- self.callback();
60
- }
61
- });
62
- });
63
-
64
- server.bind(SOCKNAME);
65
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: `data${++times}` }, function (err) {
66
- assert.ifError(err);
67
- });
68
- },
69
- 'should print both the enqueed and the new msg': function (err) {
70
- assert.ifError(err);
71
- }
72
- }
73
- }).addBatch({
74
- 'Logging if server goes down again': {
75
- 'topic': function () {
76
- const self = this;
77
- transport.once('error', function (err) {
78
- self.callback(null, err);
79
- });
80
-
81
- server.close();
82
-
83
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: `data${++times}` }, function (err) {
84
- assert.ifError(err);
85
- assert.equal(transport.queue.length, 1);
86
- });
87
- },
88
- 'should enqueue the log message': function (err) {
89
- assert(err);
90
- assert.equal(err.syscall, 'send');
91
- transport.close();
92
- }
93
- }
94
- }).addBatch({
95
- 'Logging works if server comes up again': {
96
- 'topic': function () {
97
- const self = this;
98
- transport.once('error', function (err) {
99
- // Ignore error -- server hasn't come up yet, that's fine/expected
100
- assert(err);
101
- assert.equal(err.syscall, 'send');
102
- });
103
- let n = 2;
104
- try {
105
- fs.unlinkSync(SOCKNAME);
106
- } catch (e) {
107
- /* swallow */
108
- }
109
- server = unix.createSocket('unix_dgram', function (buf) {
110
- parser.parse(buf, function (d) {
111
- ++n;
112
- assert(n <= 4);
113
- assert.equal(d.message, 'node[' + process.pid + ']: data' + n);
114
- if (n === 4) {
115
- self.callback();
116
- }
117
- });
118
- });
119
-
120
- server.bind(SOCKNAME);
121
- transport.log({ [LEVEL]: 'debug', [MESSAGE]: `data${++times}` }, function (err) {
122
- assert.ifError(err);
123
- });
124
- return null;
125
- },
126
- 'should print both the enqueed and the new msg': function (err) {
127
- assert.ifError(err);
128
- server.close();
129
- return null;
130
- }
131
- }
132
-
133
- }).export(module);