Git Product home page Git Product logo

Comments (6)

DavidBakerEffendi avatar DavidBakerEffendi commented on August 24, 2024 5

Hi @chengkenyong, congrats! So the simplest would be to have a look at how javasrc2cpg tests a similar structure, and to check using something like dotAst/dotCfg/dotDdg to determine what the differences are. My guess is, usually the equivalent data-flow is supported in Java, but that the resulting AST in C# might be a bit off and need adjusting in order to produce the same CFG/DDG that will eventually give you your flow. If your finding isn't obvious, feel free to post the comparison in this thread and I can continue to guide you

from joern.

DavidBakerEffendi avatar DavidBakerEffendi commented on August 24, 2024 4

Hi @chengkenyong, development of C# frontend has been largely funded by Privado, but they have since scaled it back a bit due to priorities on other languages. The C# frontend relies on two components (1) the Roslyn parser wrapped in a neat binary which can be found here https://github.com/joernio/DotNetAstGen, and (2) the AstCreation in Joern.

For the missing AST features you've described, it could be that they need to be filtered in on the parser. So that change would be in DotNetAstGen. One way to check is to create a JSON AST dump of the file you're interested in, and see if it is present.

If the entity is there, then it probably needs a handler in one of the classes within the astcreation package in csharpsrc2cpg.

Regarding type information, it is not uncommon for fieldAccess nodes to not have type info, especially if the receiver is an object, since this might have multiple types in the case of polymorphism. This may require a bit more of a "dynamic" query that looks at the fieldAccess.argument(1).evalType.baseTypeDeclTransitive step to find all possible types, and then determine which of those types have members matching the canonicalName of the fieldIdentifier.

from joern.

chengkenyong avatar chengkenyong commented on August 24, 2024

Hi @DavidBakerEffendi , Your explanation has been very helpful to me, and I will follow your advice to learn more about the relevant topics. Thank you for your assistance.

from joern.

chengkenyong avatar chengkenyong commented on August 24, 2024

Hi @DavidBakerEffendi ,Based on your suggestion, I have restored the missing type of the fieldAccess node to the desired state in the first case. However, I am still unclear about how to address the third case of missing data flow. Specifically, I want to restore the data flow in the third case where the variable childSqlMapSource cannot reach sqlMapPath through the foreach loop. Could you please provide me with some more advice on how to achieve this? Thank you!

from joern.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.