Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

undefined method `[]' for nil:NilClass (NoMethodError) #3

Closed
thecapacity opened this issue Feb 12, 2015 · 8 comments
Closed

undefined method `[]' for nil:NilClass (NoMethodError) #3

thecapacity opened this issue Feb 12, 2015 · 8 comments

Comments

@thecapacity
Copy link

Looks like a few of them ran, but then I got an error.

[acus.gov]
[acus.gov]
Fetched, cached.
[achp.gov]
[achp.gov]
Fetched, cached.
[preserveamerica.gov]
[preserveamerica.gov]
Fetched, cached.
[adf.gov]
[adf.gov]
Fetched, cached.
[usadf.gov]
[usadf.gov]
Fetched, cached.
[abmc.gov]
[abmc.gov]
Fetched, cached.
[amtrakoig.gov]
[amtrakoig.gov]
Fetched, cached.
[arc.gov]
[arc.gov]
Fetched, cached.
[afrh.gov]
[afrh.gov]
Fetched, cached.
[cia.gov]
[cia.gov]
Fetched, cached.
[ic.gov]
[ic.gov]
/Library/Ruby/Gems/2.0.0/gems/site-inspector-1.0.0/lib/site-inspector/headers.rb:24:in strict_transport_security': undefined method[]' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/site-inspector-1.0.0/lib/site-inspector/headers.rb:10:in strict_transport_security?' from ./https-scan.rb:137:indomain_details'
from ./https-scan.rb:105:in check_domain' from ./https-scan.rb:51:inblock (2 levels) in go'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/csv.rb:1716:in each' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/csv.rb:1120:inblock in foreach'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/csv.rb:1266:in open' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/csv.rb:1119:inforeach'
from ./https-scan.rb:31:in block in go' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/csv.rb:1266:inopen'
from ./https-scan.rb:17:in go' from ./https-scan.rb:152:in

'

@konklone
Copy link
Contributor

I think this is a regression in site-inspector 1.0.0, which came out Feb 6. I'm looking into the root cause. cc @benbalter

@konklone
Copy link
Contributor

Ah, and I can see that @benbalter fixed this bug in benbalter/site-inspector@92a93dc and bumped the version to 1.0.1 -- but didn't publish to Rubygems. @benbalter, mind doing a gem publish? 😺

@thecapacity, in the meantime, you can revert to an older version of site-inspector, or pull from @benbalter's repository's master branch.

@thecapacity
Copy link
Author

Thanks all! I was just diving into this again today and was checking up here to tell you I was still having it!

@thecapacity
Copy link
Author

OK, dumb Q - but where in the https-scan repo can I shim in @benbalter's 'native' site-inspector?

e.g. I have ./https-scan and ../site-inspector-ruby but I'm not sure how Ruby even finds 'site-inspector' in the "require" statement since ./https-scan doesn't seem to include it (e.g. as a subdir)

#sorryImaPythonGuy

@konklone
Copy link
Contributor

No worries. I updated this project's Gemfile to pull from site-inspector's master branch directly, for now. So git pull this project to the latest, then run bundle update site-inspector to re-sync the version of site-inspector that this script uses.

The https-scan.rb script requires bundler/setup, which is what triggers the script to run inside of the bundler-managed environment (sort of like working inside a virtualenv).

@thecapacity
Copy link
Author

I seem to have 'answered' my own question, for anyone that needs.

  1. I changed require 'site-inspector' to 'require ../site-inspector-ruby'
  2. On a re-run you get an error to do another 'bundle install'
  3. Do that, then if you try to run you get an error
  4. Then change the require statement back to just 'site-inspector' (i.e. remove the path)
  5. Re-run and it seems to be going fine.

Ah, @konklone I think maybe I was saved by your fix (which just popped in I think) vs. my own creativity! :)

@benbalter
Copy link
Contributor

Released 1.0.1: https://github.com/benbalter/site-inspector-ruby/releases/tag/v1.0.1

@thecapacity for next time, simply add the following to your gemfile:

gem "site-inspector", :github => "benbalter/site-inspector-ruby"

Which instructs Bundler to always use the HEAD of the git repo, rather than the released version.

@thecapacity
Copy link
Author

Thanks @benbalter someday I'm going to have to get the crash course on GitHub from you - I can't find my +1 (interestingly something almost popped up for that but I couldn't figure out how I almost did that) 👍 Ahh...

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

3 participants