Skip to content

Commit 55473c6

Browse files
Improving documentation
1 parent 9d7d6b3 commit 55473c6

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

csharp/ql/src/experimental/Security Features/Serialization/DataSetSerialization.qhelp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
"qhelp.dtd">
44
<qhelp>
55
<overview>
6-
<p>The <code>DataSet</code> and <code>DataTable</code> types are legacy .NET components that allow representing data sets as managed objects.<p>
6+
<p>The <code>DataSet</code> and <code>DataTable</code> types are legacy .NET components that allow representing data sets as managed objects.</p>
77

8+
<p>While <code>DataSet</code> and <code>DataTable</code> do impose default limitations on the types that are allowed to be present while deserializing XML payloads, <code>DataSet</code> and <code>DataTable</code> are in general not safe when populated with untrusted input.</p>
89

10+
<p>Please visit <a href="https://go.microsoft.com/fwlink/?linkid=2132227">DataSet and DataTable security guidance</a> for more details.</p>
11+
912
</overview>
1013
<recommendation>
1114

csharp/ql/src/experimental/Security Features/Serialization/DataSetSerialization.qll

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
import csharp
1+
/**
2+
* Provides classes for `DataSet` or `DataTable` deserialization queries.
3+
*
4+
* Please visit https://go.microsoft.com/fwlink/?linkid=2132227 for details.
5+
*/
6+
7+
import csharp
28

39
/**
4-
* Abstract class thats depnds or inherits from DataSet and DataTable types.
5-
**/
10+
* Abstract class that depends or inherits from `DataSet` or `DataTable` types.
11+
*/
612
abstract class DataSetOrTableRelatedClass extends Class {
713
}
814

915
/**
10-
* Gets the DataSet and DataTable types, or types derived from them.
11-
**/
16+
* `DataSet`, `DataTable` types, or any types derived from them.
17+
*/
1218
class DataSetOrTable extends DataSetOrTableRelatedClass {
1319
DataSetOrTable() {
1420
this.getABaseType*().getQualifiedName().matches("System.Data.DataTable") or
@@ -19,7 +25,7 @@ class DataSetOrTable extends DataSetOrTableRelatedClass {
1925
}
2026

2127
/**
22-
* Gets a class that include a property or generic of type DataSet and DataTable
28+
* A Class that include a property or generic collection of type `DataSet` and `DataTable`
2329
*/
2430
class ClassWithDataSetOrTableMember extends DataSetOrTableRelatedClass {
2531
ClassWithDataSetOrTableMember() {
@@ -57,6 +63,9 @@ class SerializableClass extends Class {
5763
}
5864
}
5965

66+
/**
67+
* Holds if the serializable class `c` has a property or field `m` that is of `DataSet` or `DataTable` related type
68+
*/
6069
predicate isClassUnsafeXmlSerializerImplementation( SerializableClass c, Member m) {
6170
exists( Property p |
6271
m = p |
@@ -70,7 +79,7 @@ predicate isClassUnsafeXmlSerializerImplementation( SerializableClass c, Member
7079
}
7180

7281
/**
73-
* It is unsafe to serilize DataSet and DataTable related types
82+
* Serializable class that has a property or field that is of `DataSet` or `DataTable` related type
7483
*/
7584
class UnsafeXmlSerializerImplementation extends SerializableClass {
7685
UnsafeXmlSerializerImplementation() {
@@ -98,7 +107,7 @@ class UnsafeXmlReadMethod extends Method {
98107
}
99108

100109
/**
101-
* MethodCal that may be unsafe when used to serialize DataSet and DataTable related types
110+
* MethodCall that may be unsafe when used to serialize DataSet and DataTable related types
102111
*/
103112
class UnsafeXmlReadMethodCall extends MethodCall {
104113
UnsafeXmlReadMethodCall() {

0 commit comments

Comments
 (0)