Re:Format Strings in Rust 1.58
by thinkharderdev on Friday January 14, 2022 @08:24AM
(#29934129)
That is exactly my point. The way you can eliminate potential injection attacks is by not having libraries which accepts String and treat it as a sanitized input. But once you do that then there is no real reason to be wary of format strings. You can use format strings to build strings, but anything that needs a string that is sanitized against some potential injection attack only accepts a type that represents that invariant.
[ Parent
| on HN ]
> But once you do that then there is no real reason to be wary of format strings.
But then format strings don't help you much as you can't use them to create the sanitised types. You can't sanitise the string after it's been constructed.
Re:Format Strings in Rust 1.58
by thinkharderdev on Friday January 14, 2022 @08:49AM
(#29934371)
Right, but there are many, many use cases for creating string in which you don't need some specific sanitization. Most of the time when I am using a format string I am not worried about sanitization.