For compliance, we do not want to apply Type.GetType to any data string we are given in-case it leads to harmful types being used. Even using Type.GetType and then checking the type afterwards is not compliant because it may inadvertently load assemblies we did not intend.
Therefore we create an explicit list of allowed types, and parse the type string to direct construction of the required type from the allowed list.
The nice thing about constructing directly from the allowed list is that even if there is a bug in the parsing code, or the string has been tampered with, it is impossible for us to end up with a type that is not a combination of types on the allowed list.
For compliance, we do not want to apply Type.GetType to any data string we are given in-case it leads to harmful types being used. Even using Type.GetType and then checking the type afterwards is not compliant because it may inadvertently load assemblies we did not intend.
Therefore we create an explicit list of allowed types, and parse the type string to direct construction of the required type from the allowed list.
The nice thing about constructing directly from the allowed list is that even if there is a bug in the parsing code, or the string has been tampered with, it is impossible for us to end up with a type that is not a combination of types on the allowed list.