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

[Bug][Python] Fail to import CPG via Joern command line option #4999

Open
UESuperGate opened this issue Oct 13, 2024 · 0 comments
Open

[Bug][Python] Fail to import CPG via Joern command line option #4999

UESuperGate opened this issue Oct 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@UESuperGate
Copy link

Describe the bug
After saving and exiting the current Joern work context, a cpg.bin is generated under the project's work directory. However, I failed to get the cpg details using joern <path_to_cpg_bin> to reload the cpg file. Typing cpg to Joern's console reports error. This fails on Python but works fine on Java and C/C++.

To Reproduce

poc.py

# (c) 2012-2014, Michael DeHaan <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
__version__ = '1.6'
__author__ = 'Michael DeHaan'

Steps to reproduce the behavior:

  1. Open the Joern's console via joern
  2. Import the above poc.py to this work context via importCode("poc.py", "test")
  3. Enter ctrl+d to save & exit in Ubuntu.
  4. Import the saved cpg file via joern ./workspace/test/cpg.bin.
  5. Type cpg.all.l and see error report.

Expected behavior
cpg.all.l will print out all the nodes in the cpg.

Screenshots
image

Desktop (please complete the following information):

  • OS Ubuntu 22.04
  • Joern Version 4.0.98
  • Java version openJDK 17.0.11
@UESuperGate UESuperGate added the bug Something isn't working label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant