Repository navigation
fix(decode_qr): validate scanned QR payload structure before field access (fixes #1029) - #1067
muskan-creates352 wants to merge 1 commit into
Conversation
|
hii , @wolgwang1729 plz ptal... |
SeedSigner contributors are all volunteers. You have just created a large amount of notification spam asking for a volunteer's time across a number of PRs. It is up to each volunteer how and where they spend their time; a PR author does not have the right to dictate what someone gives their attention to. We always appreciate people's interest and contributions. But understand that this notification spamming behavior is considered extremely rude. |
|
Hi @kdmukai, I sincerely apologize for the notification spam and for not strictly adhering to the PR template guidelines regarding mentions. I completely understand and respect that all maintainers and contributors are volunteers dedicating their valuable time. It was never my intention to be rude, impatient, or disruptive. I have taken this feedback to heart, thoroughly reviewed the PR template, and will strictly follow it across all my PRs. I will also make sure not to tag or mention maintainers going forward. Thank you for your patience and for pointing this out to help me learn proper repository etiquette. |
Fixes #1029
Description
As highlighted in #1029, scanned QR payloads previously lacked defensive structural validation before individual attributes and positional fields were accessed. Scanning malformed or incomplete QR payloads could trigger unhandled exceptions (such as
TypeError,IndexError, or bareException) rather than gracefully returningDecodeQRStatus.INVALID.Changes Made
SettingsQrDecoder:raise Exception("Invalid SettingsQR data")with defensive validation and safe return ofDecodeQRStatus.INVALID.settings::and includes a valid version token before accepting.SpecterWalletQrDecoder:is_complete()invokedself.is_valid()with parentheses despiteis_validbeing a@property, which raisedTypeError: 'bool' object is not callable.validate_jsonandis_validto ensure parsed JSON is a dictionary containing a stringdescriptor.except:blocks in segment parsing with safe regex match validation.MultiSigConfigFileQRDecoder/multisig_setup_file_to_descriptor:format(avoidingUnboundLocalErroronscript_type).xpubs = [None] * npre-allocation to preventIndexErrorwhenPolicy:line is missing or comes after xpubs.DecodeQR.multisig_setup_file_to_descriptor()inMultiSigConfigFileQRDecoder.add()so invalid config files returnDecodeQRStatus.INVALIDgracefully.GenericWalletQrDecoder:Testing
tests/test_qr_decoder_validation.pycontaining 10 dedicated test cases covering valid and malformed payloads across all updated decoders (10/10 passed in 0.29s).