Open daira opened 6 days ago
Example of a QR code that is reportedly accepted when it must not be (second image in https://github.com/Electric-Coin-Company/zashi-android/issues/1678#issue-2657985253 ):
@daira thanks for reporting this I'll check it out.
If someone can chip in and do it before myself I'd much appreciate it.
The problem is as described here: https://github.com/zecdev/zcash-swift-payment-uri/issues/69#issuecomment-2490440246
ZIP 321 says, of the base64url memo field:
According to https://github.com/Electric-Coin-Company/zashi-android/issues/1678#issuecomment-2477494431 , a URI with a
+
character is rejected on Zashi Android but accepted on Zashi iOS. According to the spec, it MUST be rejected on both. (I'm intentionally using the more value-neutral terms "accepted"/"rejected" rather than "succeeds"/"fails".)In general we do not follow the Postel-era RFC "Be generous in what you accept." dictum when writing or implementing Zcash specs —or at least we don't intend to— because it demonstrably results in significant security and interoperability problems over the long term. For discussion of this see RFC 9413: Maintaining Robust Protocols, originally drafted with less weasel-wording and under the better title "The Harmful Consequences of the Robustness Principle" (which ruffled a few political feathers with the IETF old-timers, sigh).
Among other benefits, such as easier security analysis, that practice was intended to prevent situations such as that encountered in zashi-android#1678: someone testing on one implementation (Zashi iOS) and then getting inconsistent behaviour on another (Zashi Android). In this case interoperability problems could also occur if filename-unsafe characters are mangled by some transmission channels, or inconsistently converted to/from a QR code. If we accepted the wider set of characters then we'd have to test all those cases (or whatever subset of them we were able to think of), and would be imposing a similar testing burden on other implementors.