-
Notifications
You must be signed in to change notification settings - Fork 722
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
Error: undefined method `force_encoding' for Brakeman::FilePath #1534
Comments
Running again with debug output, I still don't see any references to "my" code. Here are the relevant sections:
|
Hi @pboling! Thank you for taking steps to debug and providing the stack traces. I'm guessing In other words, RubyParser will turn "#{__FILE__}" into "config/application.rb" when But since it's not a string in this case... there's the error. The weird thing is that I can only reproduce this error when running Brakeman in the root of the Rails app. Not sure why there's an encoding issue then. In any case, should be fixed with #1535. By the way, you should not expect to see your code in the stack trace, because Brakeman does not execute your code. |
I do a lot, in my root bootstrapping files, with |
Background
Brakeman version: 4.10.0
Rails version: 5.2.4.4 ... except not a "real" Rails app - it is a Ruby Grape app with most of the Rails stack of gems in use, like Active Record, Active Support, Action Mailer, Action Cable, etc.
Ruby version:
Parse Error
Minimal example that does not parse:
Unfortunately it is not clear where the parse error is. I read the troubleshooting steps, and tried them. First the brakeman output, and then the troubleshooting results follow. I am unable to find any literal concatenations of strings in the files that are raising the error, or in fact, anywhere in the codebase. Perhaps the fact that I am setting
# frozen_string_literal: true
at the top of my files is causingbrakeman
to blow up due to possible literal string concat's inside brakeman?Results of
ruby -c
:Results of
ruby_parse config/environment.rb
:Results of
ruby_parse config/application.rb
:The text was updated successfully, but these errors were encountered: