Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

ping event is not handled in server_template #47

@drok

Description

@drok

It appears that a "ping" event can be sent, with a NULL payload, and this causes the authenticate_installation(@payload) to fail:

I don't know enough about ruby or sinatra yet to mend the template myself, so how should payload-less events be handled, and specifically, how should 'ping' be handled?

127.0.0.1 - - [27/Jul/2022:07:07:40 +0000] "POST /event_handler HTTP/1.1" 200 - 0.1179
127.0.0.1 - - [27/Jul/2022:07:07:40 UTC] "POST /event_handler HTTP/1.0" 200 0
- -> /event_handler
D, [2022-07-27T07:08:29.959523 #14800] DEBUG -- : ---- received event ping
2022-07-27 07:08:29 - NoMethodError - undefined method `[]' for nil:NilClass:
        template_server.rb:127:in `authenticate_installation'
        template_server.rb:55:in `block in <class:GHAapp>'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1635:in `call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1635:in `block in compile!'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1040:in `block in process_route'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1038:in `catch'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1038:in `process_route'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:983:in `block in filter!'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:983:in `each'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:983:in `filter!'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1096:in `block in dispatch!'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1076:in `block in invoke'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1076:in `catch'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1076:in `invoke'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1094:in `dispatch!'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:924:in `block in call!'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1076:in `block in invoke'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1076:in `catch'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1076:in `invoke'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:924:in `call!'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:913:in `call'
        /usr/share/gems/gems/rack-protection-2.0.4/lib/rack/protection/xss_header.rb:18:in `call'
        /usr/share/gems/gems/rack-protection-2.0.4/lib/rack/protection/path_traversal.rb:16:in `call'
        /usr/share/gems/gems/rack-protection-2.0.4/lib/rack/protection/json_csrf.rb:26:in `call'
        /usr/share/gems/gems/rack-protection-2.0.4/lib/rack/protection/base.rb:50:in `call'
        /usr/share/gems/gems/rack-protection-2.0.4/lib/rack/protection/base.rb:50:in `call'
        /usr/share/gems/gems/rack-protection-2.0.4/lib/rack/protection/frame_options.rb:31:in `call'
        /usr/share/gems/gems/rack-2.0.8/lib/rack/logger.rb:15:in `call'
        /usr/share/gems/gems/rack-2.0.8/lib/rack/common_logger.rb:33:in `call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:231:in `call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:224:in `call'
        /usr/share/gems/gems/rack-2.0.8/lib/rack/head.rb:12:in `call'
        /usr/share/gems/gems/rack-2.0.8/lib/rack/method_override.rb:22:in `call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/show_exceptions.rb:22:in `call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:194:in `call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1957:in `call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1502:in `block in call'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1729:in `synchronize'
        /usr/share/gems/gems/sinatra-2.0.4/lib/sinatra/base.rb:1502:in `call'
        /usr/share/gems/gems/rack-2.0.8/lib/rack/handler/webrick.rb:86:in `service'
        /usr/share/ruby/webrick/httpserver.rb:140:in `service'
        /usr/share/ruby/webrick/httpserver.rb:96:in `run'
        /usr/share/ruby/webrick/server.rb:307:in `block in start_thread'
127.0.0.1 - - [27/Jul/2022:07:08:29 UTC] "POST /event_handler HTTP/1.0" 500 123349
- -> /event_handler

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