TritonDataCenter / node-artedi

a library for measuring fish
2 stars 4 forks source link

TRITON-2325 CVE-2021-3918: json-schema is vulnerable to Prototype Pollution #32

Closed travispaul closed 2 years ago

travispaul commented 2 years ago

make check

# make check
./node_modules/.bin/json --validate -f package.json
deps/jsstyle/jsstyle -f tools/jsstyle.conf lib/utils.js lib/metric_vector.js lib/histogram.js lib/common.js lib/gauge.js lib/buckets.js lib/collector.js lib/provider.js lib/metric.js lib/counter.js test/buckets.test.js test/basic.test.js
./node_modules/.bin/eslint -c tools/eslint.node.conf lib/utils.js lib/metric_vector.js lib/histogram.js lib/common.js lib/gauge.js lib/buckets.js lib/collector.js lib/provider.js lib/metric.js lib/counter.js test/buckets.test.js test/basic.test.js
check ok

make test

# make test
TAP=1 ./node_modules/.bin/tape test/*.test.js
TAP version 13
# getValue tests
ok 1 default counter should start at zero
ok 2 default counter should be incremented
ok 3 should be truthy
ok 4 child label get value
ok 5 get value from a gauge
ok 6 error on nonexistent gauge
ok 7 error name checks out
# parent/child tests
ok 8 basic full name
ok 9 metric registered
ok 10 duplicate collector with same name
ok 11 get collector by name
# trim functionality tests
ok 12 left- and right-trim
ok 13 left- and right-trim of multiple labels
# hash tests
ok 14 consistent hashing with unordered objects
# label tests
ok 15 increment w/ static labels from Collector and Counter
ok 16 default counter with getValue
ok 17 increment w/ dynamic label and static labels
ok 18 increment w/ label from Collector
ok 19 increment with empty label structure
ok 20 numeric label values, multiple labels
# absolute gauge tests
ok 21 basic absolute gauge set value
ok 22 basic absolute gauge set value to zero
ok 23 basic absolute gauge set value to negative float
ok 24 set gauge value to a string
# counter serialization tests
ok 25 error present for invalid serialization format
ok 26 no metrics returned with serialization error
ok 27 no error for no metrics
ok 28 no metrics, only comments
ok 29 no error for two labels
ok 30 two label increment
ok 31 no error for reversed labels
ok 32 reversed label add
ok 33 error escaping special characters
ok 34 special character escaping failed
ok 35 no error for default counter
ok 36 default counter
# histogram serialization tests
ok 37 no error for no metrics
ok 38 no labels or data points
ok 39 no error for single label
ok 40 single label
ok 41 no error for collector labels
ok 42 Collector labels and no Histogram labels
ok 43 no error for inherited labels
ok 44 inherited Histogram and Collector labels
ok 45 no error for dynamic and static labels
ok 46 dynamic labels, and static labels from Histogram and Collector
ok 47 no error for copying bucket values
ok 48 initial values copied from low-order buckets to high-order buckets
# odd value tests
ok 49 add zero to counter
ok 50 histogram tracks values less than one
ok 51 histogram observes zero value
ok 52 invalid collector name (invalid chars)
ok 53 invalid collector name (space)
ok 54 invalid collector help (numeric)
ok 55 invalid collector help (object)
# basic trigger tests
ok 56 collector object present
ok 57 collector object correct
ok 58 counter object is valid
ok 59 no error from triggered metrics
ok 60 trigger function called
# default bucket tests
ok 61 default buckets for histogram with no buckets opt
# non-monotonic buckets
ok 62 non-monotonic buckets should not be allowed
# histogram buckets incremented
ok 63 no error for copying bucket values
ok 64 observe(2) incremented all subsequent buckets
ok 65 no error for copying bucket values
ok 66 observe(0.5) incremented all subsequent buckets
# gauge expiry tests
ok 67 initial gauge set value
ok 68 initial gauge set value
ok 69 initial gauge set value
ok 70 initial expiryGauge2 set value
ok 71 nonExpiryGauge value not reset
ok 72 initial expiryGauge1 set value
# linearBuckets
ok 73 test linearBuckets(1, 1, 10)
ok 74 0 should be invalid min for linearBuckets
# exponentialBuckets
ok 75 test exponentialBuckets(1, 2, 5)
# logLinearBuckets
ok 76 test logLinearBuckets(2, 0, 6, 2)
ok 77 test logLinearBuckets(3, 0, 1, 9)
ok 78 test logLinearBuckets(4, 0, 1, 4)
ok 79 test logLinearBuckets(5, 0, 1, 25)
ok 80 test logLinearBuckets(6, 0, 3, 12)
ok 81 test logLinearBuckets(7, 0, 1, 7)
ok 82 test logLinearBuckets(8, 0, 1, 16)
ok 83 test logLinearBuckets(9, 0, 1, 9)
ok 84 test logLinearBuckets(10, 0, 1, 10)
ok 85 test logLinearBuckets(10, -3, 1, 10)
ok 86 test logLinearBuckets(10, -3, 1, 20)
ok 87 test logLinearBuckets(10, -3, 1, 4)
ok 88 test logLinearBuckets(10, 0, 1, 33)

1..88
# tests 88
# pass  88

# ok