Skip to content

Commit ab80745

Browse files
authored
Additional crypto libs for python (#73)
* Additional crypto libs Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Additional desc tags Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * Update eclipse cdt jar Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> --------- Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
1 parent 3221239 commit ab80745

File tree

8 files changed

+24
-8
lines changed

8 files changed

+24
-8
lines changed

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name := "chen"
22
ThisBuild / organization := "io.appthreat"
3-
ThisBuild / version := "2.0.10"
3+
ThisBuild / version := "2.0.11"
44
ThisBuild / scalaVersion := "3.4.1"
55

66
val cpgVersion = "1.0.0"

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"downloadUrl": "https://github.com/AppThreat/chen",
88
"issueTracker": "https://github.com/AppThreat/chen/issues",
99
"name": "chen",
10-
"version": "2.0.10",
10+
"version": "2.0.11",
1111
"description": "Code Hierarchy Exploration Net (chen) is an advanced exploration toolkit for your application source code and its dependency hierarchy.",
1212
"applicationCategory": "code-analysis",
1313
"keywords": [

meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% set version = "2.0.10" %}
1+
{% set version = "2.0.11" %}
22

33
package:
44
name: chen
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
org.eclipse.cdt jars were downloaded from
2+
3+
https://download.eclipse.org/tools/cdt/releases/11.5/cdt-11.5.0/plugins/

platform/frontends/x2cpg/src/main/scala/io/appthreat/x2cpg/passes/taggers/CdxPass.scala

+8
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,14 @@ class CdxPass(atom: Cpg) extends CpgPass(atom):
338338
atom.method.fullName(bpkg).newTagNode(t).store()(
339339
dstGraph
340340
)
341+
if language == Languages.PYTHON || language == Languages.PYTHONSRC
342+
then
343+
atom.call.where(
344+
_.methodFullName(bpkg)
345+
).newTagNode(t).store()(dstGraph)
346+
atom.identifier.typeFullName(bpkg).newTagNode(
347+
t
348+
).store()(dstGraph)
341349
}
342350
end if
343351
}

platform/frontends/x2cpg/src/main/scala/io/appthreat/x2cpg/passes/taggers/EasyTagsPass.scala

+9-4
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,20 @@ class EasyTagsPass(atom: Cpg) extends CpgPass(atom):
155155
).newTagNode("crypto-algorithm").store()(dstGraph)
156156
end if
157157
if language == Languages.PYTHON || language == Languages.PYTHONSRC then
158-
atom.identifier.typeFullName("cryptography.*").newTagNode("crypto").store()(dstGraph)
159-
atom.call.methodFullName("cryptography.*").newTagNode("crypto").store()(dstGraph)
158+
val known_crypto_libs = "(cryptography|Crypto|ecdsa|nacl).*"
159+
atom.identifier.typeFullName(known_crypto_libs).newTagNode(
160+
"crypto"
161+
).store()(dstGraph)
162+
atom.call.methodFullName(known_crypto_libs).newTagNode(
163+
"crypto"
164+
).store()(dstGraph)
160165
atom.call.methodFullName(
161-
"cryptography.*(generate|encrypt|decrypt|derive|sign|public_bytes|private_bytes|exchange).*"
166+
s"${known_crypto_libs}(generate|encrypt|decrypt|derive|sign|public_bytes|private_bytes|exchange|new|update|export_key|import_key|from_string|from_pem|to_pem).*"
162167
).newTagNode(
163168
"crypto-generate"
164169
).store()(dstGraph)
165170
atom.call.name("[A-Z0-9]+").methodFullName(
166-
"cryptography.*(primitives|serialization).*"
171+
s"${known_crypto_libs}(primitives|serialization).*"
167172
).argument.inCall.newTagNode(
168173
"crypto-algorithm"
169174
).store()(dstGraph)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "appthreat-chen"
3-
version = "2.0.10"
3+
version = "2.0.11"
44
description = "Code Hierarchy Exploration Net (chen)"
55
authors = ["Team AppThreat <cloud@appthreat.com>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)