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.94 to 0.1.95

52

augs/Aug.js

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

var _DebuggerBackchannel = _interopRequireDefault(require("../services/DebuggerBackchannel"));
var _JSObjectNamespace = _interopRequireDefault(require("../processor/namespaces/JSObjectNamespace"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -27,2 +31,6 @@

process.__rookout_backchannel = new _DebuggerBackchannel.default();
process.__rookout_backchannel.ContainerNamespace = _ContainerNamespace.default;
process.__rookout_backchannel.ObjectNamespace = _JSObjectNamespace.default;
class Aug {

@@ -40,2 +48,3 @@ constructor(augId, location, action, condition, output, maxAugTime, limits) {

this._logCache = new Map();
this._scopeSample = undefined;

@@ -76,22 +85,24 @@ if (limits !== undefined && limits.length > 0) {

if (this.condition === undefined || this.condition.evaluate(namespace)) {
let rateLimitKey = this.rateLimiter.allow(startTime);
if (this.condition !== undefined && this._scopeSample === undefined) {
// this is the first time this aug is executed
this._scopeSample = frame.populateScopes(); // The first time the aug is executed, the condition
// is not evaluated in the Inspector, so we evaluate
// it here instead.
if (rateLimitKey === null) {
this.sendWarning(new _RookError.default(new _exceptions.RookRuleRateLimited()));
if (!this.condition.evaluate(namespace)) {
return;
}
}
const msgId = uuid4().replace(/\-/g, "");
const msgId = uuid4().replace(/\-/g, "");
_logger.logger.info("Executing aug-\t%s (msg ID %s)", this.augId, msgId);
_logger.logger.info("Executing aug-\t%s (msg ID %s)", this.augId, msgId);
this.action.execute(this.augId, msgId, namespace, this.output, new _UserWarnings.default(this));
let duration = Date.now() - startTime;
this.rateLimiter.record(rateLimitKey, duration);
this.action.execute(this.augId, msgId, namespace, this.output, new _UserWarnings.default(this));
let duration = Date.now() - startTime;
this.rateLimiter.record(startTime, duration);
if (this.maxAugTime > 0 && duration > this.maxAugTime) {
this.enabled = false;
throw new _exceptions.RookRuleMaxExecutionTimeReached();
}
if (this.maxAugTime > 0 && duration > this.maxAugTime) {
this.enabled = false;
throw new _exceptions.RookRuleMaxExecutionTimeReached();
}

@@ -160,2 +171,17 @@ } catch (e) {

checkRateLimit() {
try {
let rateLimitKey = this.rateLimiter.allow(Date.now());
if (rateLimitKey === null) {
this.sendWarning(new _RookError.default(new _exceptions.RookRuleRateLimited()));
return false;
} else {
return true;
}
} catch (e) {
return false;
}
}
}

@@ -162,0 +188,0 @@

@@ -15,2 +15,6 @@ 'use strict';

calculateWindowKey(time) {
return Math.floor(time / this.window_size) * this.window_size;
}
allow(now) {

@@ -22,3 +26,3 @@ if (this.window_size === undefined) {

this.cleanup(now);
let current_window_key = Math.floor(now / this.window_size) * this.window_size;
let current_window_key = this.calculateWindowKey(now);
let prev_window_key = current_window_key - this.window_size;

@@ -50,3 +54,3 @@ let current_window_usage = this.windows.get(current_window_key);

record(key, duration) {
record(start_time, duration) {
if (this.window_size === undefined) {

@@ -56,2 +60,3 @@ return;

let key = this.calculateWindowKey(start_time);
this.windows.set(key, this.windows.get(key) + duration);

@@ -58,0 +63,0 @@ }

@@ -181,4 +181,4 @@ "use strict";

return {
"version": "0.1.94",
"commit": "1d0a116c8301c8db258d0067313add48ab77f333"
"version": "0.1.95",
"commit": "6ba69549af229b1e1618cd96287aff049b4cd188"
};

@@ -185,0 +185,0 @@ }

@@ -18,4 +18,4 @@ "use strict";

this.VersionConfiguration = {
VERSION: "0.1.94",
COMMIT: "1d0a116c8301c8db258d0067313add48ab77f333"
VERSION: "0.1.95",
COMMIT: "6ba69549af229b1e1618cd96287aff049b4cd188"
};

@@ -22,0 +22,0 @@ this.ControllerAddress = {

{
"name": "rookout",
"commit": "1d0a116c8301c8db258d0067313add48ab77f333",
"version": "0.1.94",
"commit": "6ba69549af229b1e1618cd96287aff049b4cd188",
"version": "0.1.95",
"description": "Rook is a package for on the fly debugging and data extraction for applications in production",

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

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

function copy(index) {
let scopes = global.__rookout_backchannel.get(index).scopes;
let scopes = process.__rookout_backchannel.get(index).scopes;
scopes[scopes.length - 1].object = this;

@@ -201,3 +201,3 @@ }

if (this.scopes !== null) {
return;
return this.scopes;
}

@@ -208,6 +208,6 @@

let index = global.__rookout_backchannel.add();
let index = process.__rookout_backchannel.add();
try {
let context = global.__rookout_backchannel.get(index);
let context = process.__rookout_backchannel.get(index);

@@ -248,3 +248,3 @@ let scopeChain = this.frame.scopeChain;

function copy() {
global.__rookout_backchannel.get(${index}).this = this;
process.__rookout_backchannel.get(${index}).this = this;
}

@@ -254,3 +254,3 @@ `

let _this = global.__rookout_backchannel.get(index).this;
let _this = process.__rookout_backchannel.get(index).this;

@@ -263,6 +263,8 @@ if (_this === global) {

} finally {
global.__rookout_backchannel.delete(index);
process.__rookout_backchannel.delete(index);
this.scopes = scopes;
}
return this.scopes;
}

@@ -269,0 +271,0 @@

@@ -22,2 +22,10 @@ 'use strict';

create(key) {
if (this._store.get(key) === undefined) {
this._store.set(key, {});
}
return this._store.get(key);
}
get(index) {

@@ -24,0 +32,0 @@ return this._store.get(index);

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

} else {
this.debug.setBreak(pos);
this.debug.setBreak(pos, aug);
this.breakpoints[pos.toKey()] = [aug];

@@ -212,0 +212,0 @@ }

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

var _DebuggerBackchannel = _interopRequireDefault(require("./DebuggerBackchannel"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -29,4 +27,2 @@

global.__rookout_backchannel = new _DebuggerBackchannel.default();
class InspectorDebug {

@@ -121,3 +117,3 @@ constructor(userLine, scriptLoaded, getScript) {

setBreak(pos) {
setBreak(pos, aug) {
let result = {};

@@ -130,4 +126,39 @@ let scriptURL = pos.filename;

let key = 'aug-' + aug.augId;
let info = process.__rookout_backchannel.create(key);
info.aug = aug;
this.post('Debugger.setBreakpointByUrl', {
url: scriptURL,
condition: `
(() => {
let __aug = process.__rookout_backchannel.get('${key}').aug;
if (__aug.condition !== undefined && __aug._scopeSample !== undefined) {
let __scopes = __aug._scopeSample;
let __frame_namespace = new process.__rookout_backchannel.ContainerNamespace({});
let __namespace = new process.__rookout_backchannel.ContainerNamespace({
frame: __frame_namespace
});
for (let scope of __scopes) {
for (let obj_name in scope.object) {
__frame_namespace.writeAttribute(obj_name,
new process.__rookout_backchannel.ObjectNamespace(eval(obj_name)));
}
}
if (!__aug.condition.evaluate(__namespace)) {
return false;
}
}
if (!__aug.checkRateLimit()) {
return false;
}
return true;
})()
`,
lineNumber: pos.lineno - 1,

@@ -134,0 +165,0 @@ columnNumber: pos.column + 1

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