{"record":{"id":"5ece847e13401ac6","repo":"basecamp/fizzy","slug":"invalid-simple-value-info","errorCode":null,"errorMessage":"Invalid simple value: #{info}","messagePattern":"Invalid simple value: #(.+?)","errorType":"exception","errorClass":"ActionPack::WebAuthn::InvalidCborError","httpStatus":null,"severity":"error","filePath":"lib/action_pack/web_authn/cbor_decoder.rb","lineNumber":194,"sourceCode":"      else\n        Hash.new.tap do |hash|\n          read_argument.times do\n            hash[decode] = decode\n          end\n        end\n      end\n    end\n\n    def decode_float_or_simple\n      case info = additional_info\n      when SIMPLE_FALSE_VALUE then false\n      when SIMPLE_TRUE_VALUE then true\n      when SIMPLE_NULL_VALUE, SIMPLE_UNDEFINED_VALUE then nil\n      when TWO_BYTE_VALUE_FOLLOWS then decode_half_float\n      when FOUR_BYTE_VALUE_FOLLOWS then read_bytes(4).pack(\"C*\").unpack1(\"g\")\n      when EIGHT_BYTE_VALUE_FOLLOWS then read_bytes(8).pack(\"C*\").unpack1(\"G\")\n      else\n        raise ActionPack::WebAuthn::InvalidCborError, \"Invalid simple value: #{info}\"\n      end\n    end\n\n    def decode_tag\n      tag = read_argument\n      value = decode\n\n      case tag\n      when POSITIVE_BIGNUM_TAG then value.bytes.inject(0) { |n, b| (n << 8) | b }\n      when NEGATIVE_BIGNUM_TAG then -1 - value.bytes.inject(0) { |n, b| (n << 8) | b }\n      else value\n      end\n    end\n\n    def decode_half_float\n      half = read_bytes(2).pack(\"C*\").unpack1(\"n\")\n\n      sign = (half >> 15) & 0x1","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/basecamp/fizzy/blob/7aabe7458060d8a1759a53b7ede39e74e6c0b20d/lib/action_pack/web_authn/cbor_decoder.rb#L176-L212","documentation":"In decode_float_or_simple, major type 7 with additional-info values 20/21/22/23 (false/true/null/undefined) and 25/26/27 (half/single/double floats) is handled; any other info value (0–19 unassigned simple values, 24 one-byte simple value, 28–31 reserved/break) raises InvalidCborError with the offending value interpolated.","triggerScenarios":"Decoding bytes like 0xF0 (simple value 16), 0xF8 (one-byte simple value follows), 0xFC/0xFD (reserved 28/29), or a stray 0xFF break code where a value was expected — all shapes that real encoders never emit, so the input is corrupt or hand-crafted.","commonSituations":"Fuzzed or bit-flipped payloads; test vectors built by incrementing header bytes; random binary data passed as CBOR; buffers shifted by an off-by-one so a type-7 header lands mid-byte.","solutions":["Hex-dump the bytes around the failure offset (the decoder stops exactly at the bad item) and compare against the expected structure.","Regenerate the payload with a conformant encoder (RFC 8949); never hand-edit CBOR bytes.","Rescue InvalidCborError and reject the whole payload — one bad item means the byte stream is untrustworthy.","If decoding untrusted input, wrap the call so malformed data returns 400, not a 500."],"exampleFix":"# before\nvalue = ActionPack::WebAuthn::CborDecoder.decode(bytes) # raises mid-parse on 0xF8\n\n# after — treat any CBOR syntax violation as bad input\nbegin\n  value = ActionPack::WebAuthn::CborDecoder.decode(bytes)\nrescue ActionPack::WebAuthn::InvalidCborError => e\n  Rails.logger.info { \"Rejected malformed CBOR: #{e.message}\" }\n  return render json: { error: 'malformed payload' }, status: :bad_request\nend","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  value = ActionPack::WebAuthn::CborDecoder.decode(bytes)\nrescue ActionPack::WebAuthn::InvalidCborError => e\n  Rails.logger.info { \"Rejected CBOR: #{e.message} at producer #{request.remote_ip}\" }\n  render json: { error: 'malformed payload' }, status: :bad_request\nend","preventionTips":["Always encode CBOR with a conformant RFC 8949 library; never hand-edit header bytes.","Wrap decoder calls so any syntax violation becomes 400, not a 500 stack trace.","Log the offending message (it interpolates the bad value) to spot fuzzing quickly."],"tags":["cbor","malformed-data","binary-parsing","rfc8949"],"backgroundTag":"cbor-malformed-data","analyzedSha":"7aabe7458060d8a1759a53b7ede39e74e6c0b20d","analyzedAt":"2026-08-21T18:33:25.349Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}