Repository navigation
Don't drop forwarded SMS with missing optional fields - #38
Open
yonatan-genai wants to merge 1 commit into
Open
yonatan-genai wants to merge 1 commit into
yonatan-genai wants to merge 1 commit into
Conversation
RawSmsIncomingMessage required every field it knows about (fco, co, fh, cs, r, _ssc, l, sV, m, ic). If one was missing, deserialization failed, from_raw fell through to BadMsg and the SMS vanished with no log. Only h, k, g and w are needed to show the message, so the rest now default. parse_sms also unwrapped the fh -> k lookup and the UTF-8 decode, so an fh that didn't match k, or a non-UTF-8 body, panicked. It now falls back to k order and decodes lossily.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm running rustpush as a headless SMS-forwarding receiver and noticed forwarded SMS from alphanumeric senders (bank and OTP senders) sometimes never showed up. RawSmsIncomingMessage required every field, so a payload missing any of them failed to deserialize and the message was dropped with no log, and parse_sms could panic on an fh entry that didn't match k or on a body that wasn't valid UTF-8.
This makes the optional fields default, falls back to k order when fh doesn't match, and decodes the body lossily. Added tests for a full payload, a payload with only h/k/g/w, and a mismatched fh.