Summary
PhoneNumberField.updatePhoneNumber() strips a single leading 0 from the national part for every prefix. That is correct for the prefixes this field currently offers (+41, +49). It becomes wrong if the field later accepts prefixes whose leading 0 is a significant national digit (for example Italian +39 landlines).
Evidence
lib/widgets/form/phone_number_field.dart:48 — number!.startsWith('0') ? number!.substring(1) : number with no prefix check
lib/widgets/form/phone_number_field.dart:16 — current prefixes are only ['+41', '+49']
- Parallel work on
feat/open-phone-country-prefix already lets the user type a free 1–3 digit dial code. Combining that with this strip without a country allow-list would sign and store a mutated number.
Found while reviewing #910.
Suggested follow-up
- Restrict the strip to prefixes that use a national trunk zero (at least
+41 / +49; +43 / +423 if those stay in the known list).
- When the open-prefix field lands, either keep a trunk-0 allow-list or reuse the same normalisation the API uses.
- Add a preservation test for a prefix that must keep a leading
0 (for example +39 / 06…).
Not a merge blocker for #910: on today's +41/+49 surface the strip is the #905 fix and is covered by widget tests.
Summary
PhoneNumberField.updatePhoneNumber()strips a single leading0from the national part for every prefix. That is correct for the prefixes this field currently offers (+41,+49). It becomes wrong if the field later accepts prefixes whose leading0is a significant national digit (for example Italian+39landlines).Evidence
lib/widgets/form/phone_number_field.dart:48—number!.startsWith('0') ? number!.substring(1) : numberwith no prefix checklib/widgets/form/phone_number_field.dart:16— current prefixes are only['+41', '+49']feat/open-phone-country-prefixalready lets the user type a free 1–3 digit dial code. Combining that with this strip without a country allow-list would sign and store a mutated number.Found while reviewing #910.
Suggested follow-up
+41/+49;+43/+423if those stay in the known list).0(for example+39/06…).Not a merge blocker for #910: on today's
+41/+49surface the strip is the #905 fix and is covered by widget tests.