Franc Stratton's .NET (TM) Web Application, OOP, and SOA Architecture & Programming Site

A site devoted to ASP.NET (TM), SilverLight (TM) and Browser-Based WPF (TM) Applications, IIS Services, and OOP Architectures

Home     Architecture Overview     WF/WCF/WPF     Data Store     Standards     .NET Security     Resources     jQuery     Silverlight     Developer Tips     Blog     Site Map      
Input validation
Authentication
Forms Authentication
Authorization
Configuration Mgt
Sensitive Data
Session Mgt
Cryptography
Parameters
Exception Mgt
Auditing/Logging
SQL Injection
Cross-site Scripting
String Validation
.Database management procedures to help prevent unauthorized tampering:
 

Sensitive data protection will be managed through Role-based authorization, but some personally identifiable information may be encrypted per the requirements of Federal, State, or organization policies. Application sponsors or stakeholders may designate that certain users might have read-only access, and these specified persons will not be able to update or insert data from certain web forms. Application sponsors or stakeholders may also choose to allow certain users limited access to information such as only the last four digits of a Social Security Number. Sensitive data like Social Security Numbers should not be used as primary keys for any organization .NET database tables.

 

Generally, application users and many organization .NET Development Group developers will not have direct access rights to any tables in a production database. Access will only be allowed through production database user views or application stored procedures. Development databases will only contain “dummy” data that has no real value except for testing.

 

An example of protecting sensitive data is the database connection string. The organization has chosen to store SQL Server connection string in an encrypted format in a centrally-accessed database. When an ASP.NET application starts up, a procedure in the Global.asax file calls the database through an application service, and stores the encrypted connection strings (there may be more than one; e.g. synchronous and asynchronous strings) in an application object variable:

 

protected void Application_Start(object sender, EventArgs e)

    {

        //Get the Application ID from the web.config file

        string appID = ConfigurationSettings.AppSettings["AppKey"];

        //Convert the Application ID from string to integer, call the service,

        //pass the Applicaiton ID parameter, assign the returning object

        //to the data contract object instantiated above

        appData = svc.GetAppDataByApplicationID(Convert.ToInt32(appID));

        //Assign the contract data to the Application Object properties

        appInfo.ApplicationID = appData.ApplicationID;

        appInfo.EnvironmentID = appData.EnvironmentID;

        appInfo.SyncConnectionString = appData.SyncConnectionString.Trim();

        appInfo.AsyncConnectionString = appData.ASyncConnectionString.Trim();

        //Store the Application Object in an application variable

        Context.Application["AppInfo"] = appInfo;

        //Get rid of the objects instantiated above in application end

    }

 

When the application requires access to the database connection string, then a call is made through the domain BLL where the connection string is decrypted at the server with a 3DES method accessed in the base BLL.

 

///--------------------------------------------------------------------------

/// <summary>

/// Method Name: GetDataPage

/// Description: Retrieves encrypted stored procedure name and parameter and

///              decrypts prior to populating the generic list.  Encryption

///              used is 3DES from AppBase assembly.

/// </summary>

///

/// <param name="Encrypted Stored Procedure Name">tag</param>

/// <param name="Search parameter for grid filter">searchParameter</param>

/// <param name="Column with which to sort on">sortExpression</param>

/// <param name="Default Sort Column">demoTableDefaultOrderBy</param>

/// <returns>generic object User</returns>

///--------------------------------------------------------------------------

public List<UserHistory> GetDataPage(string tag, string searchParameter, string sortExpression)

{

    ApplicationStartBLL appInfo = new ApplicationStartBLL();

    appInfo = (ApplicationStartBLL)HttpContext.Current.Application["AppInfo"];

    var DALLayer = new UserHistoryDAL();

    string sqlConnString = Decrypt3DES(appInfo.SyncConnectionString);

    return DALLayer.GetDataPage(tag, searchParameter, sortExpression, sqlConnString);

}