concept string in category security

This is an excerpt from Manning's book Secure by Design.
You can see in the listing how you’re pulling in an (imaginary) security library that provides functionality to validate a string for possible XSS attacks. You also decided to check that none of the constructor parameters are
nullto further improve the validation. This way of handling security in software is common, but it’s also problematic for several reasons, some being:
1.5 Dealing with strings, XML, and a billion laughs
When designing software, you’re often faced with the decision of how to represent data. Unfortunately, there’s a tendency towards using data types that are too generic for the purpose. For example, representing a phone number as a string can seem convenient at first, but from a security perspective, it’s devastating, because a string can represent almost any kind of data—not just what you’d expect. Still, developers tend to favor strings, and often the protection against invalid input is enforced by name typing as seen in the next listing. The method
registerexpects a phone number, but the argument is aString, which means it could be anything!Listing 1.5 A
Stringargument protected by name typingpublic void register(String phoneNumber) { #1 ... } #1 phoneNumber can contain any character sequence because it’s a String.