Skip to content

Not handling broken API SSL certs #10

Description

@soapsurfer

The web-ui does not properly handle broken api certificates.
If the certificate is invalid it displayes "Internal Server Error" and the following backtrace is shown in the terminal:

2017-10-11` 18:42:58 - NoMethodError - undefined method `body' for nil:NilClass:                                                                               
        /var/lib/vhostapi/web-ui/app/helpers/api_helper.rb:123:in `parse_apiresponse'                                                                         
        /var/lib/vhostapi/web-ui/app/controllers/auth_controller.rb:18:in `rescue in block in <top (required)>'                                               
        /var/lib/vhostapi/web-ui/app/controllers/auth_controller.rb:9:in `block in <top (required)>'                                                          
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1632:in `call'                                               
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1632:in `block in compile!'                                  
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:991:in `block (3 levels) in route!'                          
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1010:in `route_eval'                                         
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:991:in `block (2 levels) in route!'                          
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1037:in `block in process_route'                             
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1035:in `catch'                                              
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1035:in `process_route'                                      
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:989:in `block in route!'                                     
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:988:in `each'       
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:988:in `route!'                                              
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1094:in `block in dispatch!'                                 
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `block in invoke'                                    
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `catch'                                              
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `invoke'                                             
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1091:in `dispatch!'                                          
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:923:in `block in call!'                                      
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `block in invoke'                                    
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `catch'                                              
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `invoke'                                             
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:923:in `call!'                                               
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:913:in `call'                                                
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:232:in `context'                                    
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'                                       
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/deflater.rb:34:in `call'                                                   
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/xss_header.rb:18:in `call'                           
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/path_traversal.rb:16:in `call'                       
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/json_csrf.rb:26:in `call'                            
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/base.rb:50:in `call'                                 
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/base.rb:50:in `call'                                 
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/frame_options.rb:31:in `call'                        
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/null_logger.rb:9:in `call'                                                 
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/head.rb:12:in `call'                                                       
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'                                            
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:194:in `call'                                                
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1955:in `call'                                               
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1499:in `block in call'                                      
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1726:in `synchronize'                                        
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1499:in `call'                                               
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/configuration.rb:225:in `call'                                            
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/server.rb:605:in `handle_request'                                         
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/server.rb:437:in `process_client'                                         
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/server.rb:301:in `block in run'                                           
        /var/lib/vhostapi/web-ui/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions