Skip to content

Commit

Permalink
fix lint and naming issues
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasShabi committed Nov 4, 2024
1 parent 37742f0 commit 74e5177
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions packages/datadog-instrumentations/src/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ function wrapCompile (compile) {
if (handlebarsReadCh.hasSubscribers) {
handlebarsReadCh.publish({ source })
}

return compile.apply(this, arguments)
}
}

addHook({ name: 'handlebars', file: 'dist/cjs/handlebars/compiler/compiler.js', versions: ['>=4.0.0'] }, compiler => {
shimmer.wrap(compiler, 'compile', wrapCompile)
shimmer.wrap(compiler, 'precompile', wrapCompile)

return compiler
})
2 changes: 2 additions & 0 deletions packages/datadog-instrumentations/src/pug.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function wrapCompile (compile) {
if (pugReadCh.hasSubscribers) {
pugReadCh.publish({ source })
}

return compile.apply(this, arguments)
}
}
Expand All @@ -18,5 +19,6 @@ addHook({ name: 'pug', versions: ['>=2.0.4'] }, compiler => {
shimmer.wrap(compiler, 'compile', wrapCompile)
shimmer.wrap(compiler, 'compileClient', wrapCompile)
shimmer.wrap(compiler, 'compileClientWithDependenciesTracked', wrapCompile)

return compiler
})
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const vulnerabilities = require('../../vulnerabilities')

const { contains, intersects, remove } = require('./range-utils')

const injectionSensitiveAnalyzer = require('./sensitive-analyzers/injection-sensitive-analyzer')
const commandSensitiveAnalyzer = require('./sensitive-analyzers/command-sensitive-analyzer')
const hardcodedPasswordAnalyzer = require('./sensitive-analyzers/hardcoded-password-analyzer')
const headerSensitiveAnalyzer = require('./sensitive-analyzers/header-sensitive-analyzer')
const jsonSensitiveAnalyzer = require('./sensitive-analyzers/json-sensitive-analyzer')
const ldapSensitiveAnalyzer = require('./sensitive-analyzers/ldap-sensitive-analyzer')
const sqlSensitiveAnalyzer = require('./sensitive-analyzers/sql-sensitive-analyzer')
const injectionSensitiveAnalyzer = require('./sensitive-analyzers/tainted-range-based-sensitive-analyzer')
const urlSensitiveAnalyzer = require('./sensitive-analyzers/url-sensitive-analyzer')

const { DEFAULT_IAST_REDACTION_NAME_PATTERN, DEFAULT_IAST_REDACTION_VALUE_PATTERN } = require('./sensitive-regex')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ describe('template-injection-analyzer with handlebars', () => {
testThatRequestHasVulnerability(() => {
const store = storage.getStore()
const iastContext = iastContextFunctions.getIastContext(store)
const command = newTaintedString(iastContext, source, 'param', 'Request')
const template = lib.compile(command)
template()
const template = newTaintedString(iastContext, source, 'param', 'Request')
lib.compile(template)
}, 'TEMPLATE_INJECTION')

testThatRequestHasNoVulnerability(() => {
Expand All @@ -37,8 +36,8 @@ describe('template-injection-analyzer with handlebars', () => {
testThatRequestHasVulnerability(() => {
const store = storage.getStore()
const iastContext = iastContextFunctions.getIastContext(store)
const command = newTaintedString(iastContext, source, 'param', 'Request')
lib.precompile(command)
const template = newTaintedString(iastContext, source, 'param', 'Request')
lib.precompile(template)
}, 'TEMPLATE_INJECTION')

testThatRequestHasNoVulnerability(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ describe('template-injection-analyzer with pug', () => {
testThatRequestHasVulnerability(() => {
const store = storage.getStore()
const iastContext = iastContextFunctions.getIastContext(store)
const command = newTaintedString(iastContext, source, 'param', 'Request')
const template = lib.compile(command)
template()
const template = newTaintedString(iastContext, source, 'param', 'Request')
lib.compile(template)
}, 'TEMPLATE_INJECTION')

testThatRequestHasNoVulnerability(() => {
Expand All @@ -37,8 +36,8 @@ describe('template-injection-analyzer with pug', () => {
testThatRequestHasVulnerability(() => {
const store = storage.getStore()
const iastContext = iastContextFunctions.getIastContext(store)
const command = newTaintedString(iastContext, source, 'param', 'Request')
lib.compileClient(command)
const template = newTaintedString(iastContext, source, 'param', 'Request')
lib.compileClient(template)
}, 'TEMPLATE_INJECTION')

testThatRequestHasNoVulnerability(() => {
Expand All @@ -53,8 +52,8 @@ describe('template-injection-analyzer with pug', () => {
testThatRequestHasVulnerability(() => {
const store = storage.getStore()
const iastContext = iastContextFunctions.getIastContext(store)
const command = newTaintedString(iastContext, source, 'param', 'Request')
lib.compileClientWithDependenciesTracked(command, {})
const template = newTaintedString(iastContext, source, 'param', 'Request')
lib.compileClientWithDependenciesTracked(template, {})
}, 'TEMPLATE_INJECTION')

testThatRequestHasNoVulnerability(() => {
Expand Down

0 comments on commit 74e5177

Please sign in to comment.