Skip to main content

Using SQL security features to isolate sensitive data inside a PoC

When writing a PoC you need to keep it as simple as possible and prove that from a technology perspective the project vision is feasible and is the right one. One of the fundamentals rules of a PoC is that it needs to cover things that are not general truth (e.g. You don’t want to prove that ASP.NET MVC can render HTML or expose an REST API).
Keeping a PoC as simple as possible can become a problem when you want to use customer data not only mocks data. When you have customer sensitive information, which should not be visible even to the development team you might end up in a strange situation.
The problem is not related on how you can do this. The biggest problem is the effort that you need to invest to create the deployment scripts or the automation mechanism that would allow the customer to deploy the solution in an isolated environment, where development team would not have access. This effort might require extra development effort that you don’t want to include in a PoC.
It is clear on how we can achieve this using a classical approach. We would need to separate environments for DEV and PoCWithRealData. We need to use a separate environment, deployed on a different infrastructure where development team don’t have access to it. Nothing special, but with a little more complexity level from deployment perspective. For PoC you might not want to create deployment scripts and other things like this, especially when things are not too complicated.

Let us take a look on how we can use Azure SQL (also applies for SQL Server) features to make our life more simple. In this context, we are starting from the assumption that all client confidential information are stored inside Azure SQL.
What if we would be able to allow development team to access only mock data from Azure SQL, without having access to the rest of the data? It is as creating a custom view for the development team that can be used to fetch only mock data, without being able to see or access other information.
This can be achieved using row-level security feature that is offered by Azure SQL. These features allow us to control and restrict user access to data from SQL tables based on their roles, enabling us to have a full control on what data can be accessed by each user.
Things that we need to do:
  • Create a user that has access to entire database and it is be used by customer to populate the database
  • Create the SQL script that populated storage with mock data
  • Grant access to development users/roles to have access to mock data by creating the right security policy
  • Create the migration script that would allow us to migrate confident data to storage
  • Migrate the client confident data
  • Test and validate with both users/roles
  • Share the access rights for mock data with the development team

In this moment, we have only one environments that can be used by both sides without any problems. The development team has access only to their mock data and it is impossible for them to access the real data as long as they use only their access rights.

To make things a little simpler, we can use the user information that are used to access the Web Application also to access the SQL instance. This would enable us to assign to our customer users a specific role in Azure AD that enable access to confidential data. Without this role, users can see only mock data.
An important thing that we need to keep in mind is how we can know that a row is mock data or customer confidential data. This can be achieved in two ways. The first option is to add an extra column that specify if data is real data or to have a specific range of values in the row ID for example that are reserved for mocks data.
In both cases, you need to ensure that the user/role that will be used by the development team has only reads data (SELECT). For extra rights, you need to use stored procedure or other mechanism to ensure that they will not alter confidential data.

Conclusion
This is only one way how we can simplify a PoC. Of course, the solution is not perfect. The biggest risk is from development team to get the admin access rights or to start to write inside the logs confidential data. Of course, both of these risks can be mitigate and kept under control. 

Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine: threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration: TeamCity .NET 4.51 EF 6.0.2 VS2013 It see

Navigating Cloud Strategy after Azure Central US Region Outage

 Looking back, July 19, 2024, was challenging for customers using Microsoft Azure or Windows machines. Two major outages affected customers using CrowdStrike Falcon or Microsoft Azure computation resources in the Central US. These two outages affected many people and put many businesses on pause for a few hours or even days. The overlap of these two issues was a nightmare for travellers. In addition to blue screens in the airport terminals, they could not get additional information from the airport website, airline personnel, or the support line because they were affected by the outage in the Central US region or the CrowdStrike outage.   But what happened in reality? A faulty CrowdStrike update affected Windows computers globally, from airports and healthcare to small businesses, affecting over 8.5m computers. Even if the Falson Sensor software defect was identified and a fix deployed shortly after, the recovery took longer. In parallel with CrowdStrike, Microsoft provided a too