Addressing issues: [29,31,68,76,100,30 and 31] - #106
jer-gremlin wants to merge 18 commits into
Conversation
|
Hi! Thanks for your contributions. I've cherry picked the CVE tests, the concurrency test, country-code metadata patch, leading zero patch, and the vanity number patch. Your other changes require a bit more energy to review. Would you be able to rebase your PR on main? I have also bumped MSRV to 1.85 and edition to 2024 to avoid the awkward if-let-change avoidance. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #106 +/- ##
==========================================
+ Coverage 68.15% 71.39% +3.24%
==========================================
Files 18 22 +4
Lines 2179 2444 +265
==========================================
+ Hits 1485 1745 +260
- Misses 694 699 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sure thing. |
Descriptor national-number regexes were matched with find(), accepting a match that merely started at index 0. A shorter pattern (e.g. an 8-digit rule) therefore matched a prefix of a longer, invalid number, so numbers like +97233142764978 were reported valid. Anchor the patterns with \A(?:...)\z at build time and use full-string is_match, matching libphonenumber's matches() semantics. Closes whisperfish#31
Parsing 3912312312 with reference IT stripped the leading 39 (Italy's calling code), yielding the invalid 12312312. The default-region branch stripped the country code whenever the number began with it and was not 'possible', which for regions without explicit length data is always. Adopt libphonenumber's rule: strip the default region's country code only when the full number is not a valid national number but the candidate (country code + national prefix removed) is, or the full number is too long. This relies on national-number patterns matching the whole string, so it also anchors those patterns (same change as the whisperfish#31 fix); merge that branch first to avoid a duplicate. Closes whisperfish#68
National-prefix stripping removed a leading digit even when the result was no longer a valid national number, so RU/KZ/BY numbers like +78005553535 became +7005553535. - The for-parsing branch checked the whole number for viability instead of the remainder after the prefix; check number[end..] instead. - The plain national-prefix branch stripped unconditionally; add the same viability check. - Remove the duplicate unconditional strip in parse_with. - Fix capture-group off-by-one (captures_len includes group 0) and the latent panic on a transform rule without a capturing group. Closes whisperfish#76
Add parser::rfc3986 with RFC 3986 §2.1 percent-decoding. The rfc3966 parser now accepts pct-encoded octets in the national number and phone-context, decoding them to their literal characters (e.g. %2D to -, %2B to +) before interpretation. Malformed escapes and octets that are not valid UTF-8 are rejected as parse errors.
Add parser::rfc4715, exposing the isub and isub-encoding tel-URI parameters (RFC 4715) through a dedicated subaddress() parser. The sub-address is auxiliary routing data rather than part of the E.164 number, so it is surfaced separately rather than on PhoneNumber.
Add parser::rfc4904, exposing the tgrp and trunk-context tel-URI parameters (RFC 4904) through a dedicated trunk_group() parser. Trunk groups are routing metadata rather than part of the E.164 number, so they are surfaced separately rather than on PhoneNumber.
Add parser::rfc3601, parsing the dial-sequence notation (phone-string) of RFC 3601: DTMF digits and tones, one-second pauses (p), waits for dial tone (w), and visual separators. A dial sequence carries tones and timing that an E.164 number cannot, so it is parsed independently of PhoneNumber and exposed as DialSequence.
Re-export the rfc3601, rfc3986, rfc4715 and rfc4904 parser modules so the dial-sequence, percent-decoding, ISDN sub-address and trunk-group APIs are reachable by downstream callers.
|
|
@rubdos all good? |
Hiya,
I wanted to use this in a POC, but the client doesn't allow things with open issues/sev vulns so:
some opinionated fixes for the above, take them if you want -- or not.
if you'd rather cherry from the fixes individually
Addresses #100 #76 #68 #31 #30 #29