File tree Expand file tree Collapse file tree
csharp/ql/src/semmle/code/csharp/serialization Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ import csharp
88/** An unsafe deserializer. */
99abstract class UnsafeDeserializer extends Callable { }
1010
11+ /**
12+ * Known unsafe deserializer methods in the `System.*` namespace.
13+ */
1114class SystemDeserializer extends UnsafeDeserializer {
1215 SystemDeserializer ( ) {
1316 this
@@ -48,12 +51,19 @@ class SystemDeserializer extends UnsafeDeserializer {
4851 }
4952}
5053
54+ /**
55+ * Known unsafe deserializer methods in the `Microsoft.*` namespace.
56+ */
5157class MicrosoftDeserializer extends UnsafeDeserializer {
5258 MicrosoftDeserializer ( ) {
5359 this .hasQualifiedName ( "Microsoft.Web.Design.Remote.ProxyObject" , "DecodeValue" )
5460 }
5561}
5662
63+ /**
64+ * Unsafe deserializer methods that call unsafe deserializers on the
65+ * parameters.
66+ */
5767class WrapperDeserializer extends UnsafeDeserializer {
5868 WrapperDeserializer ( ) {
5969 exists ( Call call |
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides classes to identify any .Net serializable type such as types
3+ * attributed with `SerializableAttribute` and types implementing the
4+ * `ISerializable` interface.
5+ */
6+
17import csharp
28
9+ /**
10+ * A constructor with `SerializationInfo` and `StreamingContext` parameters.
11+ */
312class SerializationConstructor extends Constructor {
413 SerializationConstructor ( ) {
514 this .getNumberOfParameters ( ) = 2 and
@@ -91,16 +100,3 @@ class CustomBinarySerializableType extends BinarySerializableType {
91100 result .( SerializationConstructor ) .getDeclaringType ( ) = this
92101 }
93102}
94-
95- class DangerousCallable extends Callable {
96- DangerousCallable ( ) {
97- //files
98- this .( Method ) .getQualifiedName ( ) .matches ( "System.IO.File.Write%" ) or
99- this .( Method ) .getQualifiedName ( ) .matches ( "System.IO.File.%Copy%" ) or
100- this .( Method ) .getQualifiedName ( ) .matches ( "System.IO.File.%Move%" ) or
101- this .( Method ) .getQualifiedName ( ) .matches ( "System.IO.File.%Append%" ) or
102- this .( Method ) .getQualifiedName ( ) .matches ( "System.IO.%.%Delete%" ) or
103- //assembly
104- this .( Method ) .getQualifiedName ( ) .matches ( "System.Reflection.Assembly.%Load%" )
105- }
106- }
You can’t perform that action at this time.
0 commit comments