From 732af3ee339bdfe83f468b10410d19f0cdb1c5e8 Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Mon, 29 Apr 2024 16:06:52 +0100 Subject: [PATCH] Tag the call nodes directly for python Signed-off-by: Prabhu Subramanian --- build.sbt | 2 +- codemeta.json | 2 +- meta.yaml | 2 +- .../x2cpg/passes/taggers/CdxPass.scala | 20 ++++++++++--------- pyproject.toml | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/build.sbt b/build.sbt index 4979a451..fc3dd603 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "chen" ThisBuild / organization := "io.appthreat" -ThisBuild / version := "2.0.9" +ThisBuild / version := "2.0.10" ThisBuild / scalaVersion := "3.4.1" val cpgVersion = "1.0.0" diff --git a/codemeta.json b/codemeta.json index 5f47541a..90bee3cc 100644 --- a/codemeta.json +++ b/codemeta.json @@ -7,7 +7,7 @@ "downloadUrl": "https://github.com/AppThreat/chen", "issueTracker": "https://github.com/AppThreat/chen/issues", "name": "chen", - "version": "2.0.9", + "version": "2.0.10", "description": "Code Hierarchy Exploration Net (chen) is an advanced exploration toolkit for your application source code and its dependency hierarchy.", "applicationCategory": "code-analysis", "keywords": [ diff --git a/meta.yaml b/meta.yaml index e79c90f5..bfec0368 100644 --- a/meta.yaml +++ b/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "2.0.9" %} +{% set version = "2.0.10" %} package: name: chen diff --git a/platform/frontends/x2cpg/src/main/scala/io/appthreat/x2cpg/passes/taggers/CdxPass.scala b/platform/frontends/x2cpg/src/main/scala/io/appthreat/x2cpg/passes/taggers/CdxPass.scala index be904202..8d8e665d 100644 --- a/platform/frontends/x2cpg/src/main/scala/io/appthreat/x2cpg/passes/taggers/CdxPass.scala +++ b/platform/frontends/x2cpg/src/main/scala/io/appthreat/x2cpg/passes/taggers/CdxPass.scala @@ -110,15 +110,17 @@ class CdxPass(atom: Cpg) extends CpgPass(atom): pkgName.replace("django_", ""), pkgName.replace("py", "") ).foreach { ns => - val bpkg = toPyModuleForm(ns) - if bpkg.nonEmpty && !donePkgs.contains(bpkg) then - donePkgs.put(bpkg, true) - atom.call.where( - _.methodFullName(bpkg) - ).argument.newTagNode(compPurl).store()(dstGraph) - atom.identifier.typeFullName(bpkg).newTagNode( - compPurl - ).store()(dstGraph) + Set(toPyModuleForm(ns), s"$ns${Pattern.quote(File.separator)}.*").foreach { + bpkg => + if bpkg.nonEmpty && !donePkgs.contains(bpkg) then + donePkgs.put(bpkg, true) + atom.call.where( + _.methodFullName(bpkg) + ).newTagNode(compPurl).store()(dstGraph) + atom.identifier.typeFullName(bpkg).newTagNode( + compPurl + ).store()(dstGraph) + } } end if val properties = comp.hcursor.downField("properties").focus.flatMap( diff --git a/pyproject.toml b/pyproject.toml index 68b39a94..e4bf4c1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "appthreat-chen" -version = "2.0.9" +version = "2.0.10" description = "Code Hierarchy Exploration Net (chen)" authors = ["Team AppThreat "] license = "Apache-2.0"