Skip to content

Commit

Permalink
Fix/chennai tags windows compat (#81)
Browse files Browse the repository at this point in the history
* Improve windows compat

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

* Updated couple of packages

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

* Tweaks

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

---------

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu authored Jul 6, 2024
1 parent 135cd29 commit 6e61532
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Release Anaconda
if: startsWith(github.ref, 'refs/tags/')
run: |
anaconda upload --label main -u appthreat /tmp/conda-out/noarch/*.tar.bz2
$CONDA/bin/anaconda upload --label main -u appthreat /tmp/conda-out/noarch/*.tar.bz2
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
continue-on-error: true
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ This error is mostly due to missing python .so (linux), .dll (windows) or .dylib
chen is a fork of the popular [joern](https://github.com/joernio/joern) project. We deviate from the joern project in the following ways:
- Keep the CPG implementation at 1.0 based on the original paper.
- Make code analysis accessible by adding first-class integration with Python and frameworks such as NetworkX and PyTorch.
- Enable broader hierarchical analysis (Application + Dependency + Container + OS layer)
- By creating a welcoming community more appropriate for beginner users with great enterprise support. We want to democratize code analysis.
- Enable broader hierarchical analysis (Application + Dependency + Container + OS layer + Cloud + beyond)
We don't intend for bug-to-bug compatibility and often rewrite patches to suit our needs. We also do not bring features and passes that do not add value for hierarchical analysis.
Expand All @@ -202,7 +202,7 @@ Apache-2.0
## Enterprise support
Enterprise support including custom language development and integration services is available via AppThreat Ltd. Free community support is also available via [Discord](https://discord.gg/UD4sHgbXYr).
Enterprise support including custom language development and integration services is available via AppThreat Ltd.
## Sponsors
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "chen"
ThisBuild / organization := "io.appthreat"
ThisBuild / version := "2.1.1"
ThisBuild / version := "2.1.2"
ThisBuild / scalaVersion := "3.4.2"

val cpgVersion = "1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"downloadUrl": "https://github.com/AppThreat/chen",
"issueTracker": "https://github.com/AppThreat/chen/issues",
"name": "chen",
"version": "2.1.1",
"version": "2.1.2",
"description": "Code Hierarchy Exploration Net (chen) is an advanced exploration toolkit for your application source code and its dependency hierarchy.",
"applicationCategory": "code-analysis",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions console/src/main/scala/io/appthreat/console/Console.scala
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ class Console[T <: Project](
tree: Boolean = false,
as_text: Boolean = false
): String =
if tree then
if tree || includeCalls then
val rootTree = richTreeLib.Tree(title, highlight = true)
atom.file.whereNot(_.name("<(unknown|includes)>")).foreach { f =>
val childTree = richTreeLib.Tree(f.name, highlight = true)
Expand Down Expand Up @@ -652,7 +652,7 @@ class Console[T <: Project](
val dec: Set[Declaration] =
(f.assignment.argument(1).filterNot(
_.code == "this"
).isIdentifier.refsTo ++ f.method.parameter
).isIdentifier.nameNot("tmp[0-9]+$").refsTo ++ f.method.parameter
.filterNot(_.code == "this")
.filter(_.typeFullName != "ANY")).toSet
table.add_row(f.name, dec.name.toSet.mkString("\n"))
Expand Down
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "2.1.1" %}
{% set version = "2.1.2" %}

package:
name: chen
Expand Down
2 changes: 1 addition & 1 deletion platform/frontends/c2cpg/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ libraryDependencies ++= Seq(
ExclusionRule(organization = "org.eclipse.platform", name = "org.eclipse.jface"),
ExclusionRule(organization = "org.eclipse.platform", name = "org.eclipse.jface.text")
),
"org.jline" % "jline" % "3.26.1",
"org.jline" % "jline" % "3.26.2",
"org.scalatest" %% "scalatest" % Versions.scalatest % Test
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package io.appthreat.c2cpg.passes
import io.appthreat.c2cpg.Config
import io.appthreat.c2cpg.astcreation.AstCreator
import io.appthreat.c2cpg.parser.{CdtParser, FileDefaults}
import io.appthreat.c2cpg.utils.{Report, TimeUtils}
import io.appthreat.c2cpg.utils.Report
import io.appthreat.x2cpg.SourceFiles
import io.shiftleft.codepropertygraph.Cpg
import io.shiftleft.passes.ConcurrentWriterCpgPass
import io.appthreat.x2cpg.SourceFiles

import java.nio.file.Paths
import java.util.concurrent.ConcurrentHashMap
Expand Down
2 changes: 1 addition & 1 deletion platform/frontends/jssrc2cpg/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ astGenVersion := appProperties.value.getString("jssrc2cpg.astgen_version")
libraryDependencies ++= Seq(
"io.appthreat" %% "cpg2" % Versions.cpg,
"com.lihaoyi" %% "upickle" % Versions.upickle,
"com.fasterxml.jackson.core" % "jackson-databind" % "2.17.1",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.17.2",
"com.typesafe" % "config" % "1.4.3",
"com.michaelpollmeier" % "versionsort" % "1.0.11",
"org.scalatest" %% "scalatest" % Versions.scalatest % Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ import java.util.regex.Pattern
*/
class ChennaiTagsPass(atom: Cpg) extends CpgPass(atom):

val language: String = atom.metaData.language.head
private val FRAMEWORK_ROUTE = "framework-route"
private val FRAMEWORK_INPUT = "framework-input"
private val FRAMEWORK_OUTPUT = "framework-output"
val language: String = atom.metaData.language.head
private val FRAMEWORK_ROUTE = "framework-route"
private val FRAMEWORK_INPUT = "framework-input"
private val FRAMEWORK_OUTPUT = "framework-output"
private val EscapedFileSeparator = Pattern.quote(java.io.File.separator)

private val PYTHON_ROUTES_CALL_REGEXES =
Array(
"django/(conf/)?urls.py:<module>.(path|re_path|url).*",
".*(route|web\\.|add_resource).*"
s"django$EscapedFileSeparator(conf$EscapedFileSeparator)?urls.py:<module>.(path|re_path|url).*".r,
".*(route|web\\.|add_resource).*".r
)

private def C_ROUTES_CALL_REGEXES = Array(
Expand Down Expand Up @@ -69,7 +70,7 @@ class ChennaiTagsPass(atom: Cpg) extends CpgPass(atom):
private def tagPythonRoutes(dstGraph: DiffGraphBuilder): Unit =
PYTHON_ROUTES_CALL_REGEXES.foreach { r =>
atom.call
.where(_.methodFullName(r))
.where(_.methodFullName(r.toString()))
.argument
.isLiteral
.newTagNode(FRAMEWORK_ROUTE)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "appthreat-chen"
version = "2.1.1"
version = "2.1.2"
description = "Code Hierarchy Exploration Net (chen)"
authors = ["Team AppThreat <cloud@appthreat.com>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 6e61532

Please sign in to comment.