Method and system for safely accessing database
Patent Information
- Application Number
- CN202410647514.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-08-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
[0004]本发明实施例的目的在于提供一种安全访问数据库的方法、系统、电子设备和存储介质,用以解决现有技术中数据库安全网关在灵活性、扩展性和性能等方面存在一些不足,以致于无法安全访问数据库的问题
[0034] The method for securely accessing a database in the present invention obtains an access request, converts the access request into an API request, and accesses the database security gateway through the API request, wherein the database security gateway supports multiple communication protocols; The database security gateway determines whether the access request is qualified, and if so, sends an access request to the database to obtain the access result; returns the access result to the client; solving the problems of flexibility and scalability of the database security gateway in the existing technology. There are some deficiencies in performance and performance that make it impossible to access the database safely.
Smart Images

Figure CN118555104A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, system, electronic equipment and storage medium for securely accessing a database. Background Art
[0002] In the current database management technology, traditional database security gateways mainly provide security access and management functions through database native protocols (such as JDBC, ODBC), and are mainly used in enterprise-level applications. They protect the security of database resources by providing centralized security management and access control, rely on database native protocols for communication, and usually provide authentication, access control, and auditing functions. However, with the rise of modern applications and microservice architectures, traditional gateways have poor scalability and are difficult to adapt to the diverse needs of modern applications. They rely on database native protocols, and have relatively low transmission efficiency and performance, which cannot meet high concurrency and low-latency application scenarios. They use traditional authentication and authorization mechanisms and are difficult to integrate modern security authentication technologies.
[0003] Therefore, a method for securely accessing a database is urgently needed. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a method, system, electronic device and storage medium for securely accessing a database, so as to solve the problem that the database security gateway in the prior art has some deficiencies in flexibility, scalability and performance, resulting in the inability to securely access the database.
[0005] To achieve the above object, an embodiment of the present invention provides a method for securely accessing a database, the method specifically comprising:
[0006] Obtaining an access request, converting the access request into an API request, and accessing a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols;
[0007] Determine whether the access request is qualified by the database security gateway, and if so, send the access request to the database to obtain the access result;
[0008] The access result is returned to the client.
[0009] On the basis of the above technical solution, the present invention can also be improved as follows:
[0010] Furthermore, the method for securely accessing a database further includes:
[0011] Integrate the development kit on the application's operating environment, respond to the upload request of the programming language, provide the corresponding development kit for the programming language, and simplify the process of programming language developers integrating and using the database security gateway;
[0012] A conversion device is installed on the application's running environment, and in response to an access request in a programming language, the access request is converted into an API request, and the database security gateway is accessed through the API request.
[0013] Further, the database security gateway determines whether the access request is qualified, and if so, sends the access request to the database to obtain the access result, including:
[0014] Integrate an authentication mechanism capable of supporting multi-factor authentication on the database security gateway, and authenticate the identity of the visitor through the authentication mechanism;
[0015] Integrate an authorization mechanism capable of supporting fine-grained access control on the database security gateway, establish a relationship between user roles and permissions through the authorization mechanism, and associate user roles with permissions based on the relationship;
[0016] A protection mechanism is integrated on the database security gateway.
[0017] Furthermore, the access result is returned to the client and an operation log is recorded, including:
[0018] The access result is encrypted, wherein the data encryption includes transport layer encryption, static data encryption and field level encryption.
[0019] Furthermore, the method for securely accessing a database further comprises:
[0020] Record the operation log and determine whether there is any abnormal behavior in the operation log. If so, generate an alarm signal.
[0021] Furthermore, the method for securely accessing a database further comprises:
[0022] Scan the database, automatically discover sensitive data, and classify and grade the sensitive data;
[0023] The sensitive data is dynamically masked to protect the privacy of the sensitive data and prevent unauthorized access.
[0024] Furthermore, the method for securely accessing a database further comprises:
[0025] A data caching technology is integrated on the database security gateway to reduce direct pressure on the database;
[0026] The load balancing technology is integrated on the database security gateway to realize the intelligent scheduling and distribution of database access requests.
[0027] A system for securely accessing a database based on an API interface, comprising:
[0028] An access module, used to obtain an access request, convert the access request into an API request, and access a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols;
[0029] A request sending module, used to determine whether the access request is qualified through the database security gateway, and if so, send the access request to the database to obtain the access result;
[0030] The result returning module is used to return the access result to the client.
[0031] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the method are implemented when the processor executes the computer program.
[0032] A non-transitory computer-readable storage medium stores a computer program, which implements the steps of the method when executed by a processor.
[0033] The embodiments of the present invention have the following advantages:
[0034] The method for securely accessing a database in the present invention obtains an access request, converts the access request into an API request, and accesses a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols; the database security gateway determines whether the access request is qualified, and if so, sends the access request to the database to obtain an access result; and returns the access result to the client; and solves the problem that the database security gateway in the prior art has some deficiencies in flexibility, scalability, performance, etc., so that the database cannot be securely accessed. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0036] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.
[0037] Figure 1 A flowchart of the method for securely accessing a database according to the present invention;
[0038] Figure 2 The present invention is a system architecture diagram for securely accessing a database based on an API interface;
[0039] Figure 3 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0040] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are 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 are within the scope of protection of the present invention.
[0041] Figure 1 The flowchart of the method for securely accessing a database according to the present invention is as follows: Figure 1 As shown, a method for securely accessing a database provided by an embodiment of the present invention includes the following steps:
[0042] S101, obtaining an access request, converting the access request into an API request, and accessing the database security gateway through the API request;
[0043] Specifically, a development kit is integrated into the application's operating environment, and in response to an upload request of a programming language, a corresponding development kit is provided for the programming language, thereby simplifying the process of programming language developers integrating and using the database security gateway.
[0044] By providing development kits (SDKs) in various languages, developers using multiple programming languages such as Python and Rust can easily integrate and use the database gateway. This support not only expands the scope of application of the gateway, but also greatly improves the acceptance of the developer community.
[0045] A conversion module is deployed in the application's running environment, and in response to a database access request in a programming language, the access request is converted into an API request, and the database security gateway is accessed through the API request. The database security gateway supports multiple communication protocols and simplifies the process of programming language developers integrating and using the database security gateway.
[0046] Preferably, the access request of the present application is Structured Query Language (SQL for short), which is a special-purpose programming language, a database query and programming language used to access data and query, update and manage relational database systems)
[0047] JDBC / ODBC driver: Converts SQL requests to API requests, allowing traditional database applications to be seamlessly migrated to the API gateway architecture, significantly reducing the complexity and cost of migrating existing applications to new platforms.
[0048] S102, determining whether the access request is qualified through the database security gateway, and if so, sending the access request to the database to obtain the access result;
[0049] Specifically, an authentication mechanism capable of supporting multi-factor authentication is integrated on the database security gateway, and the identity of the visitor is authenticated through the authentication mechanism;
[0050] Through the Open Authorization Protocol (OAuth), third-party applications are allowed to access user resources without exposing user passwords, which is suitable for distributed systems and microservice architectures.
[0051] JWT (JSON Web Token) is an open standard based on JSON (RFC 7519) that allows secure transmission of information between parties as access tokens. It is suitable for lightweight and efficient authentication.
[0052] Multi-factor authentication (MFA) provides higher security by combining multiple verification methods such as passwords, SMS verification codes, fingerprints, etc.
[0053] Advanced security mechanisms, including OAuth, JWT authentication, and multi-factor authentication (MFA), are introduced to provide multi-layer protection for data transmission and access. Fine-grained access control ensures that only authorized users can access sensitive data.
[0054] Integrate an authorization mechanism capable of supporting fine-grained access control on the database security gateway, establish a relationship between user roles and permissions through the authorization mechanism, and associate user roles with permissions based on the relationship;
[0055] Role-based (RBAC) and attribute-based (ABAC) access control provide precise permission management.
[0056] Update and manage user permissions in real time to adapt to changing security needs.
[0057] Policy-based access control (PBAC) controls access to resources by defining and managing security policies.
[0058] integrating a protection mechanism on the database security gateway;
[0059] Integrated application firewall (WAF) and intrusion detection system (IDS) to prevent malicious attacks and intrusions.
[0060] Adopt distributed denial of service (DDoS) protection mechanism to ensure system availability.
[0061] Monitor and prevent data leaks to keep sensitive data safe.
[0062] The database security gateway supports multiple communication protocols (such as HTTP / HTTPS, gRPC, WebSocket, MQTT, GraphQL, SOAP, AMQP, CoAP), making it easier for clients to access the database.
[0063] Hypertext Transfer Protocol (HTTP) is a simple request-response protocol that usually runs on top of TCP. It specifies what kind of messages a client may send to a server and what kind of responses it may get. HTTPS (full name: Hypertext Transfer Protocol Secure) is an HTTP channel with security as its goal. It ensures the security of the transmission process through transmission encryption and identity authentication based on HTTP. HTTP and HTTPS are standard RESTful API interfaces that are suitable for most Web applications and services.
[0064] gRPC is a high-performance, open source and general remote procedure call (RPC) framework based on the HTTP / 2 protocol. It supports multiple languages, including Java, C++, Python, Go, etc., allowing communication between different languages: a high-performance remote procedure call (RPC) framework suitable for high-concurrency and low-latency applications.
[0065] WebSocket is a protocol for full-duplex communication over a single TCP connection. The WebSocket communication protocol was standardized by the IETF as RFC 6455 in 2011, and supplemented by RFC7936. The WebSocket API was also standardized by the W3C. WebSocket makes data exchange between the client and the server much simpler, allowing the server to actively push data to the client. In the WebSocket API, the browser and the server only need to complete a handshake, and a persistent connection can be directly established between the two, and two-way data transmission can be carried out): a full-duplex communication protocol based on TCP, suitable for real-time data transmission and two-way communication scenarios.
[0066] MQTT (Message Queuing Telemetry Transport is a message protocol based on the publish / subscribe paradigm under the ISO standard (ISO / IEC PRF 20922). It works on the TCP / IP protocol family and is a publish / subscribe message protocol designed for remote devices with low hardware performance and poor network conditions. For this reason, it requires a message middleware): a lightweight publish / subscribe message transmission protocol suitable for the Internet of Things (IoT) and mobile devices.
[0067] GraphQL is both a query language for APIs and a runtime that satisfies your data queries. The flexible query language and execution engine allow clients to accurately obtain the required data and reduce redundant transmission.
[0068] SOAP is an XML-based protocol suitable for enterprise-level applications that require complex messaging and security.
[0069] AMQP is an advanced message queuing protocol suitable for high-reliability and high-throughput messaging scenarios.
[0070] CoAP is a constrained application protocol suitable for low-power and low-bandwidth IoT devices.
[0071] Implement dynamic access control and dynamically adjust access rights and control policies based on real-time environment and user behavior;
[0072] Design anomaly detection and response mechanisms to monitor abnormal behaviors in the system and generate warning signals in a timely manner to respond to and handle potential security threats in a timely manner;
[0073] Establish audit and compliance, record and audit the operation logs in the system to ensure the compliance and traceability of system operations;
[0074] Implement vulnerability scanning and patching, regularly scan the system for vulnerabilities, and promptly patch discovered security vulnerabilities to prevent malicious exploitation;
[0075] Strengthen access approval processes and establish access approval processes to ensure that only authorized users can access sensitive data and functions.
[0076] S103, returning the access result to the client;
[0077] Specifically, data encryption is performed on the access result, wherein the data encryption includes transport layer encryption, static data encryption and field level encryption.
[0078] Transport layer encryption: Use TLS / SSL protocol to ensure that data is not eavesdropped or tampered with during transmission.
[0079] Static data encryption: Encrypt the data stored in the database to prevent data leakage.
[0080] Field-level encryption: Sensitive data fields are encrypted separately to provide more fine-grained security protection.
[0081] Record operation logs and determine whether there are abnormal behaviors in the operation logs. If so, generate alarm signals to ensure that the system complies with relevant laws, regulations and industry standards (such as GDPR, HIPAA, etc.).
[0082] Scan the database to automatically discover sensitive data (such as personal information, financial data, etc.), and classify and grade the sensitive data;
[0083] The sensitive data is dynamically masked to protect the privacy of the sensitive data and prevent unauthorized access.
[0084] The data cache technology is integrated into the database security gateway to reduce the direct pressure on the database, improve the query response speed and the overall system performance.
[0085] Integrating load balancing technology on the database security gateway to achieve intelligent scheduling and distribution of database access requests, thereby reducing direct pressure on the database;
[0086] The database security gateway supports relational databases, non-relational databases and big data platforms to adapt to different types of database systems and provide a unified security access interface.
[0087] The method for securely accessing a database obtains an access request, converts the access request into an API request, and accesses a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols; the database security gateway determines whether the access request is qualified, and if so, sends an access request to the database to obtain an access result; and returns the access result to the client. The method for securely accessing a database solves the problem of being unable to securely access a database in the prior art. The method for securely accessing a database provides a flexible, secure, and efficient solution for data management in modern applications and microservice architectures. It allows multiple client devices to securely access and manage multiple types of database systems through a unified API interface.
[0088] The method for securely accessing a database provides a flexible and efficient database security gateway, supports multiple communication protocols (such as HTTP / HTTPS, gRPC, WebSocket, MQTT, GraphQL, SOAP, AMQP, CoAP), uses efficient transmission protocols (such as gRPC) to achieve low-latency and high-concurrency database access, adapts to the needs of modern applications and microservice architectures, integrates modern security authentication and authorization mechanisms, enhances system security and management efficiency, converts SQL requests into API requests through JDBC / ODBC, SDK and other components and sends them to the API database security gateway, achieves smooth migration and integration of traditional database applications, and improves operation and maintenance efficiency and management effects through a centralized management interface and real-time monitoring.
[0089] This secure database access method is suitable for integration with microservice architecture, providing efficient inter-service communication and flexible scalability; it supports lightweight API interfaces and efficient communication protocols, is suitable for resource-constrained mobile devices, and provides fast response and low-latency database access. Through standardized API interfaces, it simplifies database access and management of desktop applications, and improves development efficiency and security. In traditional monolithic applications and enterprise-level architectures, the security, flexibility and performance of the system are improved through modern API gateway design.
[0090] The method of securely accessing the database, the API interface not only supports multiple communication protocols, but also can configure and optimize these protocols according to different business needs, providing users with highly customized services. At the API gateway level, multiple security functions including authentication, authorization, encryption, and logging are integrated to fully protect data security. By providing SDKs in multiple languages, applications of various platforms and languages can be easily accessed, greatly increasing the scope of application and flexibility of the system. Sensitive data is automatically identified and classified, and necessary protection measures such as data masking and access control are implemented to ensure the security of sensitive information.
[0091] Figure 2 FIG. 1 is a diagram showing an embodiment of a system for securely accessing a database based on an API interface according to the present invention; Figure 2 As shown, an embodiment of the present invention provides a system for securely accessing a database based on an API interface, comprising the following steps:
[0092] The access module 10 is used to obtain an access request, convert the access request into an API request, and access the database security gateway through the API request, wherein the database security gateway supports multiple communication protocols;
[0093] The request sending module 20 is used to determine whether the access request is qualified through the database security gateway, and if so, send the access request to the database to obtain the access result;
[0094] Integrate the development kit on the application's operating environment, respond to the upload request of the programming language, provide the corresponding development kit for the programming language, and simplify the process of programming language developers integrating and using the database security gateway;
[0095] A conversion device is installed on the application's running environment, and in response to an access request in a programming language, the access request is converted into an API request, and the database security gateway is accessed through the API request.
[0096] Integrate an authentication mechanism capable of supporting multi-factor authentication on the database security gateway, and authenticate the identity of the visitor through the authentication mechanism;
[0097] Integrate an authorization mechanism capable of supporting fine-grained access control on the database security gateway, establish a relationship between user roles and permissions through the authorization mechanism, and associate user roles with permissions based on the relationship;
[0098] A protection mechanism is integrated on the database security gateway.
[0099] The data cache technology is integrated on the database security gateway to reduce the direct pressure on the database.
[0100] The result returning module 30 is used to return the access result to the client.
[0101] The result returning module 30 is also used for:
[0102] The access result is encrypted, wherein the data encryption includes transport layer encryption, static data encryption and field level encryption.
[0103] Figure 3 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention, such as Figure 3As shown, the electronic device 40 includes: a processor 401 (processor), a memory 402 (memory) and a bus 403;
[0104] The processor 401 and the memory 402 communicate with each other via the bus 403;
[0105] The processor 401 is used to call the program instructions in the memory 402 to execute the methods provided by the above-mentioned method embodiments, for example, including: obtaining an access request, converting the access request into an API request, accessing a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols; determining whether the access request is qualified through the database security gateway, and if so, sending the access request to the database to obtain an access result; and returning the access result to the client.
[0106] The present embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions enable a computer to execute the methods provided by the above-mentioned method embodiments, for example, including: obtaining an access request, converting the access request into an API request, accessing a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols; determining whether the access request is qualified through the database security gateway, and if so, sending the access request to the database to obtain an access result; and returning the access result to the client.
[0107] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various storage media that can store program codes.
[0108] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0109] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0110] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.
Claims
1. A method for securely accessing a database, characterized in that: The method specifically comprises: Obtaining an access request, converting the access request into an API request, and accessing a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols; Determine whether the access request is qualified by the database security gateway, and if so, send the access request to the database to obtain the access result; The access result is returned to the client.
2. The method for securely accessing a database according to claim 1, characterized in that: The method for securely accessing a database further includes: Integrate the development kit on the application's operating environment, respond to the upload request of the programming language, provide the corresponding development kit for the programming language, and simplify the process of programming language developers integrating and using the database security gateway; A conversion device is installed on the application's running environment, and in response to an access request in a programming language, the access request is converted into an API request, and the database security gateway is accessed through the API request.
3. The method for securely accessing a database according to claim 1, characterized in that: The step of determining whether the access request is qualified by the database security gateway, and if so, sending the access request to the database to obtain the access result includes: Integrate an authentication mechanism capable of supporting multi-factor authentication on the database security gateway, and authenticate the identity of the visitor through the authentication mechanism; Integrate an authorization mechanism capable of supporting fine-grained access control on the database security gateway, establish a relationship between user roles and permissions through the authorization mechanism, and associate user roles with permissions based on the relationship; A protection mechanism is integrated on the database security gateway.
4. The method for securely accessing a database according to claim 1, characterized in that: The step of returning the access result to the client comprises: The access result is encrypted, wherein the data encryption includes transport layer encryption, static data encryption and field level encryption.
5. The method for securely accessing a database according to claim 1, characterized in that: The method for securely accessing a database further comprises: Record the operation log and determine whether there is any abnormal behavior in the operation log. If so, generate an alarm signal.
6. The method for securely accessing a database according to claim 1, characterized in that: The method for securely accessing a database further comprises: Scan the database, automatically discover sensitive data, and classify and grade the sensitive data; The sensitive data is dynamically masked to protect the privacy of the sensitive data and prevent unauthorized access.
7. The method for securely accessing a database according to claim 1, characterized in that: The method for securely accessing a database further comprises: Integrating data caching technology on the database security gateway to reduce direct pressure on the database; The load balancing technology is integrated on the database security gateway to realize the intelligent scheduling and distribution of database access requests.
8. A system for securely accessing a database based on an API interface, characterized in that: include: An access module, used to obtain an access request, convert the access request into an API request, and access a database security gateway through the API request, wherein the database security gateway supports multiple communication protocols; A request sending module, used to determine whether the access request is qualified through the database security gateway, and if so, send the access request to the database to obtain the access result; The result returning module is used to return the access result to the client.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Micro-service access proxy method and device thereof and storage medium
CN113676336A
API interface calling method and system based on data collection
CN117278640A
Data leakage prevention method and device in external interaction scene of electric power data
CN117688597A
Stateful database application programming interface
US10552442B1
Cited By
Gateway-form Java and Python mutual calling method
CN119718479A
Database security authentication method and system based on multiple factors
CN119808142A
Hybrid cloud power data acquisition and online monitoring early warning method and device
CN119853945A
Data security monitoring method and system based on USB network communication
CN119945763A
Signature certification authorization system, method and computer readable medium
TWI897686B
