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

can't convert Symbol into Integer (TypeError) on brakeman run #22

Closed
ocxo opened this issue Dec 19, 2011 · 9 comments
Closed

can't convert Symbol into Integer (TypeError) on brakeman run #22

ocxo opened this issue Dec 19, 2011 · 9 comments

Comments

@ocxo
Copy link

ocxo commented Dec 19, 2011

Haven't been able to successfully run brakeman. Encountered this problem using Rails 3.1.3 with Ruby 1.9.2-p180, 1.9.2-p290 and 1.9.3-p0

$ brakeman -o brakeman.txt
[Notice] Detected Rails 3 application. Enabling experimental Rails 3 support.
Loading scanner...
[Notice] Using Ruby 1.9.2. Please make sure this matches the one used to run your Rails application.
Processing application in /src/web
Processing configuration...
/.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/lib/rails3_config_processor.rb:73:in []=': can't convert Symbol into Integer (TypeError) from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/lib/rails3_config_processor.rb:73:inprocess_attrasgn'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:209:in block (2 levels) in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:261:inerror_handler'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:208:in block in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:326:inin_context'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:180:in process' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/base_processor.rb:113:inblock in process_block'
from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/base_processor.rb:112:in map!' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/base_processor.rb:112:inprocess_block'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:209:in block (2 levels) in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:261:inerror_handler'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:208:in block in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:326:inin_context'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:180:in process' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/lib/rails3_config_processor.rb:34:inprocess_iter'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:209:in block (2 levels) in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:261:inerror_handler'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:208:in block in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:326:inin_context'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:180:in process' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/base_processor.rb:113:inblock in process_block'
from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/base_processor.rb:112:in map!' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/base_processor.rb:112:inprocess_block'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:209:in block (2 levels) in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:261:inerror_handler'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:208:in block in process' from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:326:inin_context'
from /.rvm/gems/ruby-1.9.2-p290/gems/sexp_processor-3.0.9/lib/sexp_processor.rb:180:in process' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processors/lib/rails3_config_processor.rb:27:inprocess_config'
from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/processor.rb:23:in process_config' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/scanner.rb:80:inprocess_config'
from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman/scanner.rb:54:in process' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman.rb:207:inscan'
from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/lib/brakeman.rb:54:in run' from /.rvm/gems/ruby-1.9.2-p290/gems/brakeman-1.0.0/bin/brakeman:173:in<top (required)>'
from /.rvm/gems/ruby-1.9.2-p290/bin/brakeman:19:in load' from /.rvm/gems/ruby-1.9.2-p290/bin/brakeman:19:in

'

@presidentbeef
Copy link
Owner

Hi Adam, thanks for reporting this issue!

Would you be willing to share your configuration file (privately, if you would like) or at least an example that reproduces this error?

If so, if you can run the latest Brakeman source that I just updated, it should indicate which file in particular caused the problem.

Thanks again!

@ocxo
Copy link
Author

ocxo commented Dec 19, 2011

Sure. Do you want to see the application.rb config file? What email can I reach you at?

@presidentbeef
Copy link
Owner

It could be application.rb or environments/production.rb. You can send it/them to justin@presidentbeef.com.

Thanks!

@ocxo
Copy link
Author

ocxo commented Dec 19, 2011

So it looks like I only get that error when running as a gem. When I clone the project and specify the path to bin/brakeman it works fine. Could it possibly be a conflict with rvm? I don't think it's anything in our application causing the problem as it works when I specify the path.

@presidentbeef
Copy link
Owner

I don't think it's an issue with rvm - I use rvm constantly.

Did you see a message like [Notice] Error while processing config/application.rb ?

If not, seems like there are two possibilities:

  1. Brakeman is behaving differently when installed as a gem.
  2. There is an issue in Rails3ConfigProcessor that is tripping on something in your configuration, but a code change since 1.0 somehow fixes/hides it.

To check (1), build the gem from source, install it, and try again:

gem build brakeman.gemspec
gem install brakeman-1.0.0.gem

To check (2), revert Brakeman source to 1.0.0 and run directly from bin/brakeman:

git reset --hard 55a72956273c33b98a8ad2448e041f0373678afe
./bin/brakeman your/app

@ocxo
Copy link
Author

ocxo commented Dec 19, 2011

I think I found the problem. RVM was using 1.8 as the default, app was on 1.9. Setting 'rvm system 1.9.3-p0' fixed it. Thanks and sorry for the red herring.

@presidentbeef
Copy link
Owner

Are you sure that was the issue? I'm having trouble figuring out how that would cause that problem. If you were using 1.9 syntax, then you should get a parsing error...

@ocxo
Copy link
Author

ocxo commented Dec 20, 2011

Yeah as far as I can tell. The only thing I've changed was making sure the version of ruby that RVM was using was the same as what the app was using.

@presidentbeef
Copy link
Owner

Okay, cool. I will close this for now. Feel free to reopen if the problem returns.

Repository owner locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants