joern icon indicating copy to clipboard operation
joern copied to clipboard

[Bug] Running ast gen failed?

Open chejn opened this issue 1 year ago • 5 comments

Describe the bug image in Docker dev container - java

chejn avatar Feb 15 '24 13:02 chejn

There might be something wrong with the docker container setup there. @mpollmeier Who would be the right person to ask?

max-leuthaeuser avatar Feb 15 '24 16:02 max-leuthaeuser

Hmm, the docker dev container was a user contribution back in 2022... https://github.com/joernio/joern/blob/master/.devcontainer/Dockerfile

We're building a few other images (see e.g. https://github.com/joernio/joern/actions/runs/7927654583/job/21644420193), can you give those a try?

mpollmeier avatar Feb 16 '24 09:02 mpollmeier

Hmm, the docker dev container was a user contribution back in 2022...

https://github.com/joernio/joern/blob/master/.devcontainer/Dockerfile

We're building a few other images (see e.g. https://github.com/joernio/joern/actions/runs/7927654583/job/21644420193), can you give those a try?

Sorry i didnt mean the joern container, i'm building and running inside a docker devcontainer from vscode/msft

chejn avatar Feb 16 '24 13:02 chejn

How did you install the joern distribution in your docker container? Something like this: https://github.com/joernio/joern/blob/master/ci/Dockerfile.alma?

max-leuthaeuser avatar Feb 16 '24 13:02 max-leuthaeuser

How did you install the joern distribution in your docker container?

Something like this: https://github.com/joernio/joern/blob/master/ci/Dockerfile.alma?

mkdir joern && cd joern # optional curl -L "https://github.com/joernio/joern/releases/latest/download/joern-install.sh" -o joern-install.sh chmod u+x joern-install.sh ./joern-install.sh --interactive

Just this, fyi golang works for me just not js :(

chejn avatar Feb 16 '24 13:02 chejn

I'm now building from source in github codespaces and getting the same issue

chejn avatar Feb 18 '24 11:02 chejn

I just downloaded https://github.com/joernio/joern/releases/latest/download/joern-cli.zip, unzipped it and ran ./joern. Importing js code just worked fine.

@mpollmeier Maybe there is something wrong with the install script? Can't test it on Linux right now.

max-leuthaeuser avatar Feb 18 '24 12:02 max-leuthaeuser

So importCode.jssrc.fromString appears to work still not the cli, quite lost :( image

chejn avatar Feb 19 '24 10:02 chejn

Also please note: There are certain ignore patterns for folders and files:

  1. https://github.com/joernio/joern/blob/master/joern-cli/frontends/jssrc2cpg/src/main/scala/io/joern/jssrc2cpg/utils/AstGenRunner.scala
  2. https://github.com/joernio/astgen/blob/main/index.js

If your js files and folders are named like that, they wont be scanned at all.

max-leuthaeuser avatar Feb 21 '24 10:02 max-leuthaeuser

ok found the issue, it was cause i was passing a path to a file and not a dir.

chejn avatar Feb 21 '24 12:02 chejn