mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Add NHibernate SQL injection tests
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace TestNHibernate
|
||||
{
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
class SqlInjection
|
||||
{
|
||||
private string connectionString;
|
||||
public TextBox untrustedData;
|
||||
|
||||
public void InjectUntrustedData(NHibernate.ISession session, NHibernate.IStatelessSession statelessSession, NHibernate.Impl.AbstractSessionImpl impl)
|
||||
{
|
||||
session.CreateSQLQuery(untrustedData.Text); // $ Alert[cs/sql-injection]
|
||||
|
||||
statelessSession.CreateSQLQuery(untrustedData.Text); // $ Alert[cs/sql-injection]
|
||||
|
||||
impl.CreateSQLQuery(untrustedData.Text); // $ Alert[cs/sql-injection]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user