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

block (2 levels) in get_options': undefined local variable or method path' for Glue::Options:Module (NameError) #176

Open
bc-venkata opened this issue Dec 18, 2019 · 11 comments
Labels

Comments

@bc-venkata
Copy link

bc-venkata commented Dec 18, 2019

Unable to run glue locally.

`$ glue -T report.json

/Library/Ruby/Gems/2.3.0/gems/owasp-glue-0.9.0/lib/glue/options.rb:49:in block (2 levels) in get_options': undefined local variable or method path' for Glue::Options:Module (NameError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/optparse.rb:1578:in block in parse_in_order' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/optparse.rb:1534:in catch'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/optparse.rb:1534:in parse_in_order' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/optparse.rb:1528:in order!'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/optparse.rb:1620:in permute!' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/optparse.rb:1642:in parse!'
from /Library/Ruby/Gems/2.3.0/gems/owasp-glue-0.9.0/lib/glue/options.rb:257:in get_options' from /Library/Ruby/Gems/2.3.0/gems/owasp-glue-0.9.0/lib/glue/options.rb:16:in parse!'
from /Library/Ruby/Gems/2.3.0/gems/owasp-glue-0.9.0/bin/glue:11:in <top (required)>' from /usr/local/bin/glue:22:in load'
from /usr/local/bin/glue:22:in `

'

$ `

@omerlh
Copy link
Collaborator

omerlh commented Dec 18, 2019

I tried and wasn't able to reproduce it locally. 0.9 is pretty old (my bad, we didn't pushed a new version to ruby gem for a while). Can you try either cloning the repo and running wiht ruby bin/glue or using docker?

@omerlh
Copy link
Collaborator

omerlh commented Dec 18, 2019

I just pushed 0.9.4 to GitHub packages - can you please try it out?

@bc-venkata
Copy link
Author

bc-venkata commented Dec 18, 2019

$ ruby bin/glue -t Dynamic -T report.json --mapping-file mobsf -z 2
Setting severity_threshold to 2
Logfile nil?
calling scan
Running scanner
Loading scanner...
Processing target...report.json
Running tasks in stage: wait
Running tasks in stage: mount
Running tasks in stage: file
Running tasks in stage: code
code - Dynamic - #Set:0x00007f8fd9c131b0
Invalid mappings JSON: ["The property '#/mappings/0/properties' did not contain a required property of 'source' in schema b9d9fa95-af34-55cd-827a-d1762791af40"]

@bc-venkata
Copy link
Author

Here is the mapping file that I used

{
"task_name": "MobSF",
"app_name": "app_name",
"mappings": [
{
"key": "manifest_analysis",
"properties": {
"description": "desc",
"detail": "title",
"source": "title",
"severity": "stat",
"fingerprint": "title"
},
"key": "findings",
"properties": {
"description": "cwe",
"detail": "path",
"severity": "level",
"fingerprint": "cwe"
}
}
]
}

@omerlh
Copy link
Collaborator

omerlh commented Dec 22, 2019

The alert is (maybe not enough) pretty seld explanatory - you are missing a required filed, source, on your second mapping (key=findings). Can you please try to add it?

@stale
Copy link

stale bot commented Feb 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 20, 2020
@valentin-muschici
Copy link

Hi Omer,
I´m facing the same issue. I created a container from the latest glue image and connected on it and when I´m running:

"ruby bin/glue -T report_scan.json --mapping-file mobsf -z 2"

I´m getting :
/home/glue/glue/lib/glue/options.rb:41:in block (2 levels) in get_options': undefined local variable or method path' for Glue::Options:Module (NameError)
from /home/glue/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/optparse.rb:1571:in block in parse_in_order' from /home/glue/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/optparse.rb:1527:in catch'
from /home/glue/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/optparse.rb:1527:in parse_in_order' from /home/glue/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/optparse.rb:1521:in order!'
from /home/glue/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/optparse.rb:1613:in permute!' from /home/glue/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/optparse.rb:1635:in parse!'
from /home/glue/glue/lib/glue/options.rb:356:in get_options' from /home/glue/glue/lib/glue/options.rb:16:in parse!'
from bin/glue:11:in `

'

The json file is copied in the glue folder. Running the command from /home/glue/glue. I have the latest 0.9.4 version. Any commands that I´m executing (with or without z parameter) gives me this error. It looks like by running with the docker command it works. Please support me on that.

@stale stale bot removed the stale label Jul 7, 2020
@valentin-muschici
Copy link

Did some further investigations:
I tried using the docker command. Same output.
docker run -it owasp/glue:latest ruby bin/glue -t Dynamic -T report_scan.json --mapping-file mobsf -z 2

I tried with the owasp/glue:raw-latest and with this one I cannot see the issue. So works.
docker run -it owasp/glue:raw-latest ruby bin/glue -t Dynamic -T report_scan.json --mapping-file mobsf -z 2

The issue with owasp/glue:raw-latest is that I cannot connect to the container created with this image. It gives me :

OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: "bash": executable file not found in $PATH": unknown
command terminated with exit code 126

@omerlh
Copy link
Collaborator

omerlh commented Jul 8, 2020

Yep, the raw-latests is the right one to use. It gives you this error because it is alpine based, so you need to use /bin/sh instead :)

@valentin-muschici
Copy link

Thanks Omer. I´ll give it a try.

@stale
Copy link

stale bot commented Sep 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants