Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rookout

Package Overview
Dependencies
Maintainers
1
Versions
272
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rookout - npm Package Compare versions

Comparing version 0.1.37 to 0.1.39

augs/conditions/Condition.js

23

augs/actions/ActionRunProcessor.js

@@ -38,24 +38,9 @@ "use strict";

key: 'execute',
value: function execute(augId, frame, stack, extractedNamespace, output, userWarnings) {
if (!extractedNamespace) {
extractedNamespace = new _ContainerNamespace2.default({});
}
value: function execute(augId, containerNamespace, output, userWarnings) {
this.processor.process(containerNamespace, userWarnings);
output.sendUserMessage(augId, containerNamespace.readAttribute('store'));
var store = new _ContainerNamespace2.default({});
var namespace = new _ContainerNamespace2.default({
'frame': frame,
'stack': stack,
'extracted': extractedNamespace,
'store': store,
'temp': new _ContainerNamespace2.default({}),
'utils': new _JSUtilsNamespace2.default({})
});
this.processor.process(namespace, userWarnings);
output.sendUserMessage(augId, store);
if (this.postProcessor) {
output.flushMessages();
self.postProcessor(namespace);
self.postProcessor(containerNamespace);
}

@@ -62,0 +47,0 @@ }

@@ -21,2 +21,10 @@ "use strict";

var _ContainerNamespace = require("../processor/namespaces/ContainerNamespace");
var _ContainerNamespace2 = _interopRequireDefault(_ContainerNamespace);
var _JSUtilsNamespace = require("../processor/namespaces/JSUtilsNamespace");
var _JSUtilsNamespace2 = _interopRequireDefault(_JSUtilsNamespace);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -27,4 +35,5 @@

var Aug = function () {
function Aug(augId, location, action, output) {
var minTimeBetweenHits = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
function Aug(augId, location, action, condition, output) {
var minTimeBetweenHits = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
var maxAugTime = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;

@@ -39,4 +48,6 @@ _classCallCheck(this, Aug);

this.minTimeBetweenHits = minTimeBetweenHits;
this.maxAugTime = maxAugTime;
this.lastExecuted = 0;
this.enabled = true;
this.condition = condition;
}

@@ -65,5 +76,5 @@

var now = Date.now();
var beforeTime = Date.now();
if (this.minTimeBetweenHits > 0 && now < this.lastExecuted + this.minTimeBetweenHits) {
if (this.minTimeBetweenHits > 0 && beforeTime < this.lastExecuted + this.minTimeBetweenHits) {
this.enabled = false;

@@ -73,5 +84,30 @@ throw new _exceptions.RookRuleRateLimited();

this.lastExecuted = Date.now();
this.lastExecuted = beforeTime;
this.action.execute(this.augId, frame, stack, extracted, this.output, new _UserWarnings2.default(this.output, this.augId));
if (!extracted) {
extracted = new _ContainerNamespace2.default({});
}
var namespace = new _ContainerNamespace2.default({
'frame': frame,
'stack': stack,
'extracted': extracted,
'store': new _ContainerNamespace2.default({}),
'temp': new _ContainerNamespace2.default({}),
'utils': new _JSUtilsNamespace2.default({})
});
var shouldExecute = true;
if (this.condition !== undefined) {
shouldExecute = this.condition.evaluate(namespace);
}
if (shouldExecute) {
this.action.execute(this.augId, namespace, this.output, new _UserWarnings2.default(this.output, this.augId));
if (this.maxAugTime > 0 && Date.now() > beforeTime + this.maxAugTime) {
this.enabled = false;
throw new _exceptions.RookRuleRateLimited();
}
}
} catch (e) {

@@ -78,0 +114,0 @@ var message = "Exception while processing Aug";

@@ -25,2 +25,6 @@ "use strict";

var _Condition = require("./conditions/Condition");
var _Condition2 = _interopRequireDefault(_Condition);
var _exceptions = require("../exceptions");

@@ -65,3 +69,11 @@

return new _Aug2.default(augId, location, action, this.output, minTimeBetweenHits);
var condition = void 0;
var conditionConfiguration = configuration["conditional"];
if (null != conditionConfiguration) {
condition = new _Condition2.default(conditionConfiguration);
}
var maxAugTime = configuration.maxAugTime || config.InstrumentationConfig.MAX_AUG_TIME;
return new _Aug2.default(augId, location, action, condition, this.output, minTimeBetweenHits, maxAugTime);
}

@@ -68,0 +80,0 @@ }, {

@@ -249,3 +249,3 @@ "use strict";

if ([grpc.status.CANCELLED, grpc.status.NOT_FOUND, grpc.status.PERMISSION_DENIED, grpc.status.UNAUTHENTICATED].includes(code)) {
if (code === grpc.status.PERMISSION_DENIED) {
throw new _exceptions.RookInvalidToken();

@@ -252,0 +252,0 @@ }

@@ -82,3 +82,4 @@ "use strict";

ENGINE: "auto",
MIN_TIME_BETWEEN_HITS_MS: 100
MIN_TIME_BETWEEN_HITS_MS: 100,
MAX_AUG_TIME: 400
};

@@ -85,0 +86,0 @@ }

@@ -9,2 +9,3 @@ "use strict";

exports.RookInvalidBasicPath = RookInvalidBasicPath;
exports.RookInvalidArithmeticPath = RookInvalidArithmeticPath;
exports.RookOperationReadOnly = RookOperationReadOnly;

@@ -38,2 +39,3 @@ exports.RookAttributeNotFound = RookAttributeNotFound;

exports.RookDependencyError = RookDependencyError;
exports.RookInvalidLabel = RookInvalidLabel;
function ToolException(message, parameters) {

@@ -70,2 +72,11 @@ Error.call(this);

function RookInvalidArithmeticPath(configuration) {
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
ToolException.call(this, 'Invalid arithmetic path configuration', {
configuration: configuration,
exception: e });
}
setExceptionPrototype(RookInvalidArithmeticPath);
function RookOperationReadOnly(operationType) {

@@ -242,2 +253,9 @@ RookOperationReadOnly.call(this, 'Operation does not support write', { operation: operationType });

setExceptionPrototype(RookDependencyError);
function RookInvalidLabel(label) {
ToolException.call(this, 'Invalid label: must not start with the \'$\' character', {
label: label
});
}
setExceptionPrototype(RookInvalidLabel);
//# sourceMappingURL=exceptions.js.map

@@ -5,4 +5,6 @@ 'use strict';

var _utils = require('./utils');
var _utils = require("./utils");
var _exceptions = require("./exceptions");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -26,3 +28,3 @@

_createClass(Rook, [{
key: 'start',
key: "start",
value: function start() {

@@ -59,19 +61,8 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

try {
var verifyBoolean = function verifyBoolean(object, errorString) {
if (!(typeof object === 'boolean')) {
throw new RookInvalidOptions(errorString);
}
};
var verifyString = function verifyString(object, errorString) {
if (!(typeof object === 'string' || object instanceof String)) {
throw new RookInvalidOptions(errorString);
}
};
var config = require('./config');
verifyBoolean(this.throw_errors, 'Rook throw errors should be a boolean');
Rook._verifyBoolean(this.throw_errors, 'Rook throw errors should be a boolean');
if (options.log_to_stderr !== undefined) {
verifyBoolean(options.log_to_stderr, 'Rook log to stderr should be a boolean');
Rook._verifyBoolean(options.log_to_stderr, 'Rook log to stderr should be a boolean');
config.LoggingConfiguration.LOG_TO_STDERR = options.log_to_stderr;

@@ -81,3 +72,3 @@ }

if (options.log_level !== undefined) {
verifyString(options.log_level, 'Rook log level should be a String');
Rook._verifyString(options.log_level, 'Rook log level should be a String');
config.LoggingConfiguration.LOG_LEVEL = options.log_level;

@@ -87,3 +78,3 @@ }

if (options.log_file !== undefined) {
verifyString(options.log_file, 'Rook log file should be a String');
Rook._verifyString(options.log_file, 'Rook log file should be a String');
config.LoggingConfiguration.FILE_NAME = options.log_file;

@@ -132,3 +123,3 @@ }

verifyString(_tag, 'Rook tags should be array of strings');
Rook._verifyString(_tag, 'Rook tags should be array of strings');
}

@@ -201,4 +192,5 @@ } catch (err) {

verifyString(_label);
verifyString(options.labels[_label], 'Rook label should be a map of strings');
Rook._verifyString(_label);
Rook._verifyString(options.labels[_label], 'Rook label should be a map of strings');
Rook._verifyLabel(_label);
}

@@ -221,3 +213,3 @@ } catch (err) {

verifyBoolean(this.debug, 'Rook debug flag should be a boolean');
Rook._verifyBoolean(this.debug, 'Rook debug flag should be a boolean');
if (this.debug) {

@@ -237,3 +229,3 @@ config.LoggingConfiguration.LOG_LEVEL = 'DEBUG';

if (token !== undefined) {
verifyString(token, 'Rook token should be a String');
Rook._verifyToken(token);
}

@@ -243,3 +235,3 @@ }

host = host || config.AgentAddress.HOST;
verifyString(host, 'Rook host should be String');
Rook._verifyString(host, 'Rook host should be String');

@@ -286,3 +278,3 @@ if (host === "staging.cloud.agent.rookout.com" || host === "cloud.agent.rookout.com") {

}, {
key: 'stop',
key: "stop",
value: function stop() {

@@ -305,3 +297,3 @@ if (!this.singleton) return;

}, {
key: 'flush',
key: "flush",
value: function flush(callback) {

@@ -327,2 +319,36 @@ if (!this.singleton) {

}
}], [{
key: "_verifyBoolean",
value: function _verifyBoolean(object, errorString) {
if (!(typeof object === 'boolean')) {
throw new RookInvalidOptions(errorString);
}
}
}, {
key: "_verifyString",
value: function _verifyString(object, errorString) {
if (!(typeof object === 'string' || object instanceof String)) {
throw new RookInvalidOptions(errorString);
}
}
}, {
key: "_verifyToken",
value: function _verifyToken(object) {
Rook._verifyString(object, 'Rook token should be a String');
if (object.length !== 64) {
throw new RookInvalidOptions('Rook token should be 64 characters');
}
if (/^[0-9a-zA-Z]+$/.test(object) === false) {
throw new RookInvalidOptions('Rook token must consist of only hexadecimal characters');
}
}
}, {
key: "_verifyLabel",
value: function _verifyLabel(label) {
if (label.startsWith("$")) {
throw new _exceptions.RookInvalidLabel(label);
}
}
}]);

@@ -329,0 +355,0 @@

{
"name": "rookout",
"commit": "94f94bc1cd6574867df4951f729444ea3b1cefec",
"version": "0.1.37",
"commit": "f5c3fc3601a7899ec3570134b5813b72cdfae523",
"version": "0.1.39",
"description": "Rook is a package for on the fly debugging and data extraction for applications in production",

@@ -6,0 +6,0 @@ "main": "index.js",

@@ -28,6 +28,6 @@ "use strict";

/*
Javascript doesn't actually have dicts (or maps etc),
they are the same as JS objects. This class exists for
compatibility with parts of the API that require a dict.
*/
Javascript doesn't actually have dicts (or maps etc),
they are the same as JS objects. This class exists for
compatibility with parts of the API that require a dict.
*/
var DictNamespace = function (_Namespace) {

@@ -34,0 +34,0 @@ _inherits(DictNamespace, _Namespace);

@@ -22,9 +22,6 @@ "use strict";

function DynamicInspectorObjectNamespace(inspector) {
function DynamicInspectorObjectNamespace() {
_classCallCheck(this, DynamicInspectorObjectNamespace);
var _this = _possibleConstructorReturn(this, (DynamicInspectorObjectNamespace.__proto__ || Object.getPrototypeOf(DynamicInspectorObjectNamespace)).call(this));
_this.inspector = inspector;
return _this;
return _possibleConstructorReturn(this, (DynamicInspectorObjectNamespace.__proto__ || Object.getPrototypeOf(DynamicInspectorObjectNamespace)).call(this));
}

@@ -31,0 +28,0 @@

@@ -170,3 +170,3 @@ "use strict";

if (undefined !== this.frame.this) {
if (this.frame.this !== undefined && this.frame.this.className !== 'global') {
result['this'] = _InspectorObjectNamespace2.default.getObject(this.inspector, this.frame.this);

@@ -173,0 +173,0 @@ }

@@ -49,4 +49,2 @@ "use strict";

}
_this.properties = _this.inspector.getProperties(_this.obj);
return _this;

@@ -56,4 +54,13 @@ }

_createClass(InspectorObjectNamespace, [{
key: "loadProperties",
value: function loadProperties() {
if (this.properties === undefined) {
this.properties = this.inspector.getProperties(this.obj);
}
}
}, {
key: "readAttribute",
value: function readAttribute(name) {
this.loadProperties();
var _iteratorNormalCompletion = true;

@@ -105,35 +112,26 @@ var _didIteratorError = false;

}
}, {
key: "attributeNames",
value: function attributeNames() {
var result = [];
}], [{
key: "getObjectInternal",
value: function getObjectInternal(inspector, obj) {
switch (obj.type) {
case 'number':
case 'string':
case 'undefined':
case 'boolean':
case 'symbol':
return obj.value;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
case 'object':
if (null === obj.value) {
return null;
}
try {
for (var _iterator2 = this.properties[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var property = _step2.value;
case 'function':
return new InspectorObjectNamespace(inspector, obj);
result.push(property.name);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
default:
throw new _exceptions.RookInspectorUnknownObject(obj);
}
return result;
}
}], [{
}, {
key: "getObject",

@@ -140,0 +138,0 @@ value: function getObject(inspector, obj) {

@@ -92,3 +92,3 @@ "use strict";

} else if (namespace instanceof _DynamicInspectorObjectNamespace2.default) {
this.dumpDynamicInspectorObjectNamespace(namespace, variant);
this.dumpDynamicInspectorObjectNamespace(variant);
} else {

@@ -176,3 +176,2 @@ throw new TypeError("Does not support serializing this type!");

if (Number.isInteger(obj)) {
if (obj <= INT32_MAX && function (obj) {

@@ -439,3 +438,3 @@ return INT32_MIN;

key: "dumpDictNamespace",
value: function dumpDictNamespace(namespace, variant, dumpConfig, logErrors) {
value: function dumpDictNamespace(namespace, variant, logErrors) {
variant.setVariantType(proto.Variant.Type.VARIANT_MAP);

@@ -459,4 +458,4 @@ variant.setOriginalType(namespace.originalType);

pair.setFirst(this.dumps(new _JSObjectNamespace2.default(key, dumpConfig), logErrors));
pair.setSecond(this.dumps(new _JSObjectNamespace2.default(namespace.dict[key], dumpConfig), logErrors));
pair.setFirst(this.dumps(new _JSObjectNamespace2.default(key), logErrors));
pair.setSecond(this.dumps(new _JSObjectNamespace2.default(namespace.dict[key]), logErrors));

@@ -490,7 +489,3 @@ dictValue.addPairs(pair);

try {
variant.setOriginalType(namespace.readAttribute('__proto__').readAttribute('constructor').readAttribute('name').obj);
} catch (e) {
variant.setOriginalType(namespace.obj.className);
}
variant.setOriginalType(namespace.obj.className);

@@ -505,3 +500,5 @@ if (namespace.obj.type === 'function') {

return;
} else switch (namespace.obj.subtype) {
}
switch (namespace.obj.subtype) {
case 'array':

@@ -519,2 +516,4 @@ this.dumpInspectorArray(namespace, variant, currentDepth, dumpConfig);

namespace.loadProperties();
var _iteratorNormalCompletion5 = true;

@@ -525,7 +524,7 @@ var _didIteratorError5 = false;

try {
for (var _iterator5 = namespace.attributeNames()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var name = _step5.value;
for (var _iterator5 = namespace.properties[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var property = _step5.value;
// If it's an Array, ignore it's index attributes and the length method
if (namespace.obj.subtype === 'array' && (parseInt(name).toString() === name || name === 'length')) {
if (namespace.obj.subtype === 'array' && (parseInt(property.name).toString() === property.name || property.name === 'length')) {
continue;

@@ -535,19 +534,26 @@ }

// We don't dump proto automatically as it leads to very large dumps
if (name === '__proto__') {
if (property.name === '__proto__') {
continue;
}
var obj = namespace.readAttribute(name);
var item = new proto.Variant();
var item = new proto.Variant();
if (obj instanceof _InspectorObjectNamespace2.default) {
this.dumpInspectorObjectNamespace(obj, item, currentDepth + 1, dumpConfig, logErrors);
} else if (obj instanceof _DynamicInspectorObjectNamespace2.default) {
this.dumpDynamicInspectorObjectNamespace(obj, item);
if (property.value === null || property.value === undefined) {
if ('get' in property) {
this.dumpDynamicInspectorObjectNamespace(item);
} else {
throw new RookInspectorUnknownProperty(property);
}
} else {
this.dumpJSObject(obj.obj, item, currentDepth + 1, dumpConfig);
var obj = _InspectorObjectNamespace2.default.getObjectInternal(namespace.inspector, property.value);
if (obj instanceof _InspectorObjectNamespace2.default) {
this.dumpInspectorObjectNamespace(obj, item, currentDepth + 1, dumpConfig, logErrors);
} else {
this.dumpJSObject(obj, item, currentDepth + 1, dumpConfig);
}
}
var attribute = new proto.Variant.NamedValue();
attribute.setName(name);
attribute.setName(property.name);
attribute.setValue(item);

@@ -574,3 +580,3 @@

key: "dumpDynamicInspectorObjectNamespace",
value: function dumpDynamicInspectorObjectNamespace(namespace, variant) {
value: function dumpDynamicInspectorObjectNamespace(variant) {
variant.setVariantType(proto.Variant.Type.VARIANT_DYNAMIC);

@@ -577,0 +583,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc