Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python semantic generator #596

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
eeb49c9
removed html parser
May 1, 2023
b7b7647
renamed SemanticGenerator to JavaSemanticGenerator
May 2, 2023
8cc8b3c
resolved conflict
May 2, 2023
9880152
added python semantic support
May 2, 2023
d09a4f6
commented html parser
May 2, 2023
856ef56
commented html parser
May 2, 2023
ab0becf
Merge branch 'removed_html_tagger' into python_semantic_generator
hiteshbedre May 2, 2023
ed94b8f
added html parser
May 2, 2023
5a1171a
Merge branch 'dev' into python_semantic_generator
hiteshbedre May 3, 2023
8dc09ef
added n-> -1 semantic
May 4, 2023
5b1800c
Merge branch 'dev' of https://github.com/Privado-Inc/privado-core int…
khemrajrathore May 4, 2023
432b23d
python sink semantic
khemrajrathore May 4, 2023
3cc4208
removed println
khemrajrathore May 4, 2023
aaa3464
updated semantic
khemrajrathore May 5, 2023
0f4519a
python - apply sink semantic only on leakage till the issue reported …
khemrajrathore May 8, 2023
48a3ddc
Merge branch 'dev' of https://github.com/Privado-Inc/privado-core int…
khemrajrathore May 8, 2023
b3d259c
Merge branch 'dev' of https://github.com/Privado-Inc/privado-core int…
khemrajrathore May 15, 2023
fcd619a
support for named argument
khemrajrathore May 16, 2023
a870ce8
Merge branch 'dev' of https://github.com/Privado-Inc/privado-core int…
khemrajrathore Jun 1, 2023
294cc28
named and length of arguments, used to generate semantic
khemrajrathore Jun 1, 2023
218c0e9
add - take the amalgation of all flows for a signature when generatin…
khemrajrathore Jun 1, 2023
63c941b
added test case
khemrajrathore Jun 1, 2023
d3ff4c3
test failing
khemrajrathore Jun 1, 2023
30e2802
added afterall
khemrajrathore Jun 1, 2023
0854ab9
Merge branch 'dev' of https://github.com/Privado-Inc/privado-core int…
khemrajrathore Jun 15, 2023
d508fed
fix - updated semantic for named argument
khemrajrathore Jun 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ object PythonSemanticGenerator extends SemanticGenerator {
val parameterSemantic = mutable.HashSet[String]()

namedArgumentList.map { item =>
if (toTaint != -2)
parameterSemantic.add(s"$item->$toTaint")
// if (toTaint != -2)
// parameterSemantic.add(s"$item->$toTaint")
parameterSemantic.add(s"$item->$item")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ package ai.privado.languageEngine.python
import ai.privado.languageEngine.python.passes.PrivadoPythonTypeHintCallLinker
import better.files.File
import io.joern.dataflowengineoss.layers.dataflows.{OssDataFlow, OssDataFlowOptions}
import io.joern.pysrc2cpg._
import io.joern.pysrc2cpg.{
ImportsPass,
Py2CpgOnFileSystem,
Py2CpgOnFileSystemConfig,
PythonInheritanceNamePass,
PythonTypeRecoveryPass
}
import io.joern.x2cpg.X2Cpg
import io.joern.x2cpg.passes.base.AstLinkerPass
import io.joern.x2cpg.passes.callgraph.NaiveCallLinker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PythonSemanticGeneratorTest extends AnyWordSpec with Matchers with BeforeA
generateSemanticForTaint(
cpg.call("post").head,
-1
).flow shouldBe "0->-1 0->0 1->-1 1->1 2->-1 2->2 3->-1 3->3 \"body\"->\"body\" \"body\"->-1 \"url\"->\"url\" \"url\"->-1"
).flow shouldBe "0->-1 0->0 1->-1 1->1 2->-1 2->2 3->-1 3->3 \"body\"->\"body\" \"url\"->\"url\""
}

"generate semantic for non-named argument" in {
Expand Down