Socket
Socket
Sign inDemoInstall

@contrast/agentify

Package Overview
Dependencies
Maintainers
17
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrast/agentify - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

62

lib/contrast-methods.js

@@ -18,3 +18,9 @@ /*

module.exports = function(deps) {
module.exports = function(core) {
const { logger, patcher } = core;
const getOrig = (v) => patcher.unwrap(v);
const slice = patcher.unwrap(String.prototype.slice);
const toUntrackedString = (v) => slice.call(` ${v}`, 1);
/**

@@ -25,3 +31,3 @@ * Components e.g. Assess, Protect, can

*/
const contrastMethods = deps.contrastMethods = {
const contrastMethods = {
// TODO: Assess will require add'l methods

@@ -33,3 +39,49 @@ // TODO: ESM will require add'l methods

},
Function: deps.patcher.patch(global.Function, {
plus(left, right) {
const ret = getOrig(left) + getOrig(right);
return ret;
},
doubleEqual(left, right) {
left = getOrig(left);
right = getOrig(right);
return left == right;
},
notTripleEqual(left, right) {
left = getOrig(left);
right = getOrig(right);
return left !== right;
},
tripleEqual(left, right) {
left = getOrig(left);
right = getOrig(right);
return left === right;
},
notDoubleEqual(left, right) {
left = getOrig(left);
right = getOrig(right);
return left != right;
},
forceCopy(handle) {
// Used to force a copy of handle:
// https://stackoverflow.com/a/31733628
// This is a workaround for CONTRAST-30333, in which something we
// suspect is a v8 bug means that handle will otherwise be clobbered
// and if it was externalized, we will lose the data associated with it
if (typeof handle === 'string') {
handle = toUntrackedString(handle);
}
return handle;
},
cast: function __cast(val) {
return getOrig(val);
},
tag: function __contrastTag(strings) {
// XXX implemented in lib/assess/propagators/templates.js
},
Function: core.patcher.patch(global.Function, {
name: 'global.Function',

@@ -62,7 +114,7 @@ patchType: 'rewrite-injection'

// controlled, but still we should have the defensive code.
deps.logger.error({ err }, 'Unable to install global.ContrastMethods');
logger.error({ err }, 'Unable to install global.ContrastMethods');
}
};
return deps.contrastMethods;
return core.contrastMethods = contrastMethods;
};

5

lib/index.js

@@ -25,5 +25,6 @@ /*

'contrastMethods',
'instrumentationLocks',
'deadzones',
'scopes',
'sources',
'assess',
'protect',

@@ -40,6 +41,4 @@ 'depHooks',

require('./contrast-methods')(deps);
require('./instrumentation-locks')(deps);
require('./function-hooks')(deps);
require('./rewrite-hooks')(deps);
// TODO: NODE-2229

@@ -46,0 +45,0 @@ /**

@@ -31,2 +31,3 @@ /*

const { code } = deps.rewriter.rewrite(content, { filename, inject: true, wrap: true });
try {

@@ -33,0 +34,0 @@ compiled = origCompile.call(this, code, filename);

{
"name": "@contrast/agentify",
"version": "1.1.2",
"version": "1.2.0",
"description": "Configures Contrast agent services and instrumentation within an application",

@@ -19,2 +19,2 @@ "license": "SEE LICENSE IN LICENSE",

}
}
}
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