Skip to content

Commit

Permalink
Revert "Upgrade iast rewriter to 2.5.0 (#4761)"
Browse files Browse the repository at this point in the history
This reverts commit 6459067.
  • Loading branch information
iunanua committed Oct 21, 2024
1 parent 2de07fc commit f929bfb
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
"dependencies": {
"@datadog/native-appsec": "8.1.1",
"@datadog/native-iast-rewriter": "2.5.0",
"@datadog/native-iast-rewriter": "2.4.1",
"@datadog/native-iast-taint-tracking": "3.1.0",
"@datadog/native-metrics": "^2.0.0",
"@datadog/pprof": "5.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const csiMethods = [
{ src: 'substring' },
{ src: 'toLowerCase', dst: 'stringCase' },
{ src: 'toUpperCase', dst: 'stringCase' },
{ src: 'tplOperator', operator: true },
{ src: 'trim' },
{ src: 'trimEnd' },
{ src: 'trimStart', dst: 'trim' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const TaintTrackingNoop = {
substr: noop,
substring: noop,
stringCase: noop,
tplOperator: noop,
trim: noop,
trimEnd: noop
}
Expand Down Expand Up @@ -118,20 +117,6 @@ function csiMethodsOverrides (getContext) {
return res
},

tplOperator: function (res, ...rest) {
try {
const iastContext = getContext()
const transactionId = getTransactionId(iastContext)
if (transactionId) {
return TaintedUtils.concat(transactionId, res, ...rest)
}
} catch (e) {
iastLog.error('Error invoking CSI tplOperator')
.errorAndPublish(e)
}
return res
},

stringCase: getCsiFn(
(transactionId, res, target) => TaintedUtils.stringCase(transactionId, res, target),
getContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ function templateLiteralEndingWithNumberParams (str) {
return `${str}Literal${num1}${num2}`
}

function templateLiteralWithTaintedAtTheEnd (str) {
const num1 = 1
const num2 = 2
const hello = 'world'
return `Literal${num1}${num2}-${hello}-${str}`
}

function appendStr (str) {
let pre = 'pre_'
pre += str
Expand Down Expand Up @@ -115,7 +108,6 @@ module.exports = {
substrStr,
substringStr,
templateLiteralEndingWithNumberParams,
templateLiteralWithTaintedAtTheEnd,
toLowerCaseStr,
toUpperCaseStr,
trimEndStr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const propagationFns = [
'substrStr',
'substringStr',
'templateLiteralEndingWithNumberParams',
'templateLiteralWithTaintedAtTheEnd',
'toLowerCaseStr',
'toUpperCaseStr',
'trimEndStr',
Expand Down Expand Up @@ -138,8 +137,7 @@ describe('TaintTracking', () => {
'concatSuffix',
'concatTaintedStr',
'insertStr',
'templateLiteralEndingWithNumberParams',
'templateLiteralWithTaintedAtTheEnd'
'templateLiteralEndingWithNumberParams'
]
propagationFns.forEach((propFn) => {
if (filtered.includes(propFn)) return
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@
dependencies:
node-gyp-build "^3.9.0"

"@datadog/native-iast-rewriter@2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@datadog/native-iast-rewriter/-/native-iast-rewriter-2.5.0.tgz#b613defe86e78168f750d1f1662d4ffb3cf002e6"
integrity sha512-WRu34A3Wwp6oafX8KWNAbedtDaaJO+nzfYQht7pcJKjyC2ggfPeF7SoP+eDo9wTn4/nQwEOscSR4hkJqTRlpXQ==
"@datadog/native-iast-rewriter@2.4.1":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@datadog/native-iast-rewriter/-/native-iast-rewriter-2.4.1.tgz#e8211f78c818906513fb96a549374da0382c7623"
integrity sha512-j3auTmyyn63e2y+SL28CGNy/l+jXQyh+pxqoGTacWaY5FW/dvo5nGQepAismgJ3qJ8VhQfVWRdxBSiT7wu9clw==
dependencies:
lru-cache "^7.14.0"
node-gyp-build "^4.5.0"
Expand Down

0 comments on commit f929bfb

Please sign in to comment.