Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu committed Jan 15, 2025
1 parent f9ac0e0 commit 03283c4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/scala/io/appthreat/atom/slicing/ReachableSlicing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,23 @@ object ReachableSlicing:
toSlice
).toList
if config.includeCryptoFlows then
if language == Languages.JAVA || language == Languages.JAVASRC then
if Array(Languages.JAVA, Languages.JAVASRC).contains(language) then
flowsList ++= atom.tag.name(CRYPTO_GENERATE_TAG).call.reachableByFlows(
atom.tag.name(CRYPTO_ALGORITHM_TAG).literal
).map(toSlice).toList
else if language == Languages.PYTHON || language == Languages.PYTHONSRC then
else if Array(Languages.PYTHON, Languages.PYTHONSRC).contains(language) then
flowsList ++= atom.tag.name(CRYPTO_GENERATE_TAG).call.reachableByFlows(
atom.tag.name(CRYPTO_ALGORITHM_TAG).call
).map(toSlice).toList
// For JavaScript and Python, we need flows between arguments of call nodes to track callbacks and middlewares
if
language == Languages.JSSRC || language == Languages.JAVASCRIPT || language == Languages
.PYTHON || language == Languages.PYTHONSRC || language == Languages.RUBYSRC
Array(
Languages.JSSRC,
Languages.JAVASCRIPT,
Languages.PYTHON,
Languages.PYTHONSRC,
Languages.RUBYSRC
).contains(language)
then
def dynCallSource = atom.tag.name(config.sourceTag).call.argument.isIdentifier
def dynFrameworkIdentifier = atom.tag.name(FRAMEWORK_TAG).identifier
Expand All @@ -80,7 +85,7 @@ object ReachableSlicing:
.reachableByFlows(sourceI, dynFrameworkIdentifier)
.map(toSlice)
.toList
if language == Languages.PYTHON || language == Languages.PYTHONSRC then
if Array(Languages.PYTHON, Languages.PYTHONSRC).contains(language) then
flowsList ++= atom.tag.name("pkg.*").identifier.reachableByFlows(
atom.tag.name(CLI_SOURCE_TAG).identifier
).map(toSlice).toList
Expand All @@ -89,7 +94,7 @@ object ReachableSlicing:
atom.tag.name(CLI_SOURCE_TAG).call
).map(toSlice).toList
end if
if language == Languages.PHP || language == Languages.RUBYSRC
if Array(Languages.PHP, Languages.RUBYSRC).contains(language)
then
flowsList ++= atom.ret.where(_.tag.name(config.sinkTag)).reachableByFlows(
atom.tag.name(config.sourceTag).parameter
Expand All @@ -113,7 +118,7 @@ object ReachableSlicing:
_.maxDepth(config.sliceDepth)
).parameter
).map(toSlice).toList
if language == Languages.NEWC || language == Languages.C
if Array(Languages.NEWC, Languages.C).contains(language)
then
flowsList ++= atom.tag.name(LIBRARY_CALL_TAG).call.reachableByFlows(atom.tag.name(
CLI_SOURCE_TAG
Expand Down

0 comments on commit 03283c4

Please sign in to comment.