You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C#: Remote flow source members miss properties with backing fields, get-only collections and inherited members #23150
For ASP.NET and ASP.NET Core remote flow sources, TaintedMember only taints a narrow set of members on bound model types. Binders such as the MVC model binder and XmlSerializer also populate other kinds of members, so some request data flows through them without CodeQL seeing it. This causes false negatives in the C# security queries.
Missing cases
Properties that wrap a backing field. The getter returns the field and the setter assigns value to it, for example get { return f ?? ""; } set { f = value; }. Only auto-implemented properties were tainted.
Get-only collection properties. Binders add elements in place, for example public List<string> Items { get; } = new();. This also covers properties that return a backing field or use lazy initialisation (items ??= new()).
Members inherited from a base type. This includes properties whose backing field is declared on a base class.
Constants.const fields are currently treated as candidates, but they can never carry request data.
Cases that must stay untainted
Properties whose getter computes a value, such as => new List<T>(items) or backing + "x".
Properties whose setter ignores value.
Getters that overwrite the field before returning it.
Getters and setters that access the field on different instances.
Get-only arrays, which binding cannot modify.
Proposed fix
Extend CandidateMemberToTaint and AspNetRemoteFlowSourceMember in csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll to cover the cases above. Add test coverage in library-tests/dataflow/flowsources/{aspremote,remote} and a change note.
Known limitation
Read-only collection types such as SynchronizedReadOnlyCollection<T> still qualify, because they inherit from ICollection<T> and CollectionType can't distinguish them.
Activity