Data access method and device, electronic equipment and storage medium
By receiving the client's data access request and generating a proxy access request, and using the preset proxy account for permission verification, the problem of low data access security in Hive access permission management is solved, and Hive and its metadata corresponding table data are realized. Comprehensive permission control of the data storage system improves the security of data access.
Patent Information
- Application Number
- CN202310169505.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-16
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, Hive access rights management is limited to the control of Hive rights, and fails to effectively control the access rights of the data storage system that stores the metadata corresponding table data in Hive, resulting in low data access security.
By receiving the data access request from the client, determine the access object information and permissions, generate a proxy access request, and use the preset proxy account to access the data storage system to achieve full access to the data storage system of Hive access and metadata corresponding table data. Control.
It improves the security of data access, realizes comprehensive control of data access, and ensures the access rights of Hive and the storage system of its metadata corresponding table data.
Smart Images

Figure CN118536128A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data access method, device, electronic equipment and storage medium. Background Art
[0002] Hive is a data warehouse tool based on Hadoop (a distributed system infrastructure). It can map structured data files into a database table and provide complete SQL (Structured Query Language) query functions. It can convert SQL statements into MapReduce (a programming model) tasks for execution. Due to its low learning cost, it can quickly implement simple MapReduce statistics through SQL-like statements without the need to develop special MapReduce applications, so it is very suitable for statistical analysis of data warehouses.
[0003] There are currently many solutions available for Hive permission management, such as using the open source Apache Ranger in the community to manage Hive, and using other third-party packaged Hive clients to manage permissions.
[0004] In the process of implementing the present invention, it is found that there are at least the following technical problems in the prior art: the above technical solution only implements the permission control for Hive access, but does not implement the access permission control for the data storage system storing the metadata corresponding table data in Hive, which reduces the security of data access. Summary of the invention
[0005] The present invention provides a data access method, device, electronic device and storage medium to solve the problem of low data access security in the prior art, realizes comprehensive control over Hive and the data storage system storing metadata corresponding table data in Hive, and improves the security of data access.
[0006] In a first aspect, an embodiment of the present invention provides a data access method, which is applied to a data warehouse platform and includes:
[0007] Receive a data access request sent by an access client, and determine access object information contained in the data access request;
[0008] Determine the access permission corresponding to the access object information, and perform permission verification on the access client based on the access object information and the access permission;
[0009] In the case where it is determined that the access client has access rights, a proxy access request is generated based on preset proxy account information and the access object information, and target data stored in the data storage system is accessed based on the proxy access request.
[0010] In a second aspect, an embodiment of the present invention further provides a data access device, the device comprising:
[0011] An access object information determination module, used to receive a data access request sent by an access client, and determine the access object information contained in the data access request;
[0012] An access rights verification module, used to determine the access rights corresponding to the access object information, and to verify the access rights of the access client based on the access object information and the access rights;
[0013] The target data acquisition module is used to generate a proxy access request based on preset proxy account information and the access object information when it is determined that the access client has access rights, and access the target data stored in the data storage system based on the proxy access request.
[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, including:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data access method described in any embodiment of the present invention.
[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data access method described in any embodiment of the present invention when executed.
[0019] The technical solution provided by the embodiment of the present invention receives a data access request sent by an access client and determines the access object information contained in the data access request; determines the access permission corresponding to the access object information, and performs permission verification on the access client based on the access object information and the access permission; implements permission management and control over Hive access; further, when it is determined that the access client has the access permission, generates a proxy access request based on preset proxy account information and access object information, and accesses the target data stored in the data storage system based on the proxy access request; implements management and control over the access permission of the data storage system storing the table data corresponding to the metadata in Hive. Through the two-aspect permission management and control, the problem of low data access security in the prior art is solved, comprehensive management and control over data access is implemented, and the security of data access is improved.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flow chart of a data access method provided according to an embodiment of the present invention;
[0023] Figure 2 is a flow chart of another data access method provided according to an embodiment of the present invention;
[0024] Figure 3 is a flow chart of another data access method provided according to an embodiment of the present invention;
[0025] Figure 4 is a structural schematic diagram of a data access device provided according to an embodiment of the present invention;
[0026] Figure 5 It is a structural schematic diagram of an electronic device for implementing the data access method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.
[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0030] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0031] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0032] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0033] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0034] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0035] Figure 1 A flowchart of a data access method is provided for the first embodiment of the present invention. This embodiment is applicable to data access situations. Specifically, it is more applicable to data access based on a data warehouse platform. The method can be executed by a data access device, which can be implemented in the form of hardware and / or software. The data access device can be configured in an intelligent terminal and a cloud server. Figure 1 As shown, the method includes:
[0036] S110: Receive a data access request sent by an access client, and determine access object information included in the data access request.
[0037] In an embodiment of the present invention, the data warehouse platform can be understood as a database platform used for data processing such as data extraction, transformation and loading. Among them, the data warehouse platform may include a Hive platform, which is correspondingly used to process, store, query and analyze data stored in Hadoop. Specifically, the Hive platform can map structured data files to a database table, provide SQL query functions, and convert SQL statements into MapReduce tasks for execution, thereby realizing data processing. The access client can be understood as a terminal held by an access user who accesses the current data warehouse platform. Optionally, the access client may include other intelligent terminals such as mobile terminals and laptop computers, which is not limited in this embodiment.
[0038] Specifically, the access user generates a data access request by operating the access client. Specifically, the access user inputs access content in the access client, and the access client generates an access data request based on the input access content, and sends the data access request to the current data warehouse platform to implement data access in the current data warehouse platform. When the current data warehouse platform receives the data access request sent by the access client, it parses the data access request, obtains the access object information contained therein, and determines the corresponding target data based on the access object information.
[0039] In order to obtain the access object information contained in the data access request, the data access request sent by the access client can be parsed. Optionally, the method for obtaining the access object information in this embodiment may include performing statement parsing on the data access request based on a preset parsing rule to obtain a corresponding parsing result, and performing information identification on the parsing result to obtain the access object information contained in the data access request.
[0040] S120: Determine the access permission corresponding to the access object information, and perform permission verification on the access client based on the access object information and the access permission.
[0041] In the embodiment of the present invention, before the current data warehouse platform determines the corresponding target data based on the access object information obtained through parsing, it is necessary to perform permission verification on the access object information to ensure the security of data access in the data warehouse platform.
[0042] Specifically, the method of verifying the access rights of the access client based on the access object information may include: determining the access rights corresponding to each access field based on each access field stored hierarchically in the access object information on the basis of determining the access object information. And comparing and verifying each access field with the corresponding access rights. Optionally, determining whether the current access client has the access rights to access the current data warehouse platform to obtain the target data corresponding to the access data request based on the verification result.
[0043] Optionally, each access field may be compared with the access permission one by one. Optionally, if the verification results of each access field and each access permission are passed, it means that the access client has the access permission to the access data request sent by it.
[0044] Of course, access authority verification may also be performed in other ways, and this embodiment does not limit the verification method for access authority verification.
[0045] S130: When it is determined that the access client has access rights, a proxy access request is generated based on preset proxy account information and access object information, and target data stored in the data storage system is accessed based on the proxy access request.
[0046] In the embodiment of the present invention, based on the data storage properties of the data warehouse platform, it can be known that only metadata is stored in the data warehouse platform, that is, only data fields that can be used for data processing are stored therein, and the table data corresponding to the metadata is stored in the data storage system corresponding to the data warehouse. Among them, the data storage system may include HDFS (Hadoop Distributed File System). Specifically, when an access client accesses data to the current data warehouse platform, the current data warehouse platform will obtain the corresponding target data from the data storage system based on the access object information as the access result for feedback when determining that the access client has access rights. Because some access clients in the prior art bypass the data warehouse platform and directly access the data stored in the data storage system. However, since the data storage system cannot distinguish whether the client that accesses data therein has passed the data warehouse platform authority verification, the data authority verification method of the prior art has security risks in terms of data access security, and does not perform comprehensive control over the data.
[0047] Based on the above technical problems, the technical solution of the embodiment of the present invention pre-sets a proxy account in the data warehouse platform. The data storage system only allows the proxy account to access its data, and the proxy account has access rights to all data in the data storage system. When it is determined that the client has access rights to the data access request, the proxy account in the data warehouse platform accesses the corresponding target data in the data storage system according to the data access request sent by the access client. On this basis, even if the access client bypasses the permission verification of the data warehouse platform, it does not have the permission to access the data storage system, thereby achieving comprehensive control over data access rights.
[0048] Optionally, in this embodiment, when it is determined that the access client has access rights, the method for accessing target data stored in the data storage system may include: obtaining proxy account information of a preset proxy account in the data warehouse platform, generating a proxy access request based on the proxy account information and access object information, and sending the proxy access request to the data storage system so that the data storage system determines the corresponding access data; receiving access data fed back by the data storage system, using the access data as target data corresponding to the data access request and feeding it back to the access client.
[0049] In this embodiment, the proxy account information may include an account identifier of the proxy account. The proxy account identifier may be understood as information that distinguishes the account from other access clients, that is, an identifier of the access permission for accessing data in the data storage system.
[0050] Specifically, when it is determined that the access client has the access right to access data on the current data access platform, the proxy account information of the proxy account is obtained, and a proxy access request is generated based on the proxy account information and the access client information included in the data access request sent by the access client, and the proxy access request is sent to the data storage system. When the data storage system receives the proxy access request, it can determine that it has the access right to the data storage system based on the proxy account information included in the proxy access request, allow the access proxy request to access the data, further determine the access data based on the access object information included in the proxy access request, and feed the determined access data back to the data warehouse platform. When the data warehouse platform receives the access data fed back by the data storage system, it uses the access data as the target data corresponding to the data access request and feeds it back to the access client.
[0051] The technical solution provided by the embodiment of the present invention receives a data access request sent by an access client and determines the access object information contained in the data access request; determines the access permission corresponding to the access object information, and performs permission verification on the access client based on the access object information and the access permission; implements permission management and control over Hive access; further, when it is determined that the access client has the access permission, generates a proxy access request based on preset proxy account information and access object information, and accesses the target data stored in the data storage system based on the proxy access request; implements management and control over the access permission of the data storage system storing the table data corresponding to the metadata in Hive. Through the two-aspect permission management and control, the problem of low data access security in the prior art is solved, comprehensive management and control over data access is implemented, and the security of data access is improved.
[0052] Figure 2 A flowchart of a data access method provided for Embodiment 2 of the present invention. Optionally, based on the above implementation, in the technical solution of the embodiment of the present invention: the data access request includes an SQL statement; determining the access object information included in the data access request includes: performing statement parsing processing on the SQL statement to generate a parsing result corresponding to the SQL statement; identifying the parsing result to obtain the access object information included in the SQL statement.
[0053] like Figure 2 As shown, the method includes:
[0054] S210: Receive a data access request sent by an access client; the data access request includes an SQL statement.
[0055] In this embodiment, the data access request may include an SQL statement; in other words, the access client generates a data access request based on the SQL statement input by the access user. Optionally, the generated access request is different based on different SQL statements input. For example, a query request is generated based on an SQL query statement; a delete request is generated based on an SQL delete statement.
[0056] S220: parse the SQL statement, generate a parsing result corresponding to the SQL statement, identify the parsing result, and obtain access object information contained in the SQL statement.
[0057] Specifically, the SQL statement can be parsed based on the preset statement parsing rules, and the results obtained after the parsing can be identified using the preset identification rules, so as to obtain the access object information contained therein. Among them, the parsing result includes a plan tree that stores the fields of each level in the SQL statement in a hierarchical manner. Access object information The access object information includes library access fields, table access fields, and column access fields that are arranged in order of hierarchy. Specifically, each access field is stored in the plan tree of the parsing result in a hierarchical manner, so that the access fields of each level can be obtained by identifying the parsing result, that is, the access object information is obtained. Exemplarily, the storage form of the access object information stored in the parsing result is hierarchical storage, for example, the library access field is stored in the first node of the plan tree, i.e., the trunk, the table access field under the library access field is stored in the second node, i.e., the branch on the trunk, and the column access field under the table access field is stored in the third node, i.e., the leaves on the tree branch, so as to realize the storage of the fields of each level in a hierarchical manner. Of course, the above-mentioned method of storing access object information in the analysis results is only an optional example, and does not mean that the technical solution of this embodiment is limited to this. The technical solution of this implementation can also use other methods to store access object information in the analysis results, and this is not limited.
[0058] Optionally, the preset parsing rules in this embodiment include parsing and optimizing parsing rules and optimization rules for SQL statements. Specifically, the method for parsing statements based on the above parsing rules in this embodiment may include: parsing SQL statements based on a preset parser to obtain an initial plan tree of the SQL statements.
[0059] Specifically, the parsing rules may include a preset parser, such as a Calcite parser. Accordingly, the Calcite parser is used to parse the SQL statement according to the grammar rules to obtain an abstract syntax tree. Optionally, in order to ensure data security, the Flink SQL verifier may be used to verify the syntax of the SQL statement. When the verification passes, an initial plan tree is generated based on the parsed abstract syntax tree.
[0060] It should be noted that the above Calcite parser is a dynamic data management framework that can be used to build the syntax parsing module of the current data warehouse platform. The Flink SQL module uses this framework to complete the parsing of SQL statements.
[0061] In this embodiment, the initial plan tree may contain repeated field information. For example, when the accessing user accesses two columns of data in any data table in any database, the number of initial plan trees obtained by parsing is multiple, that is, the hierarchical fields stored in the initial plan tree 1 include library field A, table field A, and column field A1; the hierarchical fields stored in the initial plan tree 2 include library field A, table field A, and column field A2. Among them, the library fields and table fields stored in the initial plan tree 1 and the initial plan tree 2 are all the same fields. In order to make the plan tree obtained after parsing more logical, in the technical solution of this embodiment, when it is determined that there are multiple initial plan trees, the preset optimization rules are obtained to optimize the initial plan tree to obtain the logical plan tree of the SQL statement. Specifically, the optimization rule set in the Blink optimizer can be used to deduplicate the repeated fields in the initial plan tree to obtain a deduplicated logical plan tree. Exemplarily, the logical plan tree may include library field A, table field A, column field A1, and column field A2.
[0062] S230: Determine the access permission corresponding to the access object information, and perform permission verification on the access client based on the access object information and the access permission.
[0063] S240: When it is determined that the access client has access rights, a proxy access request is generated based on preset proxy account information and access object information, and target data stored in the data storage system is accessed based on the proxy access request.
[0064] The technical solution of the embodiment of the present invention parses the SQL statement in the data access request and optimizes and deduplicates the initial plan tree obtained by the statement parsing, thereby obtaining a logical plan tree corresponding to the SQL, thereby reducing redundant information in the access object information and streamlining the field information in the access object information, so as to quickly determine whether the permission is possessed during permission access, and quickly determine the corresponding target data during data access, thereby reducing the amount of data processing calculations and improving the access efficiency of data access.
[0065] Figure 3 A flow chart of a data access method provided for the second embodiment of the present invention. Optionally, based on the above implementation, in the technical solution of the embodiment of the present invention: the access object information includes library access fields, table access fields, and column access fields arranged in order of hierarchy; determining the access rights corresponding to the access object information includes: obtaining the access rights information table of the data warehouse platform; the access rights information table stores the field access rights corresponding to each field information; the access rights include library access rights, table access rights, and column access rights; determining the access rights corresponding to the library access field, table access field, and column access field based on the access rights of each field. Figure 3 As shown, the method includes:
[0066] S310, receiving a data access request sent by an access client, and determining access object information contained in the data access request; the access object information includes a library access field, a table access field, and a column access field arranged in hierarchical order.
[0067] S320, obtaining the access permission information table of the data warehouse platform, and determining the access permissions corresponding to the library access field, the table access field, and the column access field respectively based on the access permissions of each field.
[0068] In order to ensure the security of data access in the current data warehouse platform, it is necessary to verify the access rights of the access client that sends the data access request in advance. The access rights verification of the existing technology can only control the Hive table granularity, and there is no control over the Hive column granularity. The main reasons include that the permission control of the data storage system is at the file level at the minimum. For structured data, each file has multiple columns. For common column-based storage file formats such as Parquet and HFile, one file is not stored for one column of data. Therefore, the existing permission control remains at the file level, that is, even at the granularity of the data table, the permission control at the column granularity is not implemented. Therefore, some clients only have access rights at the table granularity, but not at the column granularity, but can still access the data corresponding to the column granularity, resulting in reduced data access security.
[0069] Based on this, in an embodiment of the present invention, an access permission information table set to the column granularity is pre-stored in the data warehouse platform. Specifically, the field access permissions corresponding to the fields at each level can be set in sequence based on the field information at each level stored in the current data warehouse platform, thereby generating an access permission information table controlled to the column granularity.
[0070] Optionally, the method for generating the access permission information table in this embodiment includes obtaining the field access permissions corresponding to each field information stored in the data warehouse platform; storing each field information and each field access permission in a pre-set initial access permission information table to obtain the access permission information table of the data warehouse platform.
[0071] Specifically, obtain the field information stored in the current data warehouse platform, including library fields, table fields and column fields at each level. Then obtain the library field access rights, table field access rights and column field access rights corresponding to each library field, table field and column field. It should be noted that the above-mentioned field access rights can be pre-set by the data management personnel and platform developers of the current data warehouse platform based on the platform data security level. Further, the obtained field information of each level and the corresponding field access rights of each level are stored in the pre-set initial access right information table to obtain the access right information table of the data warehouse platform. Optionally, the generated access right information table can be stored in the TBL_COL_PRIVS table of the metadata database corresponding to the Hive MetaStore of the current data warehouse platform. Of course, it can also be stored in other tables outside the Hive Metastore metadata database. This embodiment does not limit the storage location of the access right information table in the current data warehouse access platform.
[0072] Optionally, the same or associated identifiers may be set for the corresponding stored field information and field access permissions, so as to quickly determine the corresponding access permissions for accessing the fields based on the access permission information table, thereby improving the efficiency of data access.
[0073] On the basis of the above implementation, when the access object information of the access client is determined, the corresponding access rights are determined based on the above access rights information table. Optionally, the method for determining access rights in this embodiment may include: obtaining the access rights information table of the data warehouse platform; the access rights information table stores field access rights corresponding to each field information; the access rights include library access rights, table access rights and column access rights; based on each field access right, the access rights corresponding to the library access field, table access field and column access field are determined.
[0074] Specifically, determine the library access field, table access field, and column access field in the access object information that are hierarchically ordered. Based on the access permission information table, determine the library access permission, table access permission, and column access permission corresponding to the library access field, table access field, and column access field, respectively. Exemplarily, how to determine the access permission is introduced by taking the determination of the library access permission corresponding to the library access field as an example. Specifically, determine whether the library access field to be accessed is included in the access permission information table. If it is determined that there is a library field that is the same as the library access field in the access permission information table, determine the library field access permission corresponding to the library field in the access permission information table based on a preset identifier, and determine it as the library access permission of the current library access field. Optionally, based on the above determination method, determine the table access permission corresponding to the table access field and the column access permission corresponding to the column access field, so as to implement column-granularity-level access permission verification for the access client and improve the security of data access.
[0075] Based on the above implementation, since the access permission information table contains various library fields stored in the current data warehouse, if it is determined that there is no library field identical to the library access field in the access permission information table, it means that the access client cannot access the target data it wants in the current data warehouse, so a prompt message that there is no corresponding access data is generated and fed back to the access client.
[0076] S330: Verify the access rights of the access client based on the access object information and access rights.
[0077] In an embodiment of the present invention, based on determining each level of access field contained in each access object information and each level of access permission corresponding to each level of access field, the access client can be verified layer by layer based on each level of access field and each level of access permission.
[0078] Optionally, the method of performing layer-by-layer verification on the access client may include: performing library access permission verification on library access fields and library access permissions to determine whether the access client has library access permissions; when it is determined that the access client has library access permissions, performing table permission verification on table access fields and table access permissions to determine whether the access client has table access permissions; when it is determined that the access client has table access permissions, performing column permission verification on column access fields and column access permissions to determine whether the access client has column access permissions.
[0079] Specifically, the library access field is compared with the library access rights to determine whether the access client has the library access rights. In this embodiment, the library access field may include the client information of the access client, and the access type of data access (for example, read data or write data); the corresponding library access rights information also includes the allowed access user information of the library, and the allowed access type corresponding to each allowed access user. Then, based on the client information and access type in the above library access field, the allowed access user information and allowed access type in the library access rights are compared one by one to obtain the verification result of the access client for the library access rights. Optionally, if the comparison results are consistent, it means that the access client has the library access rights; conversely, if any of the comparison results are inconsistent, it means that the access client does not have the library access rights.
[0080] Optionally, on the basis that the access client has the library access rights, the access client is checked in turn based on the above-mentioned permission verification method to determine whether it has the table access rights and column access rights. If it is determined that the access client has the library access rights, table access rights and column access rights at the same time, the data access request sent to it has the access rights, and a proxy access request can be generated based on the proxy account, and the target data corresponding to the data access request can be obtained.
[0081] S340: When it is determined that the access client has access rights, a proxy access request is generated based on preset proxy account information and access object information, and target data stored in the data storage system is accessed based on the proxy access request.
[0082] The technical solution provided by the embodiment of the present invention pre-sets an access permission information table that is detailed to the column granularity, determines the access permissions corresponding to each level of fields in the access object information, and performs layer-by-layer permission verification on the access client based on the access fields and permissions at each level. Only when it is determined that the access client has access permissions at each level can data access be performed based on a proxy account to obtain the target data corresponding to the data access request, so that the data warehouse platform can fully realize column-granular data permission management and control, thereby improving the security of data access.
[0083] Based on the above embodiments, the embodiment of the present invention also provides a preferred embodiment, which specifically introduces a technical solution for improving data access security by performing comprehensive management and control based on a data warehouse platform and a data storage system. Specifically, the technical solution of the preferred embodiment includes entering column permission information, mainly which columns the user has permissions on, and then entering the corresponding information into the TBL_COL_PRIVS table of the metadata database corresponding to the Hive MetaStore.
[0084] Step (1) inputs the user's column permission information into the TBL_COL_PRIVS table of the Hive metadata database as permission metadata.
[0085] Step (2), after the Hive SQL semantic analysis is completed, obtain all database, table, and column information including permission-related information.
[0086] Step (3), after the execution plan tree is generated, the Hive database and table permissions are verified. If the database and table permissions are verified, the permissions of the columns to be accessed are verified. If the verification is passed, the subsequent execution is performed. Otherwise, a prompt indicating that there is no permission is returned.
[0087] In step (4), when executing the physical plan, the underlying HDFS data and Yarn queue resources are fully proxied using the super user, shielding the Hive user's access rights to the underlying data, so as to achieve complete control over file data permissions.
[0088] Figure 4 This is a schematic diagram of the structure of a data access device provided by Embodiment 3 of the present invention. Figure 4 As shown, the device includes: an access object information determination module 410, an access permission verification module 420 and a target data acquisition module 430; wherein,
[0089] The access object information determination module 410 is used to receive a data access request sent by an access client and determine the access object information contained in the data access request;
[0090] The access permission verification module 420 is used to determine the access permission corresponding to the access object information, and to verify the access permission of the access client based on the access object information and the access permission;
[0091] The target data acquisition module 430 is used to generate a proxy access request based on preset proxy account information and the access object information when it is determined that the access client has access rights, and access the target data stored in the data storage system based on the proxy access request.
[0092] Optionally, based on the above implementations, the data access request includes a structured query language SQL statement;
[0093] The access object information determination module 410 includes:
[0094] A parsing result generating unit, used for performing statement parsing processing on the SQL statement to generate a parsing result corresponding to the SQL statement;
[0095] The access object information obtaining unit is used to identify the parsing result and obtain the access object information contained in the SQL statement.
[0096] Optionally, based on the above implementations, the parsing result includes a plan tree storing the fields of each level in the SQL statement in a hierarchical manner;
[0097] The analysis result generation unit includes:
[0098] An initial plan tree obtaining subunit is used to parse the SQL statement based on a preset parser to obtain an initial plan tree for the SQL statement;
[0099] The logical plan tree obtaining subunit is used to, when there are multiple initial plan trees, perform deduplication processing on repeated fields in each of the initial plan trees based on a preset optimization rule set to obtain a logical plan tree for the SQL statement.
[0100] Optionally, based on the above implementations, the access object information includes a library access field, a table access field, and a column access field which are arranged in order of hierarchy;
[0101] The access authority verification module 420 includes:
[0102] A field access permission obtaining unit is used to obtain an access permission information table of the data warehouse platform; the access permission information table stores field access permissions corresponding to each field information; the access permissions include library access permissions, table access permissions, and column access permissions;
[0103] The access permission determining unit is used to determine the access permissions respectively corresponding to the library access field, the table access field and the column access field based on the field access permissions.
[0104] Optionally, based on the above implementations, the access authority verification module 320 includes:
[0105] A library access permission verification unit, used to perform library access permission verification on the library access field and the library access permission, and determine whether the access client has the library access permission;
[0106] A table access permission verification unit is used to perform table permission verification on the table access field and the table access permission to determine whether the access client has the table access permission when it is determined that the access client has the library access permission;
[0107] The column access permission verification unit is used to perform column permission verification on the column access field and the column access permission to determine whether the access client has the column access permission when it is determined that the access client has the table access permission.
[0108] Optionally, based on the above embodiments, the device further includes:
[0109] A field access permission acquisition module is used to acquire the field access permission corresponding to each field information stored in the data warehouse platform;
[0110] The access permission information table generation module is used to store the field information and the field access permission correspondingly into a preset initial access permission information table to obtain the access permission information table of the data warehouse platform.
[0111] Optionally, based on the above embodiments, the target data obtaining module 430 includes:
[0112] a proxy access request sending unit, configured to obtain proxy account information of a preset proxy account in the data warehouse platform, generate a proxy access request based on the proxy account information and the access object information, and send the proxy access request to the data storage system so that the data storage system determines corresponding access data;
[0113] The target data obtaining unit is used to receive the access data fed back by the data storage system, and use the access data as the target data corresponding to the data access request and feed it back to the access client.
[0114] The data access device provided in the embodiment of the present invention can execute the data access method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0115] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0116] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0117] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0118] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a data access method.
[0119] In some embodiments, the data access method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data access method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data access method in any other appropriate manner (e.g., by means of firmware).
[0120] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0121] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0122] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0123] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0124] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0125] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0126] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0127] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A data access method, characterized in that: Applied to data warehouse platforms, including: Receive a data access request sent by an access client, and determine access object information contained in the data access request; Determine the access permission corresponding to the access object information, and perform permission verification on the access client based on the access object information and the access permission; In the case where it is determined that the access client has access rights, a proxy access request is generated based on preset proxy account information and the access object information, and target data stored in the data storage system is accessed based on the proxy access request.
2. The method according to claim 1, characterized in that: The data access request includes a structured query language SQL statement; The determining the access object information contained in the data access request includes: Perform statement parsing on the SQL statement to generate a parsing result corresponding to the SQL statement; The parsing result is identified to obtain access object information contained in the SQL statement.
3. The method according to claim 2, characterized in that The parsing result includes a plan tree storing the fields of each level in the SQL statement in a hierarchical manner; The performing statement parsing processing on the SQL statement to generate a parsing result corresponding to the SQL statement includes: Parsing the SQL statement based on a preset parser to obtain an initial plan tree of the SQL statement; In the case that there are multiple initial plan trees, duplicate fields in each of the initial plan trees are deduplicated based on a preset optimization rule set to obtain a logical plan tree of the SQL statement.
4. The method according to claim 1, characterized in that: The access object information includes a library access field, a table access field, and a column access field which are arranged in order of hierarchy; Determining the access rights corresponding to the access object information includes: Obtaining the access permission information table of the data warehouse platform; the access permission information table stores field access permissions corresponding to each field information; the access permissions include library access permissions, table access permissions, and column access permissions; The access permissions respectively corresponding to the library access field, the table access field, and the column access field are determined based on the field access permissions.
5. The method according to claim 4, characterized in that The performing permission verification on the access client based on the access object information and the access permission includes: Performing library access permission verification on the library access field and the library access permission to determine whether the access client has the library access permission; When it is determined that the access client has the library access right, performing table access right verification on the table access field and the table access right to determine whether the access client has the table access right; When it is determined that the access client has table access rights, column access rights verification is performed on the column access field and the column access rights to determine whether the access client has column access rights.
6. The method according to claim 4, characterized in that The method further comprises: Obtaining field access permissions corresponding to each field of information stored in the data warehouse platform; The field information and the field access rights are stored in a preset initial access right information table to obtain the access right information table of the data warehouse platform.
7. The method according to claim 1, characterized in that The generating of a proxy access request based on the preset proxy account information and the access object information, and accessing target data stored in the data storage system based on the proxy access request, includes: Obtaining proxy account information of a preset proxy account in the data warehouse platform, generating a proxy access request based on the proxy account information and the access object information, and sending the proxy access request to the data storage system so that the data storage system determines corresponding access data; Access data fed back by the data storage system is received, and the access data is used as target data corresponding to the data access request and fed back to the access client.
8. A data access device, characterized in that: include: An access object information determination module, used to receive a data access request sent by an access client, and determine the access object information contained in the data access request; An access rights verification module, used to determine the access rights corresponding to the access object information, and to verify the access rights of the access client based on the access object information and the access rights; The target data acquisition module is used to generate a proxy access request based on preset proxy account information and the access object information when it is determined that the access client has access rights, and access the target data stored in the data storage system based on the proxy access request.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data access method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data access method according to any one of claims 1 to 7 when executed.
Citation Information
Cited By
Authority management method and equipment for Kerberos and storage medium
CN119089498A
