1. Field of the Invention
The present invention is directed to secure database systems.
2. Description of the Related Art
Databases often contain data having different permission levels required for access. In most instances, databases store data in vertical columns and horizontal rows. Thus, a database may have one row or cell for which a first level of permission is required and a second row or cell for which a second level of permission is required. This is typical in databases used by the Intelligence Community (IC). In these situations, some users are to have access to data that other users are not permitted to access. Access of data within a database may also be limited in other fields, such as healthcare, finance, and other areas.
Currently, some databases provide row level security by generating an access table for combinations of every possible user access level and rows of data to be accessed. For each combination of user access level and row of data, the table indicates whether or not the user has permission to access the row. This method for providing row level access requires a large amount of memory space as well as processing power each time a user requests access to the data.
Other database solutions place artificial limits on the set of permissions or number of possible labels. They do this because the database software does not provide the flexibility to handle many combinations of user permissions. For example, from a security lattice of 1024 possible permissions combinations, only 21 may be supported (Smith's Lattice). This is in spite of the fact that there are essentially only 9 permissions options to choose from.
Some databases provide data in a single row with different permission levels. Typically, databases assign a permission level to the row that matches the highest cell permission requirement in the row. This prevents access to users who should have access to a particular cell but don't have the permission level of the highest cell in the row.
Other database systems generate a pre-determined number of secure data sets associated with different security levels. Requests for data are then compared to each data set. If a predetermined secure data set matches the data request, the matching secure data set is provided. If no existing data set matches the request, a predetermined secure data set associated with a security level less than that associated with the request is provided in response to the request.
Still other database systems utilize a set of distributed databases and broker access to them. This allows a user to access data from the database(s) having information that the user is cleared to access. Other secure database systems utilize a codebook and schema information to decrypt data received by a user station from a remote database. Accessing different databases in a distributed database system requires more processing time and doesn't provide for a central storage means for data. Additionally, most of the distributed database schemes provide row level security only.
Secure database systems may receive data from different sources. The received data is inserted into a database and made available to the appropriate users. The data sources often present the data permissions associated with the sent data in different formats. This makes it difficult to collaborate secure data between data sources and is cause in part for the generation and use of access tables to describe permission levels for individual rows of data for users.
The technology herein, roughly described, pertains to providing security at the row level and cell level of a database. One embodiment includes a method for generating an encryption key for a database field. First, data is accessed. Next, security information associated with the accessed data is derived. Then, one or more encryption keys are generated for the accessed data. The encryption keys are associated with the security information and with a database cell associated with the accessed data.
In another embodiment, a method is disclosed for providing access to a database. The method begins with receiving a set of user access tokens. Clearance information associated with each user access token is then retrieved. Next, a selected portion of the clearance information is associated with selected data within a database. Data access is then provided to the data associated with the selected portion of the clearance information.
In yet another embodiment, a method for managing meta-data begins with receiving one or more sets of data tokens. A category is then determined for each token. Next, a data label is generated for each set of data tokens. Finally, each token in the set of data tokens is associated with the determined category and generated data label.
Row level security (RLS) and cell level security (CLS) are implemented in a database. RLS and CLS can be used to provide secure dynamic access to data within a database for use by the Intelligence Community (IC) or other entities. In one embodiment, encryption keys are created based on either security classification meta-data tags associated with the individual fields of an incoming data stream or on the security classification of the source network. Thus, without prior knowledge of the incoming data security classification, the present system may generate encryption keys and, if necessary, security classification meta-data on the fly as it is received. The security classification meta-data can be used to encrypt record data down to the field (cell) level.
In one embodiment, user combinations of security clearance access tokens are mapped to sets of corresponding security classification tokens which represent data fields that the user is allowed to retrieve. Security clearance access tokens are dynamically constructed based on the security classification of data currently in the database.
Unlike the present invention, prior systems may use a traditional approach of creating tables having rows containing all possible security classifications and columns with all security clearances. Prior Database Management Systems (DBMS) provide tables with cells which indicate whether a particular user security classification is permitted to access data having a specific security classification. Other prior systems place artificial limits on the number of possible labels. In some cases, a limited number of categories are allowed (for example, three) and the attributes of the categories are fixed.
In utilizing the dynamically constructed security clearance access tokens, the present invention does not require prior knowledge of the data security classification labels or use of a prohibitively large master table containing all possible security classification labels and corresponding security clearance tokens. Additionally, the data and data processing engines of a DBMS for use with the present invention are contained in a single location. These and other features of the present invention are discussed in more detail below.
A user-accessible view is generated from a base table of data. A user may query the user-accessible view for data. A result set of data may be provided to a user in response to the user request. A view is a construct, or object, in a database that is declared statically. The view is defined with query definitions against another data source, such as a base table. Thus, a view is an object that provides information contained in a parent view or table without necessarily providing access to the underlying parent view or table.
In one embodiment, the process of providing data to a user begins with modifying a base table containing data to include classification information with the base table rows and/or cells. A user accessible view is then created that contains all the data and classifications of the underlying base table. A result set is then generated in response to a query made against the user-accessible view that contains only the data of the user-accessible view that the requesting user has permission to see. No additional information or data is provided to the user upon a request for data. This data model involving a base table, user-accesible view and result set is discussed in more detail below.
In one embodiment, RLS and CLS are implemented using security labels. A security label is a piece of information that describes the sensitivity of data or an object. In one embodiment, a security label can be implemented as a string containing markings from one or more categories. Users or subjects have permissions described with labels from the same domain of markings. In the case of a user label, the markings of the label comprise the tokens associated with the user. Given two labels A and B, label A is considered to dominate label B if every category present in label B is satisfied by markings on level A. As used herein, a security label for a user may be called a “subject label” while a security label for data may be called a “object label”. A subject label may be expressed as membership in security groups from the underlying database management system or operating system.
Several variations of labels may be used to manage access to databases. For example, different labels may be used by IC, healthcare, finance, and other entities. For IC applications, accessibility of an object utilizes labels having categories of “classification”, “compartment”, “releasability by nationality” and “need to know”. The classification category includes markings of “top secret”, “secret”, “confidential”, and “unclassified”. In one embodiment, classification is hierarchical. Thus, a user with a classification marking of “secret” is said to dominate labels having a classification of “secret”, “confidential”, and “unclassified”. A compartment category describes a group of people within a department or within a boundary of access that have been determined to have access to designated data. Examples of compartment markings include “BN”, “W”, and “Q”. The category of “releasibility by nationality”, or “nationality”, indicates countries or groups of countries of which a user is associated with. Examples of nationality markings include “US” and “GB” (Great Britain). A need to know category includes markings indicating additional access clearances. The typical markings within the need to know category are usually “A”, “B”, “C”, etc. In one embodiment, a label may be implemented by a marking from each category separated by a double slash. For example, a user label may be implemented as TS//Q,Z//US//A, corresponding to markings of “top secret”, compartments “Q” and “Z”, nationality of “US”, and need to know group of “A”. The external format of the security label is immaterial to the invention, however. Any format could be used; and in one embodiment the label is canonicalized into an unambiguous internal format. This is discussed in more detail below.
In one embodiment, categories can be characterized by attributes such as domain, hierarchy, cardinality, and comparison rules. The domain of a category indicates the range of possible markings within the category. Hierarchical categories have an ordering among values which determine access. A marking can satisfy any marking at or below its level in the hierarchy. Non-hierarchical categories have no ordering among values. Cardinality describes the number of values from the domain that can be applied to an object. A comparison rule describes whether the subject must have any or all of the markings applied to the object from this category.
RLS and CLS are implemented primarily by server 110. In one embodiment, database server 110 may be implemented as an SQL server provided by Microsoft Corporation of Redmond, Wash. Database server 110 is configured to receive data from data source 120 through network 130. Database server 110 includes encryption engine (EE) 112 and key and certificate store (KCS) 114. EE 112 can be used to encrypt and decrypt data at the row level or cell level within a database, and is discussed in more detail below. KCS 114 is used to store and maintain keys for encrypting and decrypting data as well as certificates used to encrypt and decrypt the keys themselves. This is discussed in more detail below. Each of networks 130, 132 and 134 may be implemented as a private network, a secure network, or a public network such as the Internet.
Data is received by ingestion engine 140 over network 130. In one embodiment, ingestion engine 140 can be implemented separate from or within database server 110. Ingestion engine 140 receives data, processes the received data and loads the data into one or more databases maintained by database server 110. In one embodiment, ingestion engine 140 may receive data from an external database or a direct acquisition source. The received data may or may not be associated with security labels and/or additional signatures. In some cases, ingestion engine 140 will append data with digital signatures and then provide the data and signatures to database server 110. Processing of received data is discussed below with respect to method 300 of
Data maintained by database server 110 can be accessed by user 150 through application 160. In one embodiment, a user 150 may be a person or entity that requests to view data within database server 110. As illustrated, user 150 may access an application over network 132. When user 150 requests a connection with database server 110, database server 110 initiates a connection with authorization query agent 170. In response, authorization query agent 170 forms a connection with user clearance store 180. User clearance store 180 is queried in order to authenticate requesting user 150.
In some embodiments, user clearance store 180 may be implemented locally on database server 110 (not illustrated in
The invention is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
With reference to
Computer 210 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 210 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by computer 210. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of the any of the above should also be included within the scope of computer readable media.
The system memory 230 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 231 and random access memory (RAM) 232. A basic input/output system 233 (BIOS), containing the basic routines that help to transfer information between elements within computer 210, such as during start-up, is typically stored in ROM 231. RAM 232 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 220. By way of example, and not limitation,
The computer 210 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media discussed above and illustrated in
The computer 210 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 280. The remote computer 280 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 210, although only a memory storage device 281 has been illustrated in
When used in a LAN networking environment, the computer 210 is connected to the LAN 271 through a network interface or adapter 270. When used in a WAN networking environment, the computer 210 typically includes a modem 272 or other means for establishing communications over the WAN 273, such as the Internet. The modem 272, which may be internal or external, may be connected to the system bus 221 via the user input interface 260, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 210, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
The data label is modified as needed at step 320. For example, data may be received from a network in which only US nationals are allowed access. Data retrieved from this network may not necessarily indicate that the data should only be provided to individuals of US nationality. In this case, ingestion engine 140 may detect that US nationality is required to access the data and will modify markings in the label to reflect this fact.
In one embodiment, canonicalization of labels is performed on data labels received at step 320. This ensures the markings are unambiguous in format and order and aids for accurate comparison. For example, data markings of US, “US only”, and “domestic only” may indicate that only US nationals are intended to have access to view a particular piece of data. As a result of the canonicalization, raw labels of “US”, “US only”, and “domestic only” markings are represented by a uniform marking of “US”. In one embodiment, the raw labels attached to the received data may be retained as well.
After labels are formatted as needed, a determination is made as to whether the data has a valid signature at step 325. If the data does not contain a valid signature, then operation continues to step 330. If the data does contain a data signature, then operations continue to step 345. In one embodiment, a data signature is determined to be valid by comparing a generated cryptographic hash mark derived from the received data to the received data signature.
At step 330, a determination is made as to whether the label associated with the data is valid. In one embodiment, the label is valid if the markings of the label categories comply with a standard label format of the present system. In one embodiment, this determination may be performed above with respect to step 320. If the label is determined not to be valid, data is rejected at step 335. If the label is determined to be valid, then a digital signature is generated at step 340. Operation then continues to step 345.
The data and signature are inserted into a database at step 345. The data and signature are provided to database server 110 by ingestion engine 140. Once inserted, the security label associated with the received data at step 345 can be applied at a database row or cell.
If a determination is made that data is not labeled at step 315, a determination is made whether the data source of the received data has a security setting at step 355. Since the received data is not labeled, the security setting for the data is determined from sources besides a label. If the security setting of the data source from which the data was received cannot be determined, operation continues to step 360. If the data source from which the data is received does have a determinable security setting, operation continues to step 365. At step 360, data is labeled with the source network security classification. For example, if the source network requires a security classification of “secret” to access the network, the security classification of the received data will be set to “secret”. Operation then continues to step 370.
At step 365, the received data is labeled with the data source security classification. This is performed similarly as in step 360 regarding network security classification. Next, a label associated with the data is modified as needed at step 370. In one embodiment, label modification performed at step 370 is similar to label modification performed at step 320. Next, a digital signature is generated for the received data at step 375. Digital signature generation at step 375 is similar to digital signature generation at step 340. The data and generated signature are then provided to a database as step 380. In one embodiment, a security label associated with data received without a label can be used for RLS within a database.
The base table is modified as needed at step 470. In an embodiment wherein RLS is implemented in the database, RLS information is added to a base table. This is discussed in more detail with reference to
The category and marking table models and tables are used to generate a labeling scheme. Category table model 510 defines label categories to be used for a particular database. Category table model 510 indicates that a corresponding table may include categories of identification, name, compare rule, cardinality, and default role. In one embodiment, all of the categories or a subset of the categories can be used in a corresponding table. As illustrated, table 520 includes categories of name, compare, and default role. The category types can be named classification, compartment, nationality, and need to know. The corresponding compare roles for the named categories are any, all, any, and any. The default roles are all public except for classification, which has a default role of null. Marking table models 512 define a domain for each category of category table model 510. Marking table 522 illustrates an example of a domain for the classification category. The category ID of marking table 522 is one, corresponding to the classification category. The roles of T, S, C, and U are listed, corresponding to top secret, secret, confidential, and unclassified. Additional attributes of the marking table model 512 include role name, marking string, description, parent category ID, and parent role name. Parent category ID and parent role name are used when the markings within a category are hierarchical. As illustrated in table 522, parent category ID for the particular markings are listed as null, one, one, and one. The parent roles for T, S, C, and U are null, T, S, and C, respectively.
Table models 514 and 516 and corresponding tables 524 and 526 are used for access mapping purposes. Access mapping is discussed in more detail with respect to
In one embodiment, when an SQL server is used, code statements can be used to set up the meta-data tables. A portion of the code statements for generating tables of
—Categories
INSERT tblcategory (ID, Name, CompareRule, DefaultRole)
VALUES (1, ‘Classification’, ‘ANY’, NULL)
INSERT tblCategory (ID, Name, CompareRule, DefaultRole)
VALUES (2, ‘Compartment’, ‘ALL’, ‘public’)
INSERT tblCategory (ID, Name, CompareRule, DefaultRole)
VALUES (3, ‘Nationality’, ‘ANY’, ‘public’)
INSERT tblCategory (ID, Name, CompareRule, DefaultRole)
VALUES (4, ‘Need-to-Know’, ‘ANY’, ‘public’)
GO
—Classification markings
INSERT tblMarking (CategoryID, RoleName, MarkingString, ParentCategoryID, ParentRoleName) VALUES (1, ‘T’, ‘T’, NULL, NULL)
INSERT tblMarking (CategoryID, RoleName, MarkingString, ParentCategoryID, ParentRoleName) VALUES (1, ‘S’, ‘S’, 1, ‘T’)
INSERT tblMarking (CategoryID, RoleName, MarkingString, ParentCategoryID, ParentRoleName) VALUES (1, ‘C’, ‘C’, 1, ‘S’)
INSERT tblMarking (CategoryID, RoleName, MarkingString, ParentCategoryID, ParentRoleName) VALUES (1, ‘U’, ‘U’, 1, ‘C’)
—Compartment Markings
INSERT tblMarking (CategoryID, RoleName, MarkingString)
VALUES (2, ‘Q’, ‘Q’)
INSERT tblMarking (CategoryID, RoleName, MarkingString)
VALUES (2, ‘Z’, ‘Z’)
INSERT tblMarking (CategoryID, RoleName, MarkingString)
SELECT 2, DefaultRole, ‘none’ FROM tblCategory WHERE ID=2
Though only statements that configure markings for classification and compartment are shown, additional code can be used to implement the remainder of the marking as well as additional tables.
As discussed above in method 440, a base table may be modified as needed at step 470.
After the query is made at step 810, a determination is made as to whether more user label categories exist. If more user label categories exist, then operation continues to step 830. If no more user label categories exist, operation continue step 840. In one embodiment, a query is done for each user category in a user label. At step 830, a query is performed for a unique label ID having category markings of which the user is a member of the next category. Returning to the example user label, a second query is performed for the category of “compartment” at step 830. This query will search table 524 and retrieve every unique label ID corresponding to a category ID of 2 and a marking name of Q (the user's compartment). After the query has been performed in step 830, operation continues to step 820 where additional queries are performed for the remaining categories on the user label. In the case of the example user labels, additional queries are performed for unique label IDs corresponding to a category of three and a marking of US and a category of four and a marking of A.
At step 840, a determination is made as to the unique label IDs for which the user is a member of all the categories. Thus, the label IDs that are common in all the user category queries at step 810 and at step 830 are selected. In one embodiment, an AND operation is performed to the query results of the queries performed at step 810 and 830. In one embodiment, an AND operation is performed between all the predicate clauses discussed above. An example of this is illustrated below.
In one embodiment, wherein the database is a SQL server, predicate language can be used to perform the query against a unique label marking table. A query statement may begin with the statement below.
SELECT ID, Label.ToString( )
FROM tblUniqueLabel WITH (NOLOCK)
WHERE
The where clause definition is based on the category attributes in the desired labeling scheme. The relevant attribute is Comparison Rule. For each category that has a Comparison Rule of ANY (such as categories of “classification”, “nationality”, and “need to know”), the following predicate can be added to the WHERE clause:
ID IN (SELECT ID FROM tblUniqueLabelMarking WITH (NOLOCK)
WHERE CategoryID =<HardCodedCatID>AND
IS_MEMBER(MarkingRoleName)=1)
The above clause retrieves all the unique label id's containing markings from the given category of which the current user is a member. The sub-query is scanning the tblUniqueLabelMarking table for rows in a certain category. From among these rows, it is choosing the rows which the current user is a member of the database role named in the MarkingRoleName column. This can be accomplished with the SQL Server intrinsic function IS_MEMBER. For each of these rows, the ID of the corresponding record in tblUniqueLabel is returned to the outer query.
For each category that has a Comparison Rule of ALL (for example, the category “compartment”), the following predicate can added to the WHERE clause:
1=ALL(SELECT IS_MEMBER(MarkingRoleName) FROM tblUniqueLabelMarking (NOLOCK)
WHERE CategoryID=<HardCodedCatID>AND UniqueLabelID=tblUniqueLabel.ID)
This predicate will result in comparisons which require the user to have all of the applied labels in order to have access. The sub-query gets a list of values returned by IS_MEMBER for every related marking for a given record in tblUniqueLabel. If all of these return values are 1, the predicate is satisfied. Adding the predicates together with an AND operator between them provides a definition for an intermediate view of user label IDs as follows:
CREATE VIEW vwVisibleLabels
AS
SELECT ID, Label.ToString( )
FROM tblUniqueLabel WITH (NOLOCK)
WHERE
ID IN
(SELECT ID FROM tblUniqueLabelMarking WITH (NOLOCK)
WHERE CategoryID=1 AND IS_MEMBER(MarkingRoleName)=1)
AND
1=ALL(SELECT IS_MEMBER(MarkingRoleName) FROM tblUniqueLabelMarking
WHERE CategoryID=2 AND UniqueLabelID=tblUniqueLabel.ID)
AND ID IN
(SELECT ID FROM tblUniqueLabelMarking WITH (NOLOCK)
WHERE CategoryID=3 AND IS_MEMBER(MarkingRoleName)=1)
AND ID IN
(SELECT ID FROM tblUniqueLabelMarking WITH (NOLOCK)
WHERE CategorylD=4 AND IS_MEMBER(MarkingRoleName)=1)
GO
A cardinality attribute may indicate the number of fields in a label. For a cardinality of “1”, the number of markings may be constrained on one label using triggers. Alternatively, the category may be de-normalized into a field in the tblUniqueLabel table of
A Compare Rule attribute may indicate how to compare security labels. A Compare Rule attribute may have values of either “ANY” or “ALL”. A value of “ANY” allows a subject label to dominate a data security label if the subject label category satisfies any of the corresponding data security label categories. An example of a where-clause predicate that can be used to implement this design implication is listed below:
ID IN (SELECT ID FROM tblUniqueLabelMarking WITH (NOLOCK)
WHERE CategoryID=n AND IS_MEMBER(MarkingRoleName)=1)
A value of “ALL” allows a subject label to dominate a data security label if the subject label category satisfies all of the corresponding data security label categories. An example of a where-clause predicate that can be used to implement this design implication is listed below:
1=ALL(SELECT IS_MEMBER(MarkingRoleName) FROM
tblUniqueLabelMarking (NOLOCK)
WHERE CategoryID=n AND UniqueLabelID=tblUniqueKeyToLabelMappingID)
Once the unique label IDs are determined for which the user is a member of all the categories, a view of the user visible labels is generated from the query results at step 850. In one embodiment, the view of user visible labels is a list of unique label IDs of which the user label dominates. By performing a number of queries on table 524, a list of unique label IDs dominated by the user label can be determined without having to maintain or generate a database comprising every conceivable unique security label.
In an embodiment wherein an SQL server is used, the user accessible view, which effectively replaces the base table in the eyes of all users, can be generated using statements below:
CREATE VIEW UserTable
AS
SELECT <base table column list which does not include RLSMappingID, or any columns from vwVisibleLabel>
FROM tblBaseTable, vwVisibleLabel
WHERE tblBaseTable.RLSMappingID=vwVisibleLabel.ID
GO
GRANT SELECT ON UserTable TO<app_users>
DENY ALL ON tblBaseTable TO<app_users>
GO
Rows in a table may be inserted, updated and deleted. A database administrator may configure whether a DBMS allows a user with the required permissions to change table rows or not. In one embodiment, a DBMS that allows a user to update table rows provides for inserting and/or updating the user accessible row, providing valid row labels, generation of new label mapping identification as needed or resolving labels to existing identification, enforcement of write-down and/or write-up logic as required, and performing the insert and/or update action to the underlying base table.
An instead-of trigger may check the validity of labels, generate or retrieve the label mapping identifications, enforce write permission checks and handle the actual insert or update against the base table. The validity of labels may be checked by first converting a row label string to an instance of a user-defined type. The instance of the user-defined type describes the current user's permissions. An example of a portion of code for use with a SQL server for determining an instance of the user-defined type is below:
EXECUTE AS CALLER
SELECT @CallerName=CURRENT_USER
REVERT
DECLARE @UserClearance [SecurityLabel]
SET @UserClearance=dbo.GetUserTickets(@CallerName)
In one embodiment, a user defined function GetUserTickets may be used to examine role memberships of the current user and generate a label describing the user permission level. The user's permission level can then be compared to any other label. For implementing a write-down only requirement, code for use with an SQL server can be used as follows:
IF @UserClearance.HasAccessTo(@RowClassification)=0
RAISERROR(‘user rights not sufficient to write this data’, 12, 1)
The user's permission level is compared to a permission level required to write to a database row. The permission level required to write to the database may be the same or different permission level required to read the database row. Once the user permission level is determined to be sufficient to update the row, the mapping identification for the row label is determined. Determining the mapping identification may include accessing the existing mapping identification or generating a new mapping identification if one is required for a newly added row. Once the mapping identification information is determined, the database row can be updated.
An example of code that may be used to implement an instead-of trigger discussed above is shown below:
CREATE TRIGGER dbo.IO_Insert_titles ON titles
INSTEAD OF INSERT
AS
DECLARE @RLSMappingID int
DECLARE @KeyMappingID int
DECLARE @KeyName nvarchar(256)
DECLARE @CertName nvarchar(256)
DECLARE @KeyGUID uniqueidentifier
DECLARE @KeyAlreadyOpen bit
DECLARE @CallerName sysname
BEGIN TRY
—Bail if @@ROWCOUNT>1 (temporary)
IF @@ROWCOUNT>1
—Ensure row_label and advance_label are NOT NULL, not blank, and are valid
DECLARE @RowLabel nvarchar(256)
DECLARE @AdvanceCellLabel nvarchar(256)
SELECT @RowLabel=row_label, @AdvanceCellLabel=advance_label
FROM inserted
IF @RowLabel IS NULL OR LEN(LTRIM(RTRIM(@RowLabel)))=0
IF @AdvanceCellLabel IS NULL OR
LEN(LTRIM(RTRIM(@AdvanceCellLabel)))=0
RAISERROR(‘advance_label is required’, 12, 1)
—Attempting to cast to SecurityLabel will validate the label string
DECLARE @RowClassification [SecurityLabel]
SELECT @RowClassification=CONVERT([SecurityLabel], @RowLabel)
DECLARE @AdvanceClassification [SecurityLabel]
SELECT @AdvanceClassification=CONVERT([SecurityLabel], @AdvanceCellLabel)
—Check write-down logic
EXECUTE AS CALLER
SELECT @CallerName=CURRENT_USER
REVERT
DECLARE @UserClearance [SecurityLabel]
SET @UserClearance=dbo.GetUserTickets(@CallerName)
IF @UserClearance IS NULL
IF @UserClearance.HasAccessTo(@RowClassification)=0
IF @UserClearance.HasAccessTo(@AdvanceClassification)=0
—Get RLSMappingID for row_label
exec usp_GetRLSMappingID @RowLabel, @RLSMappingID OUTPUT
—Get KeyName and CertName for advance_label
exec usp_GetKeyForMarking @AdvanceCellLabel, @KeyMappinglD OUTPUT, @KeyName OUTPUT, @CertName OUTPUT, @KeyGUID OUTPUT exec usp_lsKeyOpen @KeyName, @KeyAlreadyOpen EXEC(‘open symmetric key’+@KeyName+‘using certificate ’+@CertName)—
—Do insert, including rls_mapping_id and encryption of advance
INSERT INTO tblTitles
(title_id, title, type, pub_id, price, advance, advance_encrypted, advance_label, royalty,
ytd_sales, notes, pubdate, row_label, rls_mapping_id)
SELECT title_id,
FROM inserted
END TRY
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(400);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
SELECT @ErrorMessage=ERROR_MESSAGE( );
SELECT @ErrorSeverity=ERROR_SEVERITY( );
SELECT @ErrorState=ERROR_STATE( );
IF @KeyName IS NOT NULL AND @KeyAlreadyopen=0
—suppress error
END CATCH
GO
CLS involves providing different levels of clearance to different cells in the database.
In one embodiment, a CLS database may be associated with meta-data tables that include encryption keys. Cell level encryption is used to implement cell level security clearance.
In one embodiment, the encryption is performed internally by the database server. For example, an SQL server has an internal capability to encrypt individual cells within a database. In one embodiment, EE 112 generates keys as needed for database server 110. Thus, as data is received for encryption within a cell, EE 112 generates a key to encrypt the cell data. The keys are then stored at KCS 114. The keys can be used to encrypt and decrypt data are associated with a key certificate. The key itself can be encrypted and decrypted using the certificate, which is also stored in KCS 114. As discussed above, a unique label table such as unique label table 526 may include columns of unique label IDs, unique security label as well as the name of the key associated with a unique security label as well as the certificate name used to decrypt the key. In this case, a key is used to decrypt the security label and the certificate name is used to retrieve a certificate required to decrypt the key. In one embodiment, similar to RLS databases, a database implementing CLS can be modified to include a column for each database cell label.
An embodiment of a method 1000 for generating a data set derived from incorporating CLS is illustrated in
In one embodiment, database server 110 can maintain multiple open keys. An open key is a key retrieved from KCS 114 and made available for decrypting data. When a piece of data is to be decrypted, the key required need not be specified. EE 112 is able to match the encrypted byte stream to an open key if the correct key has been decrypted (using a certificate) and is open. The key will then be used to perform decryption and return the data. If the correct key is not open, a null value is returned. In this case, no indication that data exists in the cell will be presented to a user. In one embodiment, CLS may be implemented by creating a symmetric key for each unique label used to mark data in the database, encrypting data in labeled cells with the corresponding key, and controlling access to keys such that the keys which map to labels dominated by the user's label are opened. This provides a simple-way to have these keys opened when the connection is established by the requesting user.
Returning to method 1000, a user request for data is received at step 1010. Next, a user is authenticated at step 1020. User authentication at step 1020 is similar to user authentication performed at step 720 of method 700. Next, user visible labels are generated at step 1030. Generation of user visible labels for CLS is similar to generation of user visible labels performed in step 730 of method 700 and method 800 as discussed above. Next, keys which map to the user visible cells are opened at step 1040. In one embodiment, keys associated with a user label are opened automatically at the time of the user connection with database server 110. This is discussed below with respect to method 1100 of
In one embodiment, when database server 110 is implemented by an SQL server, a view may be generated be the code statements below.
CREATE VIEW UserTable
AS
SELECT ID,
DecryptByKey(SensitiveData),
CONVERT(money, CONVERT(varchar(50),
DecryptByKey(SensitiveMoneyData))),
NonSensitiveData,
FROM tblBaseTable, vwVisibleLabel
WHERE tblBaseTable.RLSMappingID=vwVisibleLabel.ID
GO
GRANT SELECT ON UserTable TO <app_users>
DENY ALL ON tblBaseTable TO <app_users>
GO
In one embodiment, when database server 110 is implemented by an SQL server, opening keys can be performed by the code statements below.
CREATE PROCEDURE usp_EnableCellVisibility
WITH EXECUTE AS ‘KeyBroker’
AS
DECLARE @KeyName nvarchar(256)
DECLARE @CertName nvarchar(256)
DECLARE Key_Cursor CURSOR LOCAL FORWARD_ONLY STATIC FOR
SELECT KeyName, CertName
FROM vwVisibleLabels
EXECUTE AS CALLER
—Since the cursor is STATIC, it is fully
—populated here based on the caller's identity
OPEN Key_Cursor
REVERT
FETCH NEXT FROM Key_Cursor INTO @KeyName, @CertName
WHILE @@FETCH_STATUS=0
BEGIN
open symmetric key @KeyName using certificate @CertName
FETCH NEXT FROM Key_Cursor INTO @KeyName, @CertName
END
CLOSE Key_Cursor
DEALLOCATE Key_Cursor
GO
The foregoing detailed description of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. The described embodiments were chosen in order to best explain the principles of the invention and its practical application to thereby enable others skilled in the art to best utilize the invention in various embodiments and with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims appended hereto.