{"record":{"id":"88e8ee223a489918","repo":"flippercloud/flipper","slug":"payload-should-be-a-string","errorCode":null,"errorMessage":"payload should be a string","messagePattern":"payload should be a string","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/flipper/cloud/message_verifier.rb","lineNumber":28,"sourceCode":"\n      def self.header(signature, timestamp, version = DEFAULT_VERSION)\n        raise ArgumentError, \"timestamp should be an instance of Time\" unless timestamp.is_a?(Time)\n        raise ArgumentError, \"signature should be a string\" unless signature.is_a?(String)\n        \"t=#{timestamp.to_i},#{version}=#{signature}\"\n      end\n\n      def initialize(secret:, version: DEFAULT_VERSION)\n        @secret = secret\n        @version = version || DEFAULT_VERSION\n\n        raise ArgumentError, \"secret should be a string\" unless @secret.is_a?(String)\n        raise ArgumentError, \"secret should not be empty\" if @secret.empty?\n        raise ArgumentError, \"version should be a string\" unless @version.is_a?(String)\n      end\n\n      def generate(payload, timestamp)\n        raise ArgumentError, \"timestamp should be an instance of Time\" unless timestamp.is_a?(Time)\n        raise ArgumentError, \"payload should be a string\" unless payload.is_a?(String)\n\n        OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new(\"sha256\"), @secret, \"#{timestamp.to_i}.#{payload}\")\n      end\n\n      def header(signature, timestamp)\n        self.class.header(signature, timestamp, @version)\n      end\n\n      # Public: Verifies the signature header for a given payload.\n      #\n      # Raises a InvalidSignature in the following cases:\n      # - the header does not match the expected format\n      # - no signatures found with the expected scheme\n      # - no signatures matching the expected signature\n      # - a tolerance is provided and the timestamp is not within the\n      #   tolerance\n      #\n      # Returns true otherwise.","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/flippercloud/flipper/blob/1f86de3ec91521585b156445e156642938b19cb0/lib/flipper/cloud/message_verifier.rb#L10-L46","documentation":"Error \"payload should be a string\" thrown in flippercloud/flipper.","triggerScenarios":"Thrown at lib/flipper/cloud/message_verifier.rb:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the raw request body string, not a parsed hash: use request.body.read before JSON parsing","In Rails, use request.raw_post so middleware has not consumed the body","Re-read the body carefully: signature verification must run over the exact raw payload string"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1f86de3ec91521585b156445e156642938b19cb0","analyzedAt":"2026-08-23T04:36:09.896Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}