Skip to content

Commit f352bcb

Browse files
committed
C#: Change nHibernate stub to nuget-based one
1 parent 1188e1b commit f352bcb

File tree

19 files changed

+40253
-80
lines changed

19 files changed

+40253
-80
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| nhibernate.cs:50:14:50:19 | access to property Name | Data flow from $@. | nhibernate.cs:45:24:45:32 | "tainted" | "tainted" |
2-
| nhibernate.cs:55:14:55:23 | access to property Address | Data flow from $@. | nhibernate.cs:45:24:45:32 | "tainted" | "tainted" |
1+
| nhibernate.cs:50:18:50:23 | access to property Name | Data flow from $@. | nhibernate.cs:45:28:45:36 | "tainted" | "tainted" |
2+
| nhibernate.cs:55:18:55:27 | access to property Address | Data flow from $@. | nhibernate.cs:45:28:45:36 | "tainted" | "tainted" |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| nhibernate.cs:16:9:16:26 | object creation of type SqlString |
2-
| nhibernate.cs:17:9:17:27 | call to method Delete |
1+
| nhibernate.cs:16:13:16:30 | object creation of type SqlString |
2+
| nhibernate.cs:17:13:17:31 | call to method Delete |

csharp/ql/test/library-tests/frameworks/NHibernate/SqlExprs.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import csharp
22
import semmle.code.csharp.frameworks.Sql
33

44
from SqlExpr e
5+
where not e.getFile().getAbsolutePath().matches("%/resources/stubs/%")
56
select e
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
| nhibernate.cs:49:14:49:17 | access to property Id |
2-
| nhibernate.cs:50:14:50:19 | access to property Name |
3-
| nhibernate.cs:51:14:51:22 | access to property Address |
4-
| nhibernate.cs:53:14:53:18 | access to property Id |
5-
| nhibernate.cs:54:14:54:19 | access to property Age |
6-
| nhibernate.cs:55:14:55:23 | access to property Address |
1+
| nhibernate.cs:49:18:49:21 | access to property Id |
2+
| nhibernate.cs:50:18:50:23 | access to property Name |
3+
| nhibernate.cs:51:18:51:26 | access to property Address |
4+
| nhibernate.cs:53:18:53:22 | access to property Id |
5+
| nhibernate.cs:54:18:54:23 | access to property Age |
6+
| nhibernate.cs:55:18:55:27 | access to property Address |

csharp/ql/test/library-tests/frameworks/NHibernate/StoredFlowSources.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import csharp
22
import semmle.code.csharp.security.dataflow.flowsources.Stored
33

44
from StoredFlowSource source
5+
where not source.getLocation().getFile().getAbsolutePath().matches("%/resources/stubs/%")
56
select source
Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1-
// semmle-extractor-options: /r:System.Data.dll /r:System.ComponentModel.Primitives.dll ${testdir}/../../../resources/stubs/NHibernate.cs ${testdir}/../../../resources/stubs/System.Data.cs /r:System.ComponentModel.TypeConverter.dll /r:System.Data.Common.dll
1+
// semmle-extractor-options: /nostdlib /noconfig --load-sources-from-project:../../../resources/stubs/NHibernate/5.3.8/NHibernate.csproj
22

33

44
using NHibernate;
55
using NHibernate.SqlCommand;
66

77
namespace NHibernateTest
88
{
9-
class Test
10-
{
11-
ISession session;
12-
13-
void SqlExprs()
14-
{
15-
var sql = "sql";
16-
new SqlString(sql); // SQL expression
17-
session.Delete(sql); // SQL expression
18-
}
19-
20-
class Person
21-
{
22-
public int Id { get; set; }
23-
public string Name { get; set; }
24-
public string Address { get; set; }
25-
}
26-
27-
class Person2
28-
{
29-
public int Id { get; set; }
30-
public int Age { get; set; }
31-
public string Address { get; set; }
32-
}
33-
34-
void FlowSources()
35-
{
36-
session.Query<Person>();
37-
session.Save(new Person2());
38-
}
39-
40-
void DataFlow()
41-
{
42-
var p = new Person();
43-
var p2 = new Person2();
44-
45-
string taint = "tainted";
46-
p.Name = taint;
47-
p2.Address = taint;
48-
49-
Sink(p.Id); // Not tainted
50-
Sink(p.Name); // Tainted
51-
Sink(p.Address); // Not tainted
52-
53-
Sink(p2.Id); // Not tainted
54-
Sink(p2.Age); // Not tainted
55-
Sink(p2.Address); // Tainted
56-
}
57-
58-
void Sink(object sink)
9+
class Test
5910
{
11+
ISession session;
12+
13+
void SqlExprs()
14+
{
15+
var sql = "sql";
16+
new SqlString(sql); // SQL expression
17+
session.Delete(sql); // SQL expression
18+
}
19+
20+
class Person
21+
{
22+
public int Id { get; set; }
23+
public string Name { get; set; }
24+
public string Address { get; set; }
25+
}
26+
27+
class Person2
28+
{
29+
public int Id { get; set; }
30+
public int Age { get; set; }
31+
public string Address { get; set; }
32+
}
33+
34+
void FlowSources()
35+
{
36+
session.Query<Person>();
37+
session.Save(new Person2());
38+
}
39+
40+
void DataFlow()
41+
{
42+
var p = new Person();
43+
var p2 = new Person2();
44+
45+
string taint = "tainted";
46+
p.Name = taint;
47+
p2.Address = taint;
48+
49+
Sink(p.Id); // Not tainted
50+
Sink(p.Name); // Tainted
51+
Sink(p.Address); // Not tainted
52+
53+
Sink(p2.Id); // Not tainted
54+
Sink(p2.Age); // Not tainted
55+
Sink(p2.Address); // Tainted
56+
}
57+
58+
void Sink(object sink)
59+
{
60+
}
6061
}
61-
}
6262
}

0 commit comments

Comments
 (0)