krissrex / google-authenticator-exporter

Get the TOTP secrets exported by Google Authenticator
MIT License
380 stars 49 forks source link

RangeError: index out of range: #15

Open zdary opened 1 year ago

zdary commented 1 year ago

node:readline:1252 throw err; ^

RangeError: index out of range: 51 + 10 > 51 at indexOutOfRange (C:\Users\test\google-authenticator-exporter\node_modules\protobufjs\src\reader.js:13:12) at BufferReader.read_uint32 [as uint32] (C:\Users\test\google-authenticator-exporter\node_modules\protobufjs\src\reader.js:98:19) at BufferReader.read_int32 [as int32] (C:\Users\test\google-authenticator-exporter\node_modules\protobufjs\src\reader.js:109:17) at Type.OtpParameters$decode [as decode] (eval at Codegen (C:\Users\test\google-authenticator-exporter\node_modules\@protobufjs\codegen\index.js:50:33), :23:14) at Type.decode_setup [as decode] (C:\Users\test\google-authenticator-exporter\node_modules\protobufjs\src\type.js:507:25) at Type.MigrationPayload$decode [as decode] (eval at Codegen (C:\Users\test\google-authenticator-exporter\node_modules\@protobufjs\codegen\index.js:50:33), :13:33) at Type.decode_setup [as decode] (C:\Users\test\google-authenticator-exporter\node_modules\protobufjs\src\type.js:507:25) at decodeProtobuf (C:\Users\test\google-authenticator-exporter\src\index.js:14:36) at decode (C:\Users\test\google-authenticator-exporter\src\index.js:48:19) at C:\Users\test\google-authenticator-exporter\src\index.js:176:22

awehrung commented 4 months ago

Experiencing a similar issue (using the docker setup):

node:internal/readline/emitKeypressEvents:74
            throw err;
            ^

RangeError: index out of range: 107 + 10 > 107
    at indexOutOfRange (/app/node_modules/protobufjs/src/reader.js:13:12)
    at BufferReader.read_uint32 [as uint32] (/app/node_modules/protobufjs/src/reader.js:98:19)
    at BufferReader.read_int32 [as int32] (/app/node_modules/protobufjs/src/reader.js:109:17)
    at Type.MigrationPayload$decode [as decode] (eval at Codegen (/app/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:25:15)
    at Type.decode_setup [as decode] (/app/node_modules/protobufjs/src/type.js:507:25)
    at decodeProtobuf (/app/src/index.js:14:36)
    at decode (/app/src/index.js:48:19)
    at /app/src/index.js:176:22
    at /app/node_modules/prompt/lib/prompt.js:357:32
    at /app/node_modules/async/lib/async.js:154:25

Node.js v17.7.2

and I have absolutely no idea how to debug this further :/

krissrex commented 1 month ago

I think this is related to #22. What version of Authenticator do you use? I am unable to reproduce this fault myself, and I don't want you to send your secret code either...

The error means that protobuff tried to read 10 more bytes from the otpauth-migration data, but the data was not longer than 51 and 107 bytes (respectively).

krissrex commented 1 month ago

What QR decoder did you use? Does your uri end in a %3D, or in a =? I'm wondering if you copied the URI correctly from the QR.

krissrex commented 1 month ago

Does it still fail with the latest version of this repo?