@contrast/agent 4.5.1 → 4.7.1
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.
- package/bin/VERSION +1 -1
- package/bin/linux/contrast-service +0 -0
- package/bin/mac/contrast-service +0 -0
- package/bin/windows/contrast-service.exe +0 -0
- package/lib/assess/membrane/deserialization-membrane.js +4 -5
- package/lib/assess/membrane/source-membrane.js +16 -33
- package/lib/assess/models/call-context.js +1 -1
- package/lib/assess/policy/propagators.json +19 -21
- package/lib/assess/policy/rules.json +7 -2
- package/lib/assess/policy/signatures.json +42 -0
- package/lib/assess/policy/util.js +2 -1
- package/lib/assess/propagators/JSON/parse.js +1 -1
- package/lib/assess/propagators/JSON/stringify.js +3 -3
- package/lib/assess/propagators/array-prototype-join.js +7 -8
- package/lib/assess/propagators/common.js +7 -5
- package/lib/assess/propagators/dustjs/escape-html.js +22 -0
- package/lib/assess/propagators/dustjs/escape-js.js +22 -0
- package/lib/assess/propagators/encode-uri/encode-uri-component.js +22 -0
- package/lib/assess/propagators/encode-uri/encode-uri.js +22 -0
- package/lib/assess/propagators/handlebars-escape-expresssion.js +1 -1
- package/lib/assess/propagators/index.js +0 -2
- package/lib/assess/propagators/joi/boolean.js +1 -1
- package/lib/assess/propagators/joi/expression.js +1 -1
- package/lib/assess/propagators/joi/number.js +1 -1
- package/lib/assess/propagators/joi/string-base.js +1 -1
- package/lib/assess/propagators/joi/string-schema.js +12 -13
- package/lib/assess/propagators/joi/values.js +37 -22
- package/lib/assess/propagators/manager.js +12 -10
- package/lib/assess/propagators/mongoose/helpers.js +20 -0
- package/lib/assess/propagators/mongoose/index.js +18 -0
- package/lib/assess/propagators/mongoose/map.js +74 -0
- package/lib/assess/propagators/mongoose/string.js +104 -0
- package/lib/assess/propagators/mustache/escape.js +22 -0
- package/lib/assess/propagators/number.js +54 -0
- package/lib/assess/propagators/object.js +6 -7
- package/lib/assess/propagators/path/basename.js +14 -13
- package/lib/assess/propagators/path/common.js +156 -47
- package/lib/assess/propagators/path/dirname.js +14 -13
- package/lib/assess/propagators/path/extname.js +14 -13
- package/lib/assess/propagators/path/join.js +5 -1
- package/lib/assess/propagators/path/normalize.js +1 -2
- package/lib/assess/propagators/path/parse.js +1 -1
- package/lib/assess/propagators/path/relative.js +7 -5
- package/lib/assess/propagators/path/resolve.js +11 -2
- package/lib/assess/propagators/querystring/escape.js +20 -18
- package/lib/assess/propagators/querystring/parse.js +7 -5
- package/lib/assess/propagators/querystring/stringify.js +25 -24
- package/lib/assess/propagators/querystring/unescape.js +20 -18
- package/lib/assess/propagators/sequelize/sql-string-escape.js +1 -1
- package/lib/assess/propagators/sequelize/sql-string-format-named-parameters.js +1 -1
- package/lib/assess/propagators/sequelize/sql-string-format.js +3 -3
- package/lib/assess/propagators/sequelize/utils.js +2 -2
- package/lib/assess/propagators/string-prototype-replace.js +30 -28
- package/lib/assess/propagators/string-prototype-split.js +36 -36
- package/lib/assess/propagators/string-prototype-trim.js +15 -17
- package/lib/assess/propagators/string.js +12 -16
- package/lib/assess/propagators/template-escape.js +87 -0
- package/lib/assess/propagators/templates.js +10 -11
- package/lib/assess/propagators/url/url-prototype-parse.js +5 -6
- package/lib/assess/propagators/url/url-url.js +51 -43
- package/lib/assess/propagators/util/format.js +1 -1
- package/lib/assess/propagators/v8/init-hooks.js +3 -3
- package/lib/assess/propagators/validator/init-hooks.js +22 -22
- package/lib/assess/sinks/common.js +10 -5
- package/lib/assess/sinks/dustjs-linkedin-xss.js +131 -0
- package/lib/assess/sinks/libxmljs-xxe.js +1 -1
- package/lib/assess/sinks/mongodb.js +2 -1
- package/lib/assess/sinks/ssrf-url.js +1 -1
- package/lib/constants.js +4 -1
- package/lib/core/arch-components/dynamodb.js +1 -2
- package/lib/core/arch-components/dynamodbv3.js +44 -0
- package/lib/core/arch-components/index.js +1 -0
- package/lib/core/arch-components/rethinkdb.js +53 -0
- package/lib/core/config/options.js +3 -2
- package/lib/core/rewrite/injections.js +8 -0
- package/lib/core/stacktrace.js +2 -1
- package/lib/feature-set.js +1 -1
- package/lib/hooks/frameworks/base.js +8 -2
- package/lib/hooks/frameworks/http.js +23 -16
- package/lib/hooks/frameworks/http2.js +73 -0
- package/lib/hooks/frameworks/index.js +8 -3
- package/lib/hooks/http.js +112 -128
- package/lib/hooks/object-to-primitive.js +6 -7
- package/lib/hooks/patcher.js +75 -44
- package/lib/hooks/require.js +16 -22
- package/lib/instrumentation.js +0 -3
- package/lib/protect/rules/nosqli/nosql-injection-rule.js +228 -0
- package/lib/protect/rules/rule-factory.js +2 -2
- package/lib/protect/service.js +23 -11
- package/lib/protect/sinks/mongodb.js +56 -55
- package/lib/reporter/translations/to-protobuf/dtm/index.js +1 -1
- package/lib/reporter/translations/to-protobuf/dtm/ip-denylist-details.js +1 -1
- package/lib/reporter/translations/to-protobuf/dtm/rasp-rule-sample.js +1 -1
- package/lib/reporter/translations/to-protobuf/settings/defend-features.js +8 -6
- package/lib/reporter/translations/to-protobuf/settings/exclusions.js +5 -4
- package/lib/tracker.js +13 -65
- package/lib/util/some.js +27 -0
- package/lib/util/source-map.js +1 -1
- package/package.json +15 -16
- package/lib/hooks/frameworks/https.js +0 -42
- package/lib/protect/rules/nosqli/no-sql-injection-rule.js +0 -109
- package/node_modules/bindings/LICENSE.md +0 -22
- package/node_modules/bindings/README.md +0 -98
- package/node_modules/bindings/bindings.js +0 -221
- package/node_modules/bindings/package.json +0 -32
- package/node_modules/file-uri-to-path/.npmignore +0 -1
- package/node_modules/file-uri-to-path/.travis.yml +0 -30
- package/node_modules/file-uri-to-path/History.md +0 -21
- package/node_modules/file-uri-to-path/LICENSE +0 -20
- package/node_modules/file-uri-to-path/README.md +0 -74
- package/node_modules/file-uri-to-path/index.d.ts +0 -2
- package/node_modules/file-uri-to-path/index.js +0 -66
- package/node_modules/file-uri-to-path/package.json +0 -36
- package/node_modules/file-uri-to-path/test/test.js +0 -24
- package/node_modules/file-uri-to-path/test/tests.json +0 -13
- package/node_modules/glossy/LICENSE +0 -19
- package/node_modules/glossy/README.md +0 -129
- package/node_modules/glossy/index.js +0 -12
- package/node_modules/glossy/lib/glossy/parse.js +0 -520
- package/node_modules/glossy/lib/glossy/produce.js +0 -459
- package/node_modules/glossy/package.json +0 -47
- package/node_modules/glossy/test/decide.js +0 -7
- package/node_modules/glossy/test/decode_pri.js +0 -24
- package/node_modules/glossy/test/parse_3164.js +0 -104
- package/node_modules/glossy/test/parse_5424.js +0 -106
- package/node_modules/glossy/test/parse_5848.js +0 -40
- package/node_modules/glossy/test/parse_8601.js +0 -14
- package/node_modules/glossy/test/parse_rfc3339.js +0 -9
- package/node_modules/glossy/test/produce.js +0 -162
- package/node_modules/glossy/test/runner.js +0 -40
- package/node_modules/glossy/test/structure_data.js +0 -24
- package/node_modules/nan/CHANGELOG.md +0 -537
- package/node_modules/nan/LICENSE.md +0 -13
- package/node_modules/nan/README.md +0 -455
- package/node_modules/nan/doc/asyncworker.md +0 -146
- package/node_modules/nan/doc/buffers.md +0 -54
- package/node_modules/nan/doc/callback.md +0 -76
- package/node_modules/nan/doc/converters.md +0 -41
- package/node_modules/nan/doc/errors.md +0 -226
- package/node_modules/nan/doc/json.md +0 -62
- package/node_modules/nan/doc/maybe_types.md +0 -583
- package/node_modules/nan/doc/methods.md +0 -664
- package/node_modules/nan/doc/new.md +0 -147
- package/node_modules/nan/doc/node_misc.md +0 -123
- package/node_modules/nan/doc/object_wrappers.md +0 -263
- package/node_modules/nan/doc/persistent.md +0 -296
- package/node_modules/nan/doc/scopes.md +0 -73
- package/node_modules/nan/doc/script.md +0 -38
- package/node_modules/nan/doc/string_bytes.md +0 -62
- package/node_modules/nan/doc/v8_internals.md +0 -199
- package/node_modules/nan/doc/v8_misc.md +0 -85
- package/node_modules/nan/include_dirs.js +0 -1
- package/node_modules/nan/nan.h +0 -2898
- package/node_modules/nan/nan_callbacks.h +0 -88
- package/node_modules/nan/nan_callbacks_12_inl.h +0 -514
- package/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
- package/node_modules/nan/nan_converters.h +0 -72
- package/node_modules/nan/nan_converters_43_inl.h +0 -68
- package/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
- package/node_modules/nan/nan_define_own_property_helper.h +0 -29
- package/node_modules/nan/nan_implementation_12_inl.h +0 -430
- package/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
- package/node_modules/nan/nan_json.h +0 -166
- package/node_modules/nan/nan_maybe_43_inl.h +0 -356
- package/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
- package/node_modules/nan/nan_new.h +0 -340
- package/node_modules/nan/nan_object_wrap.h +0 -156
- package/node_modules/nan/nan_persistent_12_inl.h +0 -132
- package/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
- package/node_modules/nan/nan_private.h +0 -73
- package/node_modules/nan/nan_string_bytes.h +0 -305
- package/node_modules/nan/nan_typedarray_contents.h +0 -96
- package/node_modules/nan/nan_weak.h +0 -437
- package/node_modules/nan/package.json +0 -41
- package/node_modules/nan/tools/1to2.js +0 -412
- package/node_modules/nan/tools/README.md +0 -14
- package/node_modules/nan/tools/package.json +0 -19
- package/node_modules/unix-dgram/LICENSE +0 -13
- package/node_modules/unix-dgram/README.md +0 -107
- package/node_modules/unix-dgram/binding.gyp +0 -20
- package/node_modules/unix-dgram/build/Makefile +0 -324
- package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram/src/unix_dgram.o.d +0 -58
- package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram.node.d +0 -1
- package/node_modules/unix-dgram/build/Release/.deps/Release/unix_dgram.node.d +0 -1
- package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram/src/unix_dgram.o +0 -0
- package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram.node +0 -0
- package/node_modules/unix-dgram/build/Release/unix_dgram.node +0 -0
- package/node_modules/unix-dgram/build/binding.Makefile +0 -6
- package/node_modules/unix-dgram/build/config.gypi +0 -213
- package/node_modules/unix-dgram/build/unix_dgram.target.mk +0 -159
- package/node_modules/unix-dgram/lib/unix_dgram.js +0 -168
- package/node_modules/unix-dgram/package.json +0 -36
- package/node_modules/unix-dgram/src/unix_dgram.cc +0 -404
- package/node_modules/unix-dgram/src/win_dummy.cc +0 -7
- package/node_modules/unix-dgram/test/test-connect-callback.js +0 -68
- package/node_modules/unix-dgram/test/test-connect.js +0 -53
- package/node_modules/unix-dgram/test/test-dgram-unix.js +0 -58
- package/node_modules/unix-dgram/test/test-send-error.js +0 -26
- package/node_modules/winston-syslog/.eslintrc +0 -7
- package/node_modules/winston-syslog/.travis.yml +0 -14
- package/node_modules/winston-syslog/CHANGELOG.md +0 -9
- package/node_modules/winston-syslog/LICENSE +0 -20
- package/node_modules/winston-syslog/README.md +0 -135
- package/node_modules/winston-syslog/lib/utils.js +0 -26
- package/node_modules/winston-syslog/lib/winston-syslog.js +0 -385
- package/node_modules/winston-syslog/package.json +0 -56
- package/node_modules/winston-syslog/test/format-test.js +0 -122
- package/node_modules/winston-syslog/test/syslog-test.js +0 -95
- package/node_modules/winston-syslog/test/unix-connect-test.js +0 -133
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
var syslogParser = require('../lib/glossy/parse.js'),
|
|
2
|
-
assert = require('assert');
|
|
3
|
-
|
|
4
|
-
assert.ok(syslogParser, 'parser loaded');
|
|
5
|
-
var withPrecisionTime = "<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - %% It's time to make the do-nuts.";
|
|
6
|
-
syslogParser.parse(withPrecisionTime, function(parsedMessage){
|
|
7
|
-
var expectedData = {
|
|
8
|
-
originalMessage: withPrecisionTime,
|
|
9
|
-
prival: 165,
|
|
10
|
-
facilityID: 20,
|
|
11
|
-
severityID: 5,
|
|
12
|
-
facility: 'local4',
|
|
13
|
-
severity: 'notice',
|
|
14
|
-
type: 'RFC5424',
|
|
15
|
-
host: '192.0.2.1',
|
|
16
|
-
appName: 'myproc',
|
|
17
|
-
pid: '8710',
|
|
18
|
-
msgID: null,
|
|
19
|
-
message: "%% It's time to make the do-nuts." };
|
|
20
|
-
|
|
21
|
-
delete parsedMessage.time;
|
|
22
|
-
assert.deepEqual(parsedMessage, expectedData);
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// FIXME 3 minute offset from UTC?!
|
|
27
|
-
var with8601 = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
|
|
28
|
-
syslogParser.parse(with8601, function(parsedMessage){
|
|
29
|
-
var expectedData = {
|
|
30
|
-
originalMessage: with8601,
|
|
31
|
-
prival: 34,
|
|
32
|
-
facilityID: 4,
|
|
33
|
-
severityID: 2,
|
|
34
|
-
facility: 'auth',
|
|
35
|
-
severity: 'crit',
|
|
36
|
-
type: 'RFC5424',
|
|
37
|
-
time: new Date('2003-10-11T22:14:15.003Z'),
|
|
38
|
-
host: 'mymachine.example.com',
|
|
39
|
-
appName: 'su',
|
|
40
|
-
pid: null,
|
|
41
|
-
msgID: 'ID47',
|
|
42
|
-
message: "BOM'su root' failed for lonvick on /dev/pts/8" };
|
|
43
|
-
|
|
44
|
-
assert.deepEqual(parsedMessage, expectedData);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// FIXME 3 minute offset from UTC?!
|
|
48
|
-
var withSD = '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] BOMAn application event log entry...';
|
|
49
|
-
syslogParser.parse(withSD, function(parsedMessage){
|
|
50
|
-
var expectedData = {
|
|
51
|
-
originalMessage: withSD,
|
|
52
|
-
prival: 165,
|
|
53
|
-
facilityID: 20,
|
|
54
|
-
severityID: 5,
|
|
55
|
-
facility: 'local4',
|
|
56
|
-
severity: 'notice',
|
|
57
|
-
type: 'RFC5424',
|
|
58
|
-
time: new Date('2003-10-11T22:14:15.003Z'),
|
|
59
|
-
host: 'mymachine.example.com',
|
|
60
|
-
appName: 'evntslog',
|
|
61
|
-
pid: null,
|
|
62
|
-
msgID: 'ID47',
|
|
63
|
-
structuredData: {
|
|
64
|
-
'exampleSDID@32473': {
|
|
65
|
-
iut: '3',
|
|
66
|
-
eventSource: 'Application',
|
|
67
|
-
eventID: '1011'
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
message: 'BOMAn application event log entry...' };
|
|
71
|
-
|
|
72
|
-
assert.deepEqual(parsedMessage, expectedData);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// FIXME 3 minute offset from UTC?!
|
|
76
|
-
var withDoubleSD = '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"]';
|
|
77
|
-
syslogParser.parse(withDoubleSD, function(parsedMessage){
|
|
78
|
-
var expectedStructuredData = {
|
|
79
|
-
'exampleSDID@32473': {
|
|
80
|
-
iut: '3',
|
|
81
|
-
eventSource: 'Application',
|
|
82
|
-
eventID: '1011'
|
|
83
|
-
},
|
|
84
|
-
'examplePriority@32473': {
|
|
85
|
-
'class': 'high'
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
var expectedData = {
|
|
90
|
-
originalMessage: withDoubleSD,
|
|
91
|
-
prival: 165,
|
|
92
|
-
facilityID: 20,
|
|
93
|
-
severityID: 5,
|
|
94
|
-
facility: 'local4',
|
|
95
|
-
severity: 'notice',
|
|
96
|
-
type: 'RFC5424',
|
|
97
|
-
time: new Date('2003-10-11T22:14:15.003Z'),
|
|
98
|
-
host: 'mymachine.example.com',
|
|
99
|
-
appName: 'evntslog',
|
|
100
|
-
pid: null,
|
|
101
|
-
msgID: 'ID47',
|
|
102
|
-
structuredData: expectedStructuredData, //FIXME Both sets should be there
|
|
103
|
-
message: '' };
|
|
104
|
-
assert.deepEqual(parsedMessage, expectedData);
|
|
105
|
-
});
|
|
106
|
-
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var syslogParser = require('../lib/glossy/parse.js'),
|
|
2
|
-
assert = require('assert');
|
|
3
|
-
|
|
4
|
-
assert.ok(syslogParser, 'parser loaded');
|
|
5
|
-
|
|
6
|
-
var fullySigned = '<110>1 2009-05-03T14:00:39.519307+02:00 host.example.org syslogd 2138 - [ssign-cert VER="0111" RSID="1" SG="0" SPRI="0" TPBL="587" INDEX="1" FLEN="587" FRAG="2009-05-03T14:00:39.519005+02:00 K BACsLMZ NCV2NUAwe4RAeAnSQuvv2KS51SnHFAaWJNU2XVDYvW1LjmJgg4vKvQPo3HEOD+2hEkt1zcXADe03u5pmHoWy5FGiyCbglYxJkUJJrQqlTSS6vID9yhsmEnh07w3pOsxmb4qYo0uWQrAAenBweVMlBgV3ZA5IMA8xq8l+i8wCgkWJjCjfLar7s+0X3HVrRroyARv8EAIYoxofh9m N8n821BTTuQnz5hp40d6Z3UudKePu2di5Mx3GFelwnV0Qh5mSs0YkuHJg0mcXyUAoeYry5X6482fUxbm+gOHVmYSDtBmZEB8PTEt8Os8aedWgKEt/E4dT+Hmod4omECLteLXxtScTMgDXyC+bSBMjRRCaeWhHrYYdYBACCWMdTc12hRLJTn8LX99kv1I7qwgieyna8GCJv/rEgC ssS9E1qARM+h19KovIUOhl4VzBw3rK7v8Dlw/CJyYDd5kwSvCwjhO21LiReeS90VPYuZFRC1B82Sub152zOqIcAWsgd4myCCiZbWBsuJ8P0gtarFIpleNacCc6OV3i2Rg==" SIGN="AKAQEUiQptgpd0lKcXbuggGXH/dCdQCgdysrTBLUlbeGAQ4vwrnLOqSL7+c="]';
|
|
7
|
-
|
|
8
|
-
var fullySignedSD = syslogParser.parseStructure(fullySigned);
|
|
9
|
-
assert.deepEqual(fullySignedSD, {
|
|
10
|
-
'ssign-cert': {
|
|
11
|
-
VER: '0111',
|
|
12
|
-
RSID: '1',
|
|
13
|
-
SG: '0',
|
|
14
|
-
SPRI: '0',
|
|
15
|
-
TPBL: '587',
|
|
16
|
-
INDEX: '1',
|
|
17
|
-
FLEN: '587',
|
|
18
|
-
FRAG: '2009-05-03T14:00:39.519005+02:00 K BACsLMZ NCV2NUAwe4RAeAnSQuvv2KS51SnHFAaWJNU2XVDYvW1LjmJgg4vKvQPo3HEOD+2hEkt1zcXADe03u5pmHoWy5FGiyCbglYxJkUJJrQqlTSS6vID9yhsmEnh07w3pOsxmb4qYo0uWQrAAenBweVMlBgV3ZA5IMA8xq8l+i8wCgkWJjCjfLar7s+0X3HVrRroyARv8EAIYoxofh9m N8n821BTTuQnz5hp40d6Z3UudKePu2di5Mx3GFelwnV0Qh5mSs0YkuHJg0mcXyUAoeYry5X6482fUxbm+gOHVmYSDtBmZEB8PTEt8Os8aedWgKEt/E4dT+Hmod4omECLteLXxtScTMgDXyC+bSBMjRRCaeWhHrYYdYBACCWMdTc12hRLJTn8LX99kv1I7qwgieyna8GCJv/rEgC ssS9E1qARM+h19KovIUOhl4VzBw3rK7v8Dlw/CJyYDd5kwSvCwjhO21LiReeS90VPYuZFRC1B82Sub152zOqIcAWsgd4myCCiZbWBsuJ8P0gtarFIpleNacCc6OV3i2Rg==',
|
|
19
|
-
SIGN: 'AKAQEUiQptgpd0lKcXbuggGXH/dCdQCgdysrTBLUlbeGAQ4vwrnLOqSL7+c='
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
assert.deepEqual(syslogParser.parseSignedCertificate(fullySignedSD['ssign-cert']), {
|
|
24
|
-
version: '01',
|
|
25
|
-
hashAlgorithm: 1,
|
|
26
|
-
hashAlgoString: 'SHA1',
|
|
27
|
-
sigScheme: 1,
|
|
28
|
-
rebootSessionID: 1,
|
|
29
|
-
signatureGroup: 0,
|
|
30
|
-
signaturePriority: 0,
|
|
31
|
-
totalPayloadLength: 587,
|
|
32
|
-
payloadIndex: 1,
|
|
33
|
-
fragmentLength: 587,
|
|
34
|
-
payloadTimestamp: new Date('2009-05-03T14:00:39.519005+02:00'),
|
|
35
|
-
payloadType: 'K',
|
|
36
|
-
payloadName: 'Public Key',
|
|
37
|
-
keyBlob: new Buffer(fullySignedSD['ssign-cert']['FRAG'].split(/\s/)[2], encoding='base64'),
|
|
38
|
-
thisSignature: new Buffer(fullySignedSD['ssign-cert']['SIGN'], encoding='base64')
|
|
39
|
-
});
|
|
40
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var syslogParser = require('../lib/glossy/parse.js'),
|
|
2
|
-
assert = require('assert');
|
|
3
|
-
|
|
4
|
-
assert.ok(syslogParser, 'parser loaded');
|
|
5
|
-
|
|
6
|
-
assert.deepEqual(
|
|
7
|
-
syslogParser.parse8601('2011-10-10T14:48:00'),
|
|
8
|
-
new Date(Date.parse('2011-10-10T14:48:00'))
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
assert.equal(
|
|
12
|
-
syslogParser.parse8601('foo'),
|
|
13
|
-
undefined
|
|
14
|
-
);
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
var assert = require('assert');
|
|
2
|
-
var producer = require('../lib/glossy/produce.js');
|
|
3
|
-
|
|
4
|
-
assert.ok(producer, 'producer loaded');
|
|
5
|
-
|
|
6
|
-
var syslogProducer = new producer();
|
|
7
|
-
assert.ok(syslogProducer, 'new SyslogProducer object created');
|
|
8
|
-
assert.equal(syslogProducer.type, 'RFC5424', 'Syslog Producer set correctly');
|
|
9
|
-
|
|
10
|
-
var BSDProducer = new producer({ type: 'BSD'});
|
|
11
|
-
assert.ok(BSDProducer, 'new BSDProducer object created');
|
|
12
|
-
assert.equal(BSDProducer.type, 'RFC3164', 'BSD Producer set correctly');
|
|
13
|
-
|
|
14
|
-
var presetProducer = new producer({
|
|
15
|
-
type: 'bsd',
|
|
16
|
-
facility: 'ntp',
|
|
17
|
-
host: 'localhost',
|
|
18
|
-
appName: 'kill'
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
var invalidProducer = new producer({
|
|
22
|
-
type: 'invalid',
|
|
23
|
-
facility: 'invalid',
|
|
24
|
-
});
|
|
25
|
-
assert.notEqual(invalidProducer, 'invalid producer is null');
|
|
26
|
-
|
|
27
|
-
var msg = syslogProducer.produce({
|
|
28
|
-
facility: 'local4',
|
|
29
|
-
severity: 'error',
|
|
30
|
-
host: 'localhost',
|
|
31
|
-
appName: 'sudo',
|
|
32
|
-
pid: '123',
|
|
33
|
-
date: new Date(1234567890000),
|
|
34
|
-
message: 'Test Message'
|
|
35
|
-
});
|
|
36
|
-
assert.equal(msg, "<163>1 2009-02-13T23:31:30.00+01:00 localhost sudo 123 - - Test Message",'Valid message returned');
|
|
37
|
-
|
|
38
|
-
syslogProducer.produce({
|
|
39
|
-
facility: 'audit',
|
|
40
|
-
severity: 'error',
|
|
41
|
-
host: '127.0.0.1',
|
|
42
|
-
appName: 'sudo',
|
|
43
|
-
pid: '419',
|
|
44
|
-
date: new Date(1234567890000),
|
|
45
|
-
message: 'Test Message'
|
|
46
|
-
}, function(cbMsg) {
|
|
47
|
-
assert.equal(cbMsg, '<107>1 2009-02-13T23:31:30.00+01:00 127.0.0.1 sudo 419 - - Test Message', 'Valid message in callback returned');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
BSDProducer.produce({
|
|
51
|
-
facility: 'audit',
|
|
52
|
-
severity: 'error',
|
|
53
|
-
host: '127.0.0.1',
|
|
54
|
-
appName: 'sudo',
|
|
55
|
-
pid: '419',
|
|
56
|
-
date: new Date(1234567890000),
|
|
57
|
-
message: 'Test Message'
|
|
58
|
-
}, function(cbMsg){
|
|
59
|
-
assert.equal(cbMsg, '<107>Feb 14 00:31:30 127.0.0.1 sudo[419]: Test Message');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
var debugMsg = presetProducer.debug({
|
|
63
|
-
facility: 'local2',
|
|
64
|
-
message: 'Debug Message',
|
|
65
|
-
date: new Date(1234567890000),
|
|
66
|
-
pid: 91
|
|
67
|
-
});
|
|
68
|
-
assert.ok(debugMsg);
|
|
69
|
-
assert.equal(debugMsg, '<151>Feb 14 00:31:30 localhost kill[91]: Debug Message');
|
|
70
|
-
|
|
71
|
-
var infoMsg = presetProducer.info({
|
|
72
|
-
facility: 'ntp',
|
|
73
|
-
message: 'Info Message',
|
|
74
|
-
pid: 42,
|
|
75
|
-
date: new Date(1234567890000)
|
|
76
|
-
});
|
|
77
|
-
assert.ok(infoMsg);
|
|
78
|
-
assert.equal(infoMsg, '<102>Feb 14 00:31:30 localhost kill[42]: Info Message');
|
|
79
|
-
|
|
80
|
-
var noticeMsg = presetProducer.debug({
|
|
81
|
-
facility: 'local2',
|
|
82
|
-
message: 'Notice Message',
|
|
83
|
-
pid: 16,
|
|
84
|
-
date: new Date(1234567890000)
|
|
85
|
-
});
|
|
86
|
-
assert.ok(noticeMsg);
|
|
87
|
-
assert.equal(noticeMsg, '<151>Feb 14 00:31:30 localhost kill[16]: Notice Message');
|
|
88
|
-
|
|
89
|
-
var warnMsg = presetProducer.debug({
|
|
90
|
-
facility: 'local4',
|
|
91
|
-
message: 'Warning Message',
|
|
92
|
-
pid: 91,
|
|
93
|
-
date: new Date(1234567890000)
|
|
94
|
-
});
|
|
95
|
-
assert.ok(warnMsg);
|
|
96
|
-
assert.equal(warnMsg, '<167>Feb 14 00:31:30 localhost kill[91]: Warning Message');
|
|
97
|
-
|
|
98
|
-
var errorMsg = presetProducer.debug({
|
|
99
|
-
facility: 'clock',
|
|
100
|
-
message: 'Error Message',
|
|
101
|
-
pid: 91,
|
|
102
|
-
date: new Date(1234567890000)
|
|
103
|
-
});
|
|
104
|
-
assert.ok(errorMsg);
|
|
105
|
-
assert.equal(errorMsg, '<79>Feb 14 00:31:30 localhost kill[91]: Error Message');
|
|
106
|
-
|
|
107
|
-
var criticalMsg = presetProducer.crit({
|
|
108
|
-
facility: 'local0',
|
|
109
|
-
message: 'Critical Message',
|
|
110
|
-
pid: 91,
|
|
111
|
-
date: new Date(1234567890000)
|
|
112
|
-
});
|
|
113
|
-
assert.ok(criticalMsg);
|
|
114
|
-
assert.equal(criticalMsg, '<130>Feb 14 00:31:30 localhost kill[91]: Critical Message');
|
|
115
|
-
|
|
116
|
-
var alertMsg = presetProducer.alert({
|
|
117
|
-
facility: 'clock',
|
|
118
|
-
message: 'Alert Message',
|
|
119
|
-
pid: 91,
|
|
120
|
-
date: new Date(1234567890000)
|
|
121
|
-
});
|
|
122
|
-
assert.ok(alertMsg);
|
|
123
|
-
assert.equal(alertMsg, '<73>Feb 14 00:31:30 localhost kill[91]: Alert Message');
|
|
124
|
-
|
|
125
|
-
var emergencyMsg = presetProducer.emergency({
|
|
126
|
-
facility: 'news',
|
|
127
|
-
message: 'Emergency Message',
|
|
128
|
-
pid: 91,
|
|
129
|
-
date: new Date(1234567890000)
|
|
130
|
-
});
|
|
131
|
-
assert.ok(emergencyMsg);
|
|
132
|
-
assert.equal(emergencyMsg, '<56>Feb 14 00:31:30 localhost kill[91]: Emergency Message');
|
|
133
|
-
|
|
134
|
-
var structuredMsg = syslogProducer.produce({
|
|
135
|
-
facility: 'local4',
|
|
136
|
-
severity: 'error',
|
|
137
|
-
host: 'mymachine.example.com',
|
|
138
|
-
appName: 'evntslog',
|
|
139
|
-
msgID: 'ID47',
|
|
140
|
-
date: new Date(1234567890000),
|
|
141
|
-
structuredData: {
|
|
142
|
-
'exampleSDID@32473': {
|
|
143
|
-
'iut': "3",
|
|
144
|
-
'eventSource': "Application",
|
|
145
|
-
'eventID': "1011",
|
|
146
|
-
'seqNo': "1"
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
message: 'BOMAn application event log entry...'
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
assert.ok(structuredMsg);
|
|
153
|
-
assert.equal(structuredMsg, '<163>1 2009-02-13T23:31:30.00+01:00 mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011" seqNo="1"] BOMAn application event log entry...');
|
|
154
|
-
|
|
155
|
-
var messageWithOneDigitDate = presetProducer.emergency({
|
|
156
|
-
facility: 'news',
|
|
157
|
-
message: 'Emergency Message',
|
|
158
|
-
pid: 91,
|
|
159
|
-
date: new Date(1233531090000)
|
|
160
|
-
});
|
|
161
|
-
assert.ok(messageWithOneDigitDate);
|
|
162
|
-
assert.equal(messageWithOneDigitDate, '<56>Feb 2 00:31:30 localhost kill[91]: Emergency Message');
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// set timezone to CET for tests
|
|
2
|
-
process.env.TZ='CET';
|
|
3
|
-
|
|
4
|
-
var spawn = require('child_process').spawn,
|
|
5
|
-
fs = require('fs'),
|
|
6
|
-
exitCode = 0,
|
|
7
|
-
timeout = 10000;
|
|
8
|
-
|
|
9
|
-
fs.readdir(__dirname, function (e, files) {
|
|
10
|
-
if(e) throw e;
|
|
11
|
-
|
|
12
|
-
var tests = files.filter(function (f) {return f.substr(-2) === 'js' && f != 'runner.js'});
|
|
13
|
-
|
|
14
|
-
var next = function () {
|
|
15
|
-
if(tests.length === 0) process.exit(exitCode);
|
|
16
|
-
|
|
17
|
-
var file = tests.shift();
|
|
18
|
-
var proc = spawn('node', [ 'test/' + file ]);
|
|
19
|
-
|
|
20
|
-
var killed = false;
|
|
21
|
-
var t = setTimeout(function () {
|
|
22
|
-
proc.kill();
|
|
23
|
-
exitCode += 1;
|
|
24
|
-
console.error(file + ' timeout');
|
|
25
|
-
killed = true;
|
|
26
|
-
}, timeout)
|
|
27
|
-
|
|
28
|
-
proc.stdout.pipe(process.stdout);
|
|
29
|
-
proc.stderr.pipe(process.stderr);
|
|
30
|
-
proc.on('exit', function (code) {
|
|
31
|
-
if (code && !killed) console.error(file + ' failed');
|
|
32
|
-
exitCode += code || 0;
|
|
33
|
-
clearTimeout(t);
|
|
34
|
-
next();
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
next();
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var syslogParser = require('../lib/glossy/parse.js'),
|
|
2
|
-
assert = require('assert');
|
|
3
|
-
|
|
4
|
-
assert.ok(syslogParser, 'parser loaded');
|
|
5
|
-
var singleStructure = '[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"]';
|
|
6
|
-
assert.deepEqual(syslogParser.parseStructure(singleStructure), {
|
|
7
|
-
'exampleSDID@32473': {
|
|
8
|
-
iut: '3',
|
|
9
|
-
eventSource: 'Application',
|
|
10
|
-
eventID: '1011'
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
var doubleStructure = '[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"] ';
|
|
15
|
-
assert.deepEqual(syslogParser.parseStructure(doubleStructure), {
|
|
16
|
-
'exampleSDID@32473': {
|
|
17
|
-
iut: '3',
|
|
18
|
-
eventID: '1011',
|
|
19
|
-
eventSource: 'Application'
|
|
20
|
-
},
|
|
21
|
-
'examplePriority@32473': {
|
|
22
|
-
'class': 'high'
|
|
23
|
-
}
|
|
24
|
-
});
|