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

@datadog/native-iast-rewriter

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/native-iast-rewriter - npm Package Compare versions

Comparing version 0.1.0-beta.2 to 0.1.0-beta.3

2

js/source-map/index.js

@@ -72,3 +72,3 @@ 'use strict'

}
return { path: filename, line }
return { path: filename, line, column }
}

@@ -75,0 +75,0 @@

@@ -85,17 +85,40 @@ const { getSourcePathAndLineFromSourceMaps } = require('../source-map')

}
return error.stack
.split('\n')
.map((stackFrame) => {
const start = stackFrame.indexOf('(/')
if (start > -1) {
const end = stackFrame.indexOf(')')
const interesting = stackFrame.substring(start, end)
const [filename, originalLine, originalColumn] = interesting.split(':')
const { path, line, column } = getSourcePathAndLineFromSourceMaps(filename, originalLine, originalColumn)
const startPart = stackFrame.substring(0, start)
const endPart = stackFrame.substring(end)
return `${startPart}${path}:${line}:${column}${endPart}`
} else {
const stackLines = error.stack.split('\n')
let firstIndex = -1
for (let i = 0; i < stackLines.length; i++) {
if (stackLines[i].match(/^\s*at/gm)) {
firstIndex = i
break
}
}
return stackLines
.map((stackFrame, index) => {
if (index < firstIndex) {
return stackFrame
}
index = index - firstIndex
const stackTraceItem = structuredStackTrace[index]
if (!stackTraceItem) {
return stackFrame
}
let filename = stackTraceItem.getFileName()
let originalLine = stackTraceItem.getLineNumber()
let originalColumn = stackTraceItem.getColumnNumber()
if (stackTraceItem.isEval()) {
const evalOrigin = stackTraceItem.getEvalOrigin()
const evalRegex = /.*\(((?:.:[/\\]?)?[/\\].*):(\d*):(\d*)\)/g
const evalData = evalRegex.exec(evalOrigin)
if (evalData) {
filename = evalData[1]
originalLine = evalData[2]
originalColumn = evalData[3]
} else {
return stackFrame
}
}
const { path, line, column } = getSourcePathAndLineFromSourceMaps(filename, originalLine, originalColumn)
if (path !== filename || line !== originalLine || column !== originalColumn) {
return stackFrame.replace(`${filename}:${originalLine}:${originalColumn}`, `${path}:${line}:${column}`)
}
return stackFrame
})

@@ -102,0 +125,0 @@ .join('\n')

{
"name": "@datadog/native-iast-rewriter",
"homepage": "https://github.com/DataDog/dd-native-iast-rewriter-js/blob/main/README.md",
"version": "0.1.0-beta.2",
"version": "0.1.0-beta.3",
"description": "Datadog IAST instrumentation addon for NodeJS",

@@ -94,4 +94,5 @@ "main": "main.js",

"version": "napi version",
"test": "cross-env DD_LOCAL_VAR_NAME_HASH=test mocha --file 'test/setup.js'",
"test:junit": "cross-env DD_LOCAL_VAR_NAME_HASH=test mocha --file 'test/setup.js' --reporter mocha-junit-reporter --reporter-options mochaFile=./build/junit.xml",
"test": "cross-env DD_LOCAL_VAR_NAME_HASH=test mocha --file 'test/setup.js' test/**/*.spec.js",
"test:junit": "cross-env DD_LOCAL_VAR_NAME_HASH=test mocha --file 'test/setup.js' --reporter mocha-junit-reporter --reporter-options mochaFile=./build/junit.xml test/**/*.spec.js",
"test:integration": "cross-env DD_LOCAL_VAR_NAME_HASH=test mocha --file 'integration-test/setup.js' --reporter mocha-junit-reporter --reporter-options mochaFile=./build/junit-integration.xml integration-test/**/*.spec.js",
"prepare": "husky install",

@@ -98,0 +99,0 @@ "clippy": "cargo clippy --workspace -- -D warnings"

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