Privileged account management and control method and device based on database limited query

Through the PIM JDBC driver package analysis and unified policy control module, the complexity and security threat issues of query management of privileged accounts of different database types are solved, and the permission management and security risks of privileged accounts are realized.

CN119026156AInactive Publication Date: 2024-11-26AVICIT CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411248948.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-11-26
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology cannot effectively and uniformly manage the behavior of privileged accounts of different database types in table query, resulting in security threats such as overprivileged use, abuse of permissions, abnormal access and illegal operations, and the differences in SQL syntax lead to complex front-end development.

Method used

Through the PIM JDBC driver package, the syntax parser is used to generate a syntax tree, judge and restrict the query of privileged accounts, and provides a unified policy control module, set query restrictions based on the actual table name, avoid SQL syntax differences, and realize permission management of privileged accounts.

Benefits of technology

It realizes effective control of privileged accounts such as operation and maintenance personnel, limits the number of queries and rows, avoids security risks, adapts to most database types, provides unified policy configuration, and ensures database security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119026156A_ABST
    Figure CN119026156A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a privileged account management and control method and device based on database limited query, and the method comprises the steps: configuring drive connection information through a business configuration interface, and configuring a privileged user and a control strategy of a to-be-looked-up table through a strategy controller configuration interface; the PIM JDBC driving program package analyzes the to-be-analyzed statement by using a grammar analyzer to generate a syntax tree, judges whether a clause belonging to a sub-query or a first-level query exists in the to-be-analyzed statement or not, and obtains an actual table name of a to-be-looked-up table in a database; and starting a filtering condition set in the control strategy of the privileged account so as to release, prohibit or limit query of the to-be-looked-up table by using the actual table name of the to-be-looked-up table in the database, and filtering a query result. According to the technical scheme of the invention, security threats such as privilege exceeding use, privilege abuse, abnormal access, illegal operation and the like can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of database query management and control, and in particular to a privileged account management and control method and device based on database limited query. Background Art

[0002] With the construction of informatization, security and standardization are increasingly valued, especially by regulatory authorities, who have strengthened internal control of enterprises by issuing various laws, regulations and related guidance. As the core of business, databases are of great importance to management departments, but they face security threats such as unauthorized use, abuse of authority, abnormal access, and illegal operations. A set of behavioral risk restrictions for databases is needed to meet security specifications.

[0003] Perform data range control in table queries for database privileged accounts. For example, implement a limit on the number of rows returned in data query results for development and operation personnel. The query results for key data tables must not exceed the limit, the number of queries within 1 minute must not exceed the limit, and the total number of queries per day must not exceed the limit.

[0004] There are many types of relational data on the market. Although structured query language is basically used as the standard language to perform operations such as adding, deleting, modifying and querying data, there are still certain differences in syntax details among MySQL, DB2, ORACLE, SQL Server, etc., which leads to the need to select different SQL writing methods according to the specific type of database when developing front-end programs, and it is impossible to achieve true unification.

[0005] In summary, it is necessary to design and develop a privileged account management and control device and method based on limiting the number of queries and rows in a specified database table, realizing automatic adaptation of database drivers, and PIMJDBC (Java Database Connection) drivers based on standard SQL (Structured Query Language) syntax, eliminating the differences between various types of databases, and performing policy control on data queries to prevent unauthorized use, abuse of authority, abnormal access, illegal operations, etc., thereby achieving effective control over privileged accounts such as operation and maintenance personnel and preventing the occurrence of security risks. Summary of the invention

[0006] The disclosed embodiments provide a privileged account management and control method and device for limiting the number of queries and rows based on a specified table in a database.

[0007] The technical solution of the present invention is: According to one aspect of the present invention, a privileged account management and control method based on database limited query is provided, comprising: Step S1: configure the driver connection information through the business configuration interface, and configure the control policy of the privileged user and the table to be queried through the policy controller configuration interface. The control policy is provided with a filtering condition, and the filtering condition limits the query of the privileged account; Step S2: the PIM JDBC driver package uses a syntax parser to parse the statement to be parsed lexically and grammatically, generates a syntax tree, and when there is a first node corresponding to a table name and / or a table rename in the syntax tree, determines whether there is a clause belonging to a subquery or a first-level query in the statement to be parsed according to the type of the parent node to which the first node belongs, and obtains the actual table name of the table to be queried in the database; Step S3: Activate the filtering conditions set in the control policy of the privileged account, thereby using the actual table name of the table to be queried in the database to allow, prohibit or restrict the query of the table to be queried, and filter the query results.

[0008] According to another aspect of the present invention, a privileged account management and control device based on database limited query is provided, comprising the following modules: The business configuration module is used to configure the driver connection information through the business configuration interface, and to configure the control policy of the privileged user and the table to be queried through the policy controller configuration interface. The control policy is provided with a filtering condition, and the filtering condition limits the query of the privileged account; The PIM module, wherein the PIM JDBC driver package uses a syntax parser to parse the statement to be parsed lexically and grammatically, generates a syntax tree, and when there is a first node corresponding to a table name and / or a table rename in the syntax tree, determines whether there is a clause belonging to a subquery or a first-level query in the statement to be parsed according to the type of the parent node to which the first node belongs, and obtains the actual table name of the table to be queried in the database; The policy control module is used to start the filtering conditions set in the control policy of the privileged account, so as to use the actual table name of the table to be queried in the database to release, prohibit or restrict the query, and filter the query results.

[0009] Compared with the prior art, the present invention has the following beneficial effects: The method provided by the present invention performs data range control in table query for privileged accounts, realizes the limit on the number of rows returned by data query results of development and operation personnel, and the key data table query result shall not exceed the limit rows, the number of queries per unit time, the total number of queries, etc., to avoid unauthorized use, abuse of authority, abnormal access, illegal operation and other security threats.

[0010] It is compatible with most database types, provides unified policy configuration, and provides a driver package without modifying the target database and database client to implement a query tool based on standard SQL.

[0011] Avoid the differences in SQL parsing for various databases, realize SQL conversion, and increase policy control at the same time, accurately control the query of database tables, provide accurate policy configuration and control, and limit the maximum total number of query rows per day for specified databases and specified forms; limit the maximum number of returned rows for a query result set of important forms; limit the maximum number of queries for a specified table within a set time period, so as to achieve the permission limit of privileged accounts and prevent security risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings: Figure 1 A flowchart of a privileged account management and control method based on limiting the number of queries and rows in a specified table of a database according to an embodiment of the present invention is shown.

[0013] Figure 2 A structural block diagram of a privileged account management and control device for limiting the number of queries and rows based on a specified table in a database according to an embodiment of the present invention is shown.

[0014] Figure 3 An interface diagram for configuring PIM driver connection information according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0015] The present invention provides a privileged account management method and device based on database limited query, eliminating the differences between various types of databases, realizing data self-adaptation, and performing policy control on data query, realizing effective control of privileged accounts such as operation and maintenance accounts, and preventing the occurrence of security risks.

[0016] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below through specific implementations and in conjunction with the accompanying drawings.

[0017] Embodiment 1 Figure 1 FIG. 1 is a flowchart of a privileged account management method based on database limited query according to an embodiment of the present disclosure. Figure 1 As shown, the method comprises the following steps: Step S1: Configure the driver connection information through the business configuration interface, and configure the control policy of the privileged user and the table to be queried through the policy controller configuration interface, and set the filter conditions in the control policy. The filter conditions restrict the query of the privileged account, such as prohibiting or restricting the privileged account from querying a table, the query frequency, etc.

[0018] Step S2: The PIM JDBC driver package uses a syntax parser to parse the statement to be parsed lexically and grammatically, generates a syntax tree, and when there is a first node corresponding to a table name and / or table rename in the syntax tree, it is determined whether there is a clause belonging to a subquery or a first-level query in the statement to be parsed according to the type of the parent node to which the first node belongs, and obtains the actual table name of the table to be queried in the database. The statement to be parsed represents the query content of the privileged account. The query content is a query statement written using an SQL statement, such as querying a table, a row, a column, etc.

[0019] The principle of the present invention is explained as follows: determine whether the query content, i.e., the statement to be parsed, matches the regular expression set in the business system successfully. If the match is successful, the corresponding SQL statement will be restricted. The restriction is determined by the restricted type selected in the business system, such as returning a restricted result set with a fixed number of rows or limiting the number of queries; if the regular match is unsuccessful, there will be no query restriction when executing SQL, and the restriction policy configured in the business will not take effect.

[0020] Step S3: Start the filtering conditions set in the control policy of the privileged account, so as to use the actual table name of the table to be queried in the database to release, prohibit or restrict the query of the table to be queried, and filter the query results. The table to be queried refers to the table targeted by the privileged account query. The filtering conditions of the query policy configured in step S1 are set with prohibition, release, restriction and other policies for the actual table name of the table to be queried in the database.

[0021] In one embodiment, the above step S1: configuring the driver connection information and query content SQL through the business configuration interface, and configuring the query policy of the user and the table to be queried through the policy controller configuration interface includes: a, configuring the PIM driver connection information and the query content SQL to be restricted in the PIM JDBC configuration interface; b, configuring the query policy through the policy controller configuration interface, the query policy including whether to allow the query, the frequency of the query, and the amount of data queried.

[0022] Figure 3 The interface diagram for configuring PIM driver connection information according to an embodiment of the present invention is shown. Configuring PIM driver connection information includes:

[0023] The control strategies for configuring privileged accounts include: Policy configuration is based on privileged accounts and tables to be queried. Select one or more privileged accounts, select one or more tables to be queried, and add restriction policies. Policies can be combined through three relationships: AND, OR, and NOT. For example, the following SQL statement regular expression that specifies the table to be queried is SELECT\s+. ?\s+FROM\s+mysql.user, this expression configures the following restriction parameters: the number of rows in a single query, the maximum number of rows in a single day, the maximum number of queries per minute, etc.

[0024] After the query policy is configured, it is saved in the cache server of the operating system.

[0025] In one embodiment, the above step S2: the PIM JDBC driver package uses a syntax parser to perform lexical and grammatical analysis on the statement to be parsed, generates a syntax tree, and when there is a first node corresponding to the table name and / or table rename in the query syntax tree, it is determined whether there is a clause belonging to a subquery or a first-level query in the statement to be parsed according to the type of the parent node to which the first node belongs, and obtains the actual table name of the table to be queried in the database, including: PIM driver adaptation and semantic conversion of SQL statements, specifically including: step 1, the PIM driver loads the corresponding driver according to the database used by the project background, and establishes a database connection channel. Step 2, the syntax parser is used to perform lexical and grammatical analysis on the statement to be parsed, generates a syntax tree, and generates a corresponding SQL statement according to the database actually used by the table to be queried. The SQL statement is the SQL expression form of the statement to be parsed, and contains the actual table name of the table to be queried in the database.

[0026] Step 1. The PIM driver loads the corresponding driver according to the database used in the project background and establishes a database connection channel, including: the PIM driver acts as a standard JDBC driver, repackages and implements four standard interface classes: Driver, Connection, Statement (SQL loading executor), and ResultSet (result set) as the database connection entry. After the drivers of various databases are introduced into the PIM JDBC driver component, query control and restriction of various databases can be implemented.

[0027] The above PIM driver, as a standard JDBC driver, repackages and implements four standard interface classes: Driver, Connection, Statement, and ResultSet. As a database connection entry, it can include: The PIM JDBC driver component implements four interfaces: Driver, Connection, Statement, and ResultSet according to the standard. The four interfaces are abstract interfaces. In the abstract interface implementation, the corresponding database driver class instance is created, and the corresponding database driver class instance method is called. Various database driver classes can be connected and operated to realize various database proxy entry functions, thereby realizing the control and management of database query entry.

[0028] The process of controlling and managing the database query entry includes: the PIM JDBC driver component is provided to third-party tools and systems as a unified JDBC driver. The database connection process is established by identifying the driver, loading the corresponding driver, and then linking to the actual database through the corresponding data driver to complete the query operation.

[0029] The system introduces the PIM JDBC driver component and the standard driver component of the data. During the query process of the client, the PIM JDBC driver component captures the SQL statement (the SQL statement refers to the user's query operation) and blocks, releases, restricts the query, and controls it according to the query strategy set by the PIM JDBC driver component. Finally, the relevant restriction information is added to the corresponding SQL statement and sent to the database's own JDBC driver. The database's own JDBC driver then sends the SQL statement to the data to complete the query of the table to be queried.

[0030] In one embodiment, the above step S3 (starting the filtering conditions set in the user's query policy, thereby using the actual table name of the table to be queried in the database to release, prohibit or restrict the query of the table to be queried, and filtering the query results): the PIM JDBC driver first intercepts the SQL statement, and after semantic analysis, enters the policy control stage. According to the name of the table to be queried, the control policy of the privileged account set in step S1 is queried. The policy control module first reads the control policy of the privileged account set in step S1 from the system cache, and matches them one by one according to priority, so as to block, restrict or release the query behavior. Matching one by one according to priority can be: the prohibition type policy has the highest priority, followed by the conditional type policy, and finally the result restriction type policy. After matching the prohibition policy, other subsequent policies will be skipped. The policy matching process is as follows: a. If the name of the table to be queried parsed from the SQL statement matches the conditional prohibition regular expression in the policy (for example, the privileged user is only allowed to query the target 5 times a day), the policy information is obtained, and the number of queries that the privileged user has made on that day is read from the cache to determine whether the condition limit is exceeded. If the maximum number of queries is exceeded, the SQL statement execution is blocked and an error message is returned. On the contrary, if the maximum number of queries is not exceeded, the SQL statement execution is released normally, and the number of queries that the privileged user has made on the target on that day in the cache is updated. This type of policy data is reset regularly according to the time limit configured by the policy.

[0031] If a direct prohibition regular expression in the policy is matched (prohibiting the privileged user from querying the target), the SQL statement execution is blocked and an error message is returned.

[0032] b. If the name of the table to be queried parsed from the SQL statement matches the restriction regular expression in the policy (for example, the privileged user can only query 100 data items in the directory each time), the information in the control policy is read, and based on the control policy information, the restriction condition of the SQL statement is modified to the number of rows specified in the policy information; if it does not exceed the limit, the SQL statement is released to execute the query.

[0033] c. If the table name to be queried parsed from the SQL statement (corresponding table query) does not match the regular expression in the policy, the SQL statement is released.

[0034] After the strategy matching process is completed, the system calls the JDBC driver of the target database (the database to which the table to be queried belongs) to query the data and return the result set.

[0035] d. The returned results are filtered again according to the information configured in the control policy. The filtering may include, for example, field filtering, sensitive word filtering, etc. The data is then encapsulated through the PIM driver package and the result set is returned.

[0036] Embodiment 2 like Figure 2 As shown, an embodiment of the present invention provides a privileged account control device for limiting the number of queries and the number of rows based on a specified table in a database, comprising the following modules: The business configuration module is used to configure the driver connection information through the business configuration interface, and to configure the control policy of the privileged user and the table to be queried through the policy controller configuration interface. The control policy is provided with a filtering condition, and the filtering condition limits the query of the privileged account; The PIM module, wherein the PIM JDBC driver package uses a syntax parser to parse the statement to be parsed lexically and grammatically, generates a syntax tree, and when there is a first node corresponding to a table name and / or a table rename in the syntax tree, it is determined whether there is a clause belonging to a subquery or a first-level query in the statement to be parsed according to the type of the parent node to which the first node belongs, and obtains the actual table name of the table to be queried in the database.

[0037] The policy control module is used to start the filtering conditions set in the control policy of the privileged account, so as to use the actual table name of the table to be queried in the database to release, prohibit or restrict the query, and filter the query results.

[0038] The above embodiments are provided only for the purpose of describing the present invention, and are not intended to limit the scope of the present invention. The scope of the present invention is defined by the appended claims. Various equivalent substitutions and modifications made without departing from the spirit and principles of the present invention should all be included within the scope of the present invention.

Claims

1. A privileged account management and control method based on database limited query, characterized in that: include: Step S1: configure the driver connection information through the business configuration interface, and configure the control policy of the privileged user and the table to be queried through the policy controller configuration interface. The control policy is provided with a filtering condition, and the filtering condition limits the query of the privileged account; Step S2: the PIM JDBC driver package uses a syntax parser to parse the statement to be parsed lexically and grammatically, generates a syntax tree, and when there is a first node corresponding to a table name and / or a table rename in the syntax tree, determines whether there is a clause belonging to a subquery or a first-level query in the statement to be parsed according to the type of the parent node to which the first node belongs, and obtains the actual table name of the table to be queried in the database; Step S3: Activate the filtering conditions set in the control policy of the privileged account, thereby using the actual table name of the table to be queried in the database to allow, prohibit or restrict the query of the table to be queried, and filter the query results.

2. The privileged account management and control method based on database limited query according to claim 1 is characterized in that: Step S1 includes: a. configuring PIM driver connection information and SQL statements to be restricted in the PIM JDBC configuration interface; b. configuring control policies through the policy controller configuration interface, wherein the control policies include whether to allow query, query frequency, and query data volume.

3. The privileged account management and control method based on database limited query according to claim 1 is characterized in that: Step S2 includes: PIM driver adaptation and semantic conversion of SQL statements, including: Step 1, the PIM driver loads the corresponding driver program according to the database used by the project background and establishes a database connection channel; Step 2, uses a syntax parser to perform lexical and grammatical analysis on the statement to be parsed, generates a syntax tree, and generates a corresponding SQL statement according to the database actually used by the table to be queried.

4. The privileged account management and control method based on database limited query according to claim 1 is characterized in that: Step S3 includes: the PIM JDBC driver first intercepts the SQL statement, performs semantic analysis, and then enters the policy control stage: according to the name of the table to be queried, the control policy of the privileged account set in step S1 is queried, and each is matched according to the priority, so as to block, restrict or release the query behavior. After matching the prohibition policy, other subsequent policies will be skipped. The policy matching process includes: a. If the name of the table to be queried parsed from the SQL statement matches the conditional prohibition regular expression in the policy, the policy information is obtained, and the number of queries that the privileged user has made on the day is read from the cache to determine whether it exceeds the condition limit. If it exceeds the maximum number of queries, the SQL statement execution is blocked and an error message is returned. Otherwise, if it does not exceed the maximum number of queries, the SQL statement execution is released normally, and the number of queries that the privileged user has made on the target on the day in the cache is updated; If a direct prohibition regular expression in the policy is matched, the SQL statement execution is blocked and an error message is returned; b. If the name of the table to be queried parsed from the SQL statement matches the restriction regular expression in the policy, the policy information is read, and based on the parsed SQL statement, the restriction condition of the SQL statement is modified to the number of rows specified in the policy information. If it does not exceed the limit, the SQL statement is released to execute the query; c. If the table name to be queried from the SQL statement does not match the regular expression in the policy, the SQL statement is released; After the strategy matching process is completed, the JDBC driver of the database to which the table to be queried belongs is called to query the data and return the result set; d. The returned results are filtered again according to the information configured in the restriction policy, and then the data is encapsulated through the PIM driver package to return the result set.

5. A privileged account management and control device based on database limited query, characterized in that: Includes the following modules: The business configuration module is used to configure the driver connection information through the business configuration interface, and to configure the control policy of the privileged user and the table to be queried through the policy controller configuration interface. The control policy is provided with a filtering condition, and the filtering condition limits the query of the privileged account; The PIM module, wherein the PIM JDBC driver package uses a syntax parser to parse the statement to be parsed lexically and grammatically, generates a syntax tree, and when there is a first node corresponding to a table name and / or a table rename in the syntax tree, determines whether there is a clause belonging to a subquery or a first-level query in the statement to be parsed according to the type of the parent node to which the first node belongs, and obtains the actual table name of the table to be queried in the database; The policy control module is used to start the filtering conditions set in the control policy of the privileged account, so as to use the actual table name of the table to be queried in the database to release, prohibit or restrict the query, and filter the query results.

Citation Information

Patent Citations

  • Device and method for implementing database query limitation

    CN107403104A

  • Data access method, device and system

    CN113535754A

  • SQL query engine based on JDBC

    CN117171194A

  • Database connection configuration method and device, computer equipment and storage medium

    CN117435661A

  • Data query method and device, terminal equipment and storage medium

    CN118035282A