question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mismatch methods in graph-for-funcs.sc, may need update?

See original GitHub issue

Hi Dear Author,

Here is a issue about running graph-for-funcs.sc. There seems to have a lot of changes on joern methods and scalars, thus I try to modify your code to fit into the most recent one, however, here are two problems that cannot be solved yet whatever I try. Both are about the lacking methods in io.shiftleft.semanticcpg.language.NodeSteps. I checked the official repository (https://github.com/ShiftLeftSecurity/codepropertygraph) and go to codepropertygraph/semanticcpg/src/main/scala/io/shiftleft/semanticcpg/language/NodeSteps.scala, but cannot find correct methods for these two errors in line-93 and 94. Your help would be necessary for that. Thanks!

Compiling /home/zxx5113/devign/joern/graph-for-funcs.sc
graph-for-funcs.sc:93: value evalType is not a member of io.shiftleft.semanticcpg.language.NodeSteps[io.shiftleft.codepropertygraph.generated.nodes.Local]
      val sink = local.evalType(".*").referencingIdentifiers.dedup
                       ^
graph-for-funcs.sc:94: value nameNot is not a member of io.shiftleft.semanticcpg.language.NodeSteps[io.shiftleft.codepropertygraph.generated.nodes.Call]
      val source = new NodeSteps(methodVertex.out(EdgeTypes.CONTAINS).hasLabel(NodeTypes.CALL).cast[nodes.Call]).nameNot("<operator>.*").dedup
                                                                                                                 ^
java.lang.RuntimeException: Compilation Failed
  io.shiftleft.console.scripting.AmmoniteExecutor.$anonfun$runScript$7(AmmoniteExecutor.scala:50)
  cats.effect.internals.IORunLoop$.liftedTree3$1(IORunLoop.scala:229)
  cats.effect.internals.IORunLoop$.step(IORunLoop.scala:229)
  cats.effect.IO.unsafeRunTimed(IO.scala:320)
  cats.effect.IO.unsafeRunSync(IO.scala:239)
  io.shiftleft.console.scripting.ScriptManager.runScript(ScriptManager.scala:130)
  io.shiftleft.console.scripting.ScriptManager$CpgScriptRunner.runScript(ScriptManager.scala:64)
  io.shiftleft.console.scripting.ScriptManager$CpgScriptRunner.runScript(ScriptManager.scala:54)
  ammonite.$sess.cmd4$.<clinit>(cmd4.sc:1)

Bye!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21

github_iconTop GitHub Comments

2reactions
txg666commented, Dec 24, 2021

I had met many different errors when running the graph-for-funcs.sc with different versions of Joern, such as “Mismatch methods…”,“could not find implicit value for parameter encoder:…” and so on. So, I finally found that the version of Joern with 1.0.170 works fine!

0reactions
Vinothini-Gcommented, May 26, 2022

Hi @epicosy , I have modified the scala script a little bit and now it works with the latest version of Joern. Do you want me to submit a commit?

Hi @nimasteryang , Would you mind sending me one? It would be great helpful.

Hi, here is the script, this script is tested and work with Joern V1.1.172 (use --interactive to select specific install version when install joern). One problem is sometime this script can’t give PDG. graph-for-funcs.txt

I am facing the following issue with your graphs-for-funcs.txt. Do you have any suggestions?

/home/faysal/bin/joern/graph-for-funcs.sc:29: object CfgNode is not a member of package io.shiftleft.semanticcpg.language.types.expressions.generalizations
import io.shiftleft.semanticcpg.language.types.expressions.generalizations.CfgNode
       ^
/home/faysal/bin/joern/graph-for-funcs.sc:33: object dataflowengineoss is not a member of package io.shiftleft
import io.shiftleft.dataflowengineoss.language._
                    ^
/home/faysal/bin/joern/graph-for-funcs.sc:35: object Call is not a member of package io.shiftleft.semanticcpg.language.types.expressions
import io.shiftleft.semanticcpg.language.types.expressions.Call
       ^
/home/faysal/bin/joern/graph-for-funcs.sc:36: object Local is not a member of package io.shiftleft.semanticcpg.language.types.structure
import io.shiftleft.semanticcpg.language.types.structure.Local
       ^
/home/faysal/bin/joern/graph-for-funcs.sc:50: not found: type OdbEdge
implicit val encodeEdge: Encoder[OdbEdge] =
                                 ^
/home/faysal/bin/joern/graph-for-funcs.sc:51: not found: type OdbEdge
  (edge: OdbEdge) =>
         ^
/home/faysal/bin/joern/graph-for-funcs.sc:63: could not find implicit value for parameter encoder: io.circe.Encoder[overflowdb.Edge]
        Json.fromValues((node.inE("AST", "CFG").l ++ node.outE("AST", "CFG").l).map(_.asJson))),
                                                                                      ^
/home/faysal/bin/joern/graph-for-funcs.sc:64: value propertyMap is not a member of io.shiftleft.codepropertygraph.generated.nodes.AstNode
      ("properties", Json.fromValues(node.propertyMap.asScala.toList.map { case (key, value) =>
                                          ^
/home/faysal/bin/joern/graph-for-funcs.sc:66: type mismatch;
 found   : Any
 required: String
          ("key", Json.fromString(key)),
                                  ^
/home/faysal/bin/joern/graph-for-funcs.sc:81: not found: type Vertex
      val methodVertex: Vertex = method //TODO MP drop as soon as we have the remainder of the below in ODB graph api
                        ^
java.lang.RuntimeException: Compilation Failed
  io.joern.console.scripting.AmmoniteExecutor.$anonfun$runScript$7(AmmoniteExecutor.scala:59)
  io.joern.console.scripting.AmmoniteExecutor$$Lambda$1894/0x0000000000000000.apply(Unknown Source)
  map @ io.joern.console.scripting.AmmoniteExecutor.$anonfun$runScript$7(AmmoniteExecutor.scala:56)
  apply @ io.joern.console.scripting.AmmoniteExecutor.$anonfun$runScript$5(AmmoniteExecutor.scala:47)
  flatMap @ io.joern.console.scripting.AmmoniteExecutor.$anonfun$runScript$5(AmmoniteExecutor.scala:47)
  flatMap @ io.joern.console.scripting.AmmoniteExecutor.$anonfun$runScript$3(AmmoniteExecutor.scala:46)
  apply @ io.joern.console.scripting.AmmoniteExecutor.runScript(AmmoniteExecutor.scala:45)
  flatMap @ io.joern.console.scripting.AmmoniteExecutor.runScript(AmmoniteExecutor.scala:45)

I’m facing the same problem with the latest version. Has anyone resolved it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Inspection: Mismatched query and update of collection
Reports a collection of fields or variables whose contents are either queried and not updated or updated and not queried. Such mismatched ......
Read more >
How to Fix a Schema Mismatch When Updating Data
Select "Save." Publish your update ! From now on, Data & Insights will remember that the column named 'Surname' in your source file...
Read more >
Code Inspection: Mismatched query and update of collection
Use the tables below to specify which methods are update and/or query methods.The names are matched with the beginning of the method name.Query ......
Read more >
You receive a VBScript "Type Mismatch" script error message ...
This issue occurs after you install security update 974455 (MS09-054) for IE. ... showModelessDialog() methods may encounter a "Type Mismatch" script error.
Read more >
City of Charleston Coronavirus Updates
A full outline of Phase 3 and its corresponding protocols can be found here: http://innovate.charleston-sc.gov/covid/reignite/matrix.htm.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found