@contrast/agent 4.4.1 → 4.6.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 (156) 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/hapi/route-coverage.js +3 -3
  6. package/lib/assess/membrane/index.js +2 -8
  7. package/lib/assess/membrane/source-membrane.js +3 -4
  8. package/lib/assess/models/base-event.js +2 -2
  9. package/lib/assess/models/call-context.js +0 -3
  10. package/lib/assess/policy/propagators.json +20 -0
  11. package/lib/assess/policy/signatures.json +103 -0
  12. package/lib/assess/propagators/path/common.js +165 -36
  13. package/lib/assess/propagators/path/join.js +5 -1
  14. package/lib/assess/propagators/path/normalize.js +5 -1
  15. package/lib/assess/propagators/path/resolve.js +11 -2
  16. package/lib/assess/response-scanning/autocomplete-missing.js +0 -2
  17. package/lib/assess/response-scanning/parameter-pollution.js +0 -2
  18. package/lib/core/arch-components/dynamodb.js +1 -2
  19. package/lib/core/arch-components/dynamodbv3.js +44 -0
  20. package/lib/core/arch-components/index.js +1 -0
  21. package/lib/core/async-storage/hooks/bluebird.js +20 -0
  22. package/lib/core/config/options.js +3 -2
  23. package/lib/core/express/utils.js +1 -1
  24. package/lib/core/logger/debug-logger.js +15 -17
  25. package/lib/core/stacktrace.js +3 -4
  26. package/lib/feature-set.js +2 -1
  27. package/lib/hooks/encoding.js +1 -1
  28. package/lib/hooks/frameworks/base.js +8 -2
  29. package/lib/hooks/frameworks/http.js +23 -16
  30. package/lib/hooks/frameworks/http2.js +73 -0
  31. package/lib/hooks/frameworks/index.js +8 -3
  32. package/lib/hooks/http.js +112 -128
  33. package/lib/hooks/patcher.js +10 -12
  34. package/lib/hooks/require.js +16 -22
  35. package/lib/instrumentation.js +0 -3
  36. package/lib/protect/analysis/aho-corasick.js +13 -30
  37. package/lib/protect/rules/cmd-injection-command-backdoors/backdoor-detector.js +3 -3
  38. package/lib/protect/rules/signatures/reflected-xss/helpers/function-call.js +1 -1
  39. package/lib/protect/rules/xss/helpers/function-call.js +1 -1
  40. package/lib/util/clean-stack.js +1 -1
  41. package/lib/util/clean-string/brackets.js +3 -3
  42. package/lib/util/clean-string/concatenations.js +1 -1
  43. package/lib/util/clean-string/util.js +1 -2
  44. package/lib/util/ip-analyzer.js +1 -1
  45. package/lib/util/some.js +27 -0
  46. package/lib/util/xml-analyzer/external-entity-finder.js +1 -1
  47. package/package.json +14 -15
  48. package/lib/hooks/frameworks/https.js +0 -42
  49. package/node_modules/bindings/LICENSE.md +0 -22
  50. package/node_modules/bindings/README.md +0 -98
  51. package/node_modules/bindings/bindings.js +0 -221
  52. package/node_modules/bindings/package.json +0 -32
  53. package/node_modules/file-uri-to-path/.npmignore +0 -1
  54. package/node_modules/file-uri-to-path/.travis.yml +0 -30
  55. package/node_modules/file-uri-to-path/History.md +0 -21
  56. package/node_modules/file-uri-to-path/LICENSE +0 -20
  57. package/node_modules/file-uri-to-path/README.md +0 -74
  58. package/node_modules/file-uri-to-path/index.d.ts +0 -2
  59. package/node_modules/file-uri-to-path/index.js +0 -66
  60. package/node_modules/file-uri-to-path/package.json +0 -36
  61. package/node_modules/file-uri-to-path/test/test.js +0 -24
  62. package/node_modules/file-uri-to-path/test/tests.json +0 -13
  63. package/node_modules/glossy/LICENSE +0 -19
  64. package/node_modules/glossy/README.md +0 -129
  65. package/node_modules/glossy/index.js +0 -12
  66. package/node_modules/glossy/lib/glossy/parse.js +0 -520
  67. package/node_modules/glossy/lib/glossy/produce.js +0 -459
  68. package/node_modules/glossy/package.json +0 -47
  69. package/node_modules/glossy/test/decide.js +0 -7
  70. package/node_modules/glossy/test/decode_pri.js +0 -24
  71. package/node_modules/glossy/test/parse_3164.js +0 -104
  72. package/node_modules/glossy/test/parse_5424.js +0 -106
  73. package/node_modules/glossy/test/parse_5848.js +0 -40
  74. package/node_modules/glossy/test/parse_8601.js +0 -14
  75. package/node_modules/glossy/test/parse_rfc3339.js +0 -9
  76. package/node_modules/glossy/test/produce.js +0 -162
  77. package/node_modules/glossy/test/runner.js +0 -40
  78. package/node_modules/glossy/test/structure_data.js +0 -24
  79. package/node_modules/nan/CHANGELOG.md +0 -537
  80. package/node_modules/nan/LICENSE.md +0 -13
  81. package/node_modules/nan/README.md +0 -455
  82. package/node_modules/nan/doc/asyncworker.md +0 -146
  83. package/node_modules/nan/doc/buffers.md +0 -54
  84. package/node_modules/nan/doc/callback.md +0 -76
  85. package/node_modules/nan/doc/converters.md +0 -41
  86. package/node_modules/nan/doc/errors.md +0 -226
  87. package/node_modules/nan/doc/json.md +0 -62
  88. package/node_modules/nan/doc/maybe_types.md +0 -583
  89. package/node_modules/nan/doc/methods.md +0 -664
  90. package/node_modules/nan/doc/new.md +0 -147
  91. package/node_modules/nan/doc/node_misc.md +0 -123
  92. package/node_modules/nan/doc/object_wrappers.md +0 -263
  93. package/node_modules/nan/doc/persistent.md +0 -296
  94. package/node_modules/nan/doc/scopes.md +0 -73
  95. package/node_modules/nan/doc/script.md +0 -38
  96. package/node_modules/nan/doc/string_bytes.md +0 -62
  97. package/node_modules/nan/doc/v8_internals.md +0 -199
  98. package/node_modules/nan/doc/v8_misc.md +0 -85
  99. package/node_modules/nan/include_dirs.js +0 -1
  100. package/node_modules/nan/nan.h +0 -2898
  101. package/node_modules/nan/nan_callbacks.h +0 -88
  102. package/node_modules/nan/nan_callbacks_12_inl.h +0 -514
  103. package/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
  104. package/node_modules/nan/nan_converters.h +0 -72
  105. package/node_modules/nan/nan_converters_43_inl.h +0 -68
  106. package/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
  107. package/node_modules/nan/nan_define_own_property_helper.h +0 -29
  108. package/node_modules/nan/nan_implementation_12_inl.h +0 -430
  109. package/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
  110. package/node_modules/nan/nan_json.h +0 -166
  111. package/node_modules/nan/nan_maybe_43_inl.h +0 -356
  112. package/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
  113. package/node_modules/nan/nan_new.h +0 -340
  114. package/node_modules/nan/nan_object_wrap.h +0 -156
  115. package/node_modules/nan/nan_persistent_12_inl.h +0 -132
  116. package/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
  117. package/node_modules/nan/nan_private.h +0 -73
  118. package/node_modules/nan/nan_string_bytes.h +0 -305
  119. package/node_modules/nan/nan_typedarray_contents.h +0 -96
  120. package/node_modules/nan/nan_weak.h +0 -437
  121. package/node_modules/nan/package.json +0 -41
  122. package/node_modules/nan/tools/1to2.js +0 -412
  123. package/node_modules/nan/tools/README.md +0 -14
  124. package/node_modules/nan/tools/package.json +0 -19
  125. package/node_modules/unix-dgram/LICENSE +0 -13
  126. package/node_modules/unix-dgram/README.md +0 -107
  127. package/node_modules/unix-dgram/binding.gyp +0 -20
  128. package/node_modules/unix-dgram/build/Makefile +0 -324
  129. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram/src/unix_dgram.o.d +0 -58
  130. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram.node.d +0 -1
  131. package/node_modules/unix-dgram/build/Release/.deps/Release/unix_dgram.node.d +0 -1
  132. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram/src/unix_dgram.o +0 -0
  133. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram.node +0 -0
  134. package/node_modules/unix-dgram/build/Release/unix_dgram.node +0 -0
  135. package/node_modules/unix-dgram/build/binding.Makefile +0 -6
  136. package/node_modules/unix-dgram/build/config.gypi +0 -213
  137. package/node_modules/unix-dgram/build/unix_dgram.target.mk +0 -159
  138. package/node_modules/unix-dgram/lib/unix_dgram.js +0 -168
  139. package/node_modules/unix-dgram/package.json +0 -36
  140. package/node_modules/unix-dgram/src/unix_dgram.cc +0 -404
  141. package/node_modules/unix-dgram/src/win_dummy.cc +0 -7
  142. package/node_modules/unix-dgram/test/test-connect-callback.js +0 -68
  143. package/node_modules/unix-dgram/test/test-connect.js +0 -53
  144. package/node_modules/unix-dgram/test/test-dgram-unix.js +0 -58
  145. package/node_modules/unix-dgram/test/test-send-error.js +0 -26
  146. package/node_modules/winston-syslog/.eslintrc +0 -7
  147. package/node_modules/winston-syslog/.travis.yml +0 -14
  148. package/node_modules/winston-syslog/CHANGELOG.md +0 -9
  149. package/node_modules/winston-syslog/LICENSE +0 -20
  150. package/node_modules/winston-syslog/README.md +0 -135
  151. package/node_modules/winston-syslog/lib/utils.js +0 -26
  152. package/node_modules/winston-syslog/lib/winston-syslog.js +0 -385
  153. package/node_modules/winston-syslog/package.json +0 -56
  154. package/node_modules/winston-syslog/test/format-test.js +0 -122
  155. package/node_modules/winston-syslog/test/syslog-test.js +0 -95
  156. 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);