Skip to content

Commit 7e6d88d

Browse files
committed
C#: Only use stubs for XSS test.
1 parent 24543a2 commit 7e6d88d

File tree

3 files changed

+114
-196
lines changed

3 files changed

+114
-196
lines changed

csharp/ql/test/query-tests/Security Features/CWE-079/XSS/corestubs.cs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -188,49 +188,4 @@ public class ViewDataDictionary : System.Collections.IEnumerable, System.Collect
188188
}
189189
}
190190
}
191-
namespace Extensions
192-
{
193-
namespace Primitives
194-
{
195-
// Generated from `Microsoft.Extensions.Primitives.StringValues` in `Microsoft.Extensions.Primitives, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`
196-
public struct StringValues : System.IEquatable<string[]>, System.IEquatable<string>, System.IEquatable<Microsoft.Extensions.Primitives.StringValues>, System.Collections.IEnumerable, System.Collections.Generic.IReadOnlyList<string>, System.Collections.Generic.IReadOnlyCollection<string>,
197-
System.Collections.Generic.IList<string>, System.Collections.Generic.IEnumerable<string>, System.Collections.Generic.ICollection<string>
198-
{
199-
System.Collections.Generic.IEnumerator<string> System.Collections.Generic.IEnumerable<string>.GetEnumerator() => throw null;
200-
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => throw null;
201-
bool System.Collections.Generic.ICollection<string>.Contains(string item) => throw null;
202-
bool System.Collections.Generic.ICollection<string>.IsReadOnly { get => throw null; }
203-
bool System.Collections.Generic.ICollection<string>.Remove(string item) => throw null;
204-
int System.Collections.Generic.IList<string>.IndexOf(string item) => throw null;
205-
public bool Equals(Microsoft.Extensions.Primitives.StringValues other) => throw null;
206-
public bool Equals(string other) => throw null;
207-
public bool Equals(string[] other) => throw null;
208-
public int Count { get => throw null; }
209-
public override bool Equals(object obj) => throw null;
210-
public override int GetHashCode() => throw null;
211-
public override string ToString() => throw null;
212-
public static implicit operator string(Microsoft.Extensions.Primitives.StringValues values) => throw null;
213-
public string this[int index] { get => throw null; set => throw null; }
214-
public string[] ToArray() => throw null;
215-
void System.Collections.Generic.ICollection<string>.Add(string item) => throw null;
216-
void System.Collections.Generic.ICollection<string>.Clear() => throw null;
217-
void System.Collections.Generic.ICollection<string>.CopyTo(string[] array, int arrayIndex) => throw null;
218-
void System.Collections.Generic.IList<string>.Insert(int index, string item) => throw null;
219-
void System.Collections.Generic.IList<string>.RemoveAt(int index) => throw null;
220-
}
221-
222-
}
223-
}
224-
}
225-
namespace System
226-
{
227-
namespace Linq
228-
{
229-
// Generated from `System.Linq.Enumerable` in `System.Linq, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
230-
static public class Enumerable
231-
{
232-
public static TSource First<TSource>(this System.Collections.Generic.IEnumerable<TSource> source) => throw null;
233-
}
234-
235-
}
236191
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
semmle-extractor-options: /r:System.Dynamic.Runtime.dll /r:System.Runtime.Extensions.dll /r:System.Linq.Expressions.dll
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
3+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../../resources/stubs/Microsoft.Extensions.Primitives/6.0.0/Microsoft.Extensions.Primitives.csproj
Lines changed: 111 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,114 @@
11
namespace System
22
{
3-
namespace Collections
4-
{
5-
namespace Specialized
6-
{
7-
// Generated from `System.Collections.Specialized.NameObjectCollectionBase` in `System.Collections.Specialized, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
8-
abstract public class NameObjectCollectionBase : System.Runtime.Serialization.ISerializable, System.Runtime.Serialization.IDeserializationCallback, System.Collections.IEnumerable, System.Collections.ICollection
9-
{
10-
bool System.Collections.ICollection.IsSynchronized { get => throw null; }
11-
object System.Collections.ICollection.SyncRoot { get => throw null; }
12-
public virtual System.Collections.IEnumerator GetEnumerator() => throw null;
13-
public virtual int Count { get => throw null; }
14-
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) => throw null;
15-
public virtual void OnDeserialization(object sender) => throw null;
16-
void System.Collections.ICollection.CopyTo(System.Array array, int index) => throw null;
17-
}
18-
19-
// Generated from `System.Collections.Specialized.NameValueCollection` in `System.Collections.Specialized, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
20-
public class NameValueCollection : System.Collections.Specialized.NameObjectCollectionBase
21-
{
22-
public string this[string name] { get => throw null; set => throw null; }
23-
}
24-
25-
}
26-
}
27-
namespace IO
28-
{
29-
// Generated from `System.IO.TextWriter` in `System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
30-
abstract public class TextWriter : System.MarshalByRefObject, System.IDisposable
31-
{
32-
public void Dispose() => throw null;
33-
}
34-
35-
}
36-
namespace Web
37-
{
38-
// Generated from `System.Web.HttpContext` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
39-
public class HttpContext : System.Web.IPrincipalContainer
40-
{
41-
public System.Web.HttpServerUtility Server { get => throw null; }
42-
public static System.Web.HttpContext Current { get => throw null; set => throw null; }
43-
}
44-
45-
// Generated from `System.Web.HttpRequestBase` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
46-
abstract public class HttpRequestBase
47-
{
48-
public virtual System.Collections.Specialized.NameValueCollection QueryString { get => throw null; }
49-
}
50-
51-
// Generated from `System.Web.HttpServerUtility` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
52-
public class HttpServerUtility
53-
{
54-
public string HtmlEncode(string s) => throw null;
55-
}
56-
57-
// Generated from `System.Web.HttpUtility` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
58-
public class HttpUtility
59-
{
60-
public static string HtmlEncode(string s) => throw null;
61-
}
62-
63-
// Generated from `System.Web.IHtmlString` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
64-
public interface IHtmlString
65-
{
66-
}
67-
68-
// Generated from `System.Web.IPrincipalContainer` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
69-
interface IPrincipalContainer
70-
{
71-
}
72-
73-
namespace Mvc
74-
{
75-
// Generated from `System.Web.Mvc.HtmlHelper<>` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
76-
public class HtmlHelper<TModel> : System.Web.Mvc.HtmlHelper
77-
{
78-
}
79-
80-
// Generated from `System.Web.Mvc.HtmlHelper` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
81-
public class HtmlHelper
82-
{
83-
public System.Web.IHtmlString Raw(string value) => throw null;
84-
public string Encode(string value) => throw null;
85-
}
86-
87-
// Generated from `System.Web.Mvc.IViewDataContainer` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
88-
public interface IViewDataContainer
89-
{
90-
}
91-
92-
// Generated from `System.Web.Mvc.IViewStartPageChild` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
93-
interface IViewStartPageChild
94-
{
95-
}
96-
97-
// Generated from `System.Web.Mvc.WebViewPage<>` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
98-
abstract public class WebViewPage<TModel> : System.Web.Mvc.WebViewPage
99-
{
100-
public System.Web.Mvc.HtmlHelper<TModel> Html { get => throw null; set => throw null; }
101-
}
102-
103-
// Generated from `System.Web.Mvc.WebViewPage` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
104-
abstract public class WebViewPage : System.Web.WebPages.WebPageBase, System.Web.Mvc.IViewStartPageChild, System.Web.Mvc.IViewDataContainer
105-
{
106-
}
107-
108-
}
109-
namespace WebPages
110-
{
111-
// Generated from `System.Web.WebPages.ITemplateFile` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
112-
public interface ITemplateFile
113-
{
114-
}
115-
116-
// Generated from `System.Web.WebPages.StringExtensions` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
117-
static public class StringExtensions
118-
{
119-
public static bool IsEmpty(this string value) => throw null;
120-
}
121-
122-
// Generated from `System.Web.WebPages.WebPageBase` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
123-
abstract public class WebPageBase : System.Web.WebPages.WebPageRenderingBase
124-
{
125-
public System.IO.TextWriter Output { get => throw null; }
126-
public override dynamic Page { get => throw null; }
127-
public override string Layout { get => throw null; set => throw null; }
128-
public override void Write(object value) => throw null;
129-
public override void WriteLiteral(object value) => throw null;
130-
}
131-
132-
// Generated from `System.Web.WebPages.WebPageExecutingBase` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
133-
abstract public class WebPageExecutingBase
134-
{
135-
protected void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) => throw null;
136-
protected void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) => throw null;
137-
public abstract void Execute();
138-
public abstract void Write(object value);
139-
public abstract void WriteLiteral(object value);
140-
public static void WriteLiteralTo(System.IO.TextWriter writer, object content) => throw null;
141-
}
142-
143-
// Generated from `System.Web.WebPages.WebPageRenderingBase` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
144-
abstract public class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile
145-
{
146-
public abstract dynamic Page { get; }
147-
public abstract string Layout { get; set; }
148-
public virtual System.Web.HttpRequestBase Request { get => throw null; }
149-
}
150-
151-
}
152-
}
3+
namespace Web
4+
{
5+
// Generated from `System.Web.HttpContext` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
6+
public class HttpContext : System.Web.IPrincipalContainer
7+
{
8+
public System.Web.HttpServerUtility Server { get => throw null; }
9+
public static System.Web.HttpContext Current { get => throw null; set => throw null; }
10+
}
11+
12+
// Generated from `System.Web.HttpRequestBase` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
13+
abstract public class HttpRequestBase
14+
{
15+
public virtual System.Collections.Specialized.NameValueCollection QueryString { get => throw null; }
16+
}
17+
18+
// Generated from `System.Web.HttpServerUtility` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
19+
public class HttpServerUtility
20+
{
21+
public string HtmlEncode(string s) => throw null;
22+
}
23+
24+
// Generated from `System.Web.IHtmlString` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
25+
public interface IHtmlString
26+
{
27+
}
28+
29+
// Generated from `System.Web.IPrincipalContainer` in `System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`
30+
interface IPrincipalContainer
31+
{
32+
}
33+
34+
namespace Mvc
35+
{
36+
// Generated from `System.Web.Mvc.HtmlHelper<>` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
37+
public class HtmlHelper<TModel> : System.Web.Mvc.HtmlHelper
38+
{
39+
}
40+
41+
// Generated from `System.Web.Mvc.HtmlHelper` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
42+
public class HtmlHelper
43+
{
44+
public System.Web.IHtmlString Raw(string value) => throw null;
45+
public string Encode(string value) => throw null;
46+
}
47+
48+
// Generated from `System.Web.Mvc.IViewDataContainer` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
49+
public interface IViewDataContainer
50+
{
51+
}
52+
53+
// Generated from `System.Web.Mvc.IViewStartPageChild` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
54+
interface IViewStartPageChild
55+
{
56+
}
57+
58+
// Generated from `System.Web.Mvc.WebViewPage<>` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
59+
abstract public class WebViewPage<TModel> : System.Web.Mvc.WebViewPage
60+
{
61+
public System.Web.Mvc.HtmlHelper<TModel> Html { get => throw null; set => throw null; }
62+
}
63+
64+
// Generated from `System.Web.Mvc.WebViewPage` in `System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
65+
abstract public class WebViewPage : System.Web.WebPages.WebPageBase, System.Web.Mvc.IViewStartPageChild, System.Web.Mvc.IViewDataContainer
66+
{
67+
}
68+
69+
}
70+
namespace WebPages
71+
{
72+
// Generated from `System.Web.WebPages.ITemplateFile` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
73+
public interface ITemplateFile
74+
{
75+
}
76+
77+
// Generated from `System.Web.WebPages.StringExtensions` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
78+
static public class StringExtensions
79+
{
80+
public static bool IsEmpty(this string value) => throw null;
81+
}
82+
83+
// Generated from `System.Web.WebPages.WebPageBase` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
84+
abstract public class WebPageBase : System.Web.WebPages.WebPageRenderingBase
85+
{
86+
public System.IO.TextWriter Output { get => throw null; }
87+
public override dynamic Page { get => throw null; }
88+
public override string Layout { get => throw null; set => throw null; }
89+
public override void Write(object value) => throw null;
90+
public override void WriteLiteral(object value) => throw null;
91+
}
92+
93+
// Generated from `System.Web.WebPages.WebPageExecutingBase` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
94+
abstract public class WebPageExecutingBase
95+
{
96+
protected void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) => throw null;
97+
protected void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) => throw null;
98+
public abstract void Execute();
99+
public abstract void Write(object value);
100+
public abstract void WriteLiteral(object value);
101+
public static void WriteLiteralTo(System.IO.TextWriter writer, object content) => throw null;
102+
}
103+
104+
// Generated from `System.Web.WebPages.WebPageRenderingBase` in `System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`
105+
abstract public class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile
106+
{
107+
public abstract dynamic Page { get; }
108+
public abstract string Layout { get; set; }
109+
public virtual System.Web.HttpRequestBase Request { get => throw null; }
110+
}
111+
112+
}
113+
}
153114
}

0 commit comments

Comments
 (0)