{"record":{"id":"ebe91bbc5119d00a","repo":"ruby/rubygems","slug":"security-device-verification-failed-invalid-http","errorCode":null,"errorMessage":"Security device verification failed: Invalid HTTP method #{method.upcase} received.","messagePattern":"Security device verification failed: Invalid HTTP method #(.+?) received\\.","errorType":"exception","errorClass":"Gem::WebauthnVerificationError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/gemcutter_utilities/webauthn_listener.rb","lineNumber":76,"sourceCode":"        unless root_path?(req_uri)\n          responder.send(NotFoundResponse.for(host))\n          raise Gem::WebauthnVerificationError, \"Page at #{req_uri.path} not found.\"\n        end\n\n        case method.upcase\n        when \"OPTIONS\"\n          responder.send(NoContentResponse.for(host))\n          next # will be GET\n        when \"GET\"\n          if otp = parse_otp_from_uri(req_uri)\n            responder.send(OkResponse.for(host))\n            return otp\n          end\n          responder.send(BadRequestResponse.for(host))\n          raise Gem::WebauthnVerificationError, \"Did not receive OTP from #{host}.\"\n        else\n          responder.send(MethodNotAllowedResponse.for(host))\n          raise Gem::WebauthnVerificationError, \"Invalid HTTP method #{method.upcase} received.\"\n        end\n      end\n    end\n\n    private\n\n    def root_path?(uri)\n      uri.path == \"/\"\n    end\n\n    def parse_otp_from_uri(uri)\n      query = uri.query\n      return unless query && !query.empty?\n\n      query.split(\"&\") do |param|\n        key, value = param.split(\"=\", 2)\n        if value && Gem::URI.decode_www_form_component(key) == \"code\"\n          return Gem::URI.decode_www_form_component(value)","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/gemcutter_utilities/webauthn_listener.rb#L58-L94","documentation":"Error \"Security device verification failed: Invalid HTTP method #{method.upcase} received.\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/gemcutter_utilities/webauthn_listener.rb:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}