Zero trust evaluation method, device, equipment and storage medium based on adversarial training
Through adversarial training generation adversarial network, the problem of inefficient evaluation of zero-trust gateways is solved, and automated evaluation is realized, improving efficiency and effectiveness of test cases.
Patent Information
- Application Number
- CN202411328234.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-09-23
AI Technical Summary
In the prior art, the evaluation of the zero-trust architecture to which the zero-trust gateway belongs is inefficient, mainly due to the manual writing of test cases that require professional knowledge, resulting in high labor costs and low efficiency.
Adversarial training is adopted to generate an adversarial network by obtaining interface documents, encoding and adding noise, and automatically generating test cases to improve the security evaluation efficiency of the zero-trust architecture to which the zero-trust gateway belongs.
It realizes automated generation of test cases, improves the efficiency and efficiency of zero-trust architecture evaluation, reduces manual intervention, enhances the effectiveness of test cases, and can more effectively discover the defects of zero-trust networks.
Smart Images

Figure CN118869561B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a zero-trust evaluation method, apparatus, device and storage medium based on adversarial training. Background Art
[0002] In the zero-trust scenario, the zero-trust gateway is the core part of the zero-trust architecture. It is deployed at the network entrance or the front end of the application service to separate users and resources and enforce access control policies on all traffic. The implementation of the zero-trust gateway is based on the zero-trust principle, that is, the zero-trust gateway never trusts entities such as terminals and users that access the network and requires continuous authentication. In order to test the deployment of the zero-trust architecture, it is necessary to generate valid test cases to test the zero-trust gateway.
[0003] In the related art, technicians with professional knowledge are required to manually write test cases, which has high labor costs and relies on manual experience, resulting in low efficiency in generating test cases. Therefore, testing based on manually coded test cases leads to low efficiency in evaluating the zero trust architecture to which the zero trust gateway belongs.
[0004] Therefore, how to improve the efficiency of evaluating the zero trust architecture to which the zero trust gateway belongs has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a zero-trust evaluation method, apparatus, device and storage medium based on adversarial training to improve the efficiency of evaluating the zero-trust architecture to which the zero-trust gateway belongs. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a zero-trust evaluation method based on adversarial training, which is applied to a zero-trust gateway, and the method includes:
[0007] Obtaining an interface document of the interface to be used as a first interface document; wherein the first interface document contains a plurality of key-value pairs;
[0008] Based on the interface specification of the registered interface in the zero-trust gateway and the preset encoding rules, the first interface document is encoded to obtain a first structure matrix and a first text matrix; wherein each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document; each row of the first text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the first interface document; the key-value pair types represented by the rows with the same sorting position in the first structure matrix and the first text matrix are the same;
[0009] A first type of noise is added to the first structural matrix, and a first input matrix obtained after adding the first type of noise is input into a pre-trained structural feature generator to obtain a first structural feature matrix, and a second type of noise is added to the first text matrix, and a second input matrix obtained after adding the second type of noise is input into a pre-trained text feature generator to obtain a first text feature matrix; wherein the structural feature generator and the text feature generator belong to: a generator in a generative adversarial network trained based on a second structural matrix and a second text matrix of an interface document of a sample interface;
[0010] Based on the interface specification and the preset decoding rules corresponding to the preset encoding rules, the first structural feature matrix and the first text feature matrix are decoded to obtain test cases; wherein, the test cases are used to evaluate the security of the zero trust architecture to which the zero trust gateway belongs.
[0011] Optionally, encoding the first interface document based on the interface specification of the registered interface in the zero-trust gateway and a preset encoding rule to obtain a first structure matrix and a first text matrix includes:
[0012] Determine a first number of all key-value pair types contained in the interface specification of the registered interface in the zero-trust gateway, and determine a generation rule for generating a structure matrix and a text matrix; wherein the generation rule represents the key-value pair types corresponding to the first number of rows in the structure matrix and the text matrix to be generated;
[0013] Encode the data type of the value in each key-value pair in the first interface document according to a first preset encoding rule to obtain a first vector representing the data type of the value in each key-value pair, and generate a first structure matrix having the first number of rows according to the generation rule based on each obtained first vector; wherein the element of the row corresponding to any key-value pair in the first interface document in the first structure matrix is the first vector of the key-value pair;
[0014] The values in each key-value pair in the first interface document are encoded according to a second preset encoding rule to obtain a second vector representing the value in each key-value pair, and based on the obtained second vectors and according to the generation rule, a first text matrix with the first number of rows is generated; wherein the element of the row corresponding to any key-value pair in the first interface document in the first text matrix is the second vector of the key-value pair.
[0015] Optionally, based on the interface specification and a preset decoding rule corresponding to the preset encoding rule, decoding the first structural feature matrix and the first text feature matrix to obtain a test case includes:
[0016] Decoding each row in the first structural feature matrix according to a preset decoding rule corresponding to the first preset encoding rule to obtain a data type of a value in a key-value pair corresponding to each row;
[0017] Decoding each row in the first text feature matrix according to a preset decoding rule corresponding to the second preset encoding rule to obtain a value in a key-value pair corresponding to each row;
[0018] Based on the values in each key-value pair obtained by decoding and the data types of the values in the key-value pairs, combined with the key-value pair type corresponding to each row represented by the generation rule, a test case containing each key-value pair obtained by decoding is obtained.
[0019] Optionally, the first preset encoding rule indicates encoding in a one-hot encoding manner.
[0020] Optionally, encoding the value in each key-value pair in the first interface document according to a second preset encoding rule includes:
[0021] For any key-value pair in the first interface document, if the data type of the value in the key-value pair is a numeric type, the value in the key-value pair is encoded using binary encoding; if the data type of the value in the key-value pair is a Boolean type, the value in the key-value pair is encoded as a vector with the highest two digits being 01 or 10; if the data type of the value in the key-value pair is a string type, the bag-of-words model is used to encode the value in the key-value pair.
[0022] Optionally, the values in each key-value pair in the first interface document are encoded according to a second preset encoding rule, including: for any key-value pair in the first interface document, if the data type of the value in the key-value pair is a numeric type, the value in the key-value pair is encoded using binary encoding; if the data type of the value in the key-value pair is a Boolean type, the value in the key-value pair is encoded as a vector with the highest two digits being 01 or 10; if the data type of the value in the key-value pair is a string type, the bag-of-words model is used to encode the value in the key-value pair.
[0023] Optionally, the input data dimension and the output data dimension of the structural feature generator are the same, and the input data dimension and the output data dimension of the text feature generator are the same;
[0024] The method further comprises: performing feature fusion on the second structure matrix and the second text matrix to obtain a first fusion feature, and performing feature fusion on the second structure feature matrix and the second text feature matrix to obtain a second fusion feature, including:
[0025] The rows with the same sorting position in the second structure matrix and the second text matrix are concatenated to obtain the first fusion feature, and the rows with the same sorting position in the second structure feature matrix and the second text feature matrix are concatenated to obtain the second fusion feature.
[0026] Optionally, the first type of noise is Gaussian noise and / or covariance noise; the second type of noise is uniform noise and / or exponential noise.
[0027] Optionally, the network layer in the structural feature generator is a convolutional neural network; the network layer in the text feature generator is a recurrent neural network.
[0028] Optionally, a method for evaluating the security of the zero trust architecture to which the zero trust gateway belongs includes:
[0029] Based on the test results of multiple test cases, the probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is calculated using a first preset formula as an evaluation result of the security of the zero trust architecture to which the zero trust gateway belongs; wherein the first preset formula is:
[0030] (q+T×z) / B×100%;
[0031] Among them, the test result of each test case is a first result indicating that the test case is executed successfully, a second result indicating that the test case is executed unsuccessfully, or a third result indicating that the execution of the test case causes the system to crash; q is the number of second results in the test results, z is the number of third results in the test results, T is a preset weight, and B is the number of the multiple test cases.
[0032] Optionally, the method further comprises:
[0033] If the calculated probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is higher than a preset threshold, a test report is generated based on the test results of each test case; wherein the test report includes: the test cases corresponding to the test results in the test results indicating execution failure and system crash.
[0034] In a second aspect, an embodiment of the present application provides a zero-trust evaluation device based on adversarial training, which is applied to a zero-trust gateway, and the device includes:
[0035] An acquisition module, used to acquire an interface document of the interface to be used as a first interface document; wherein the first interface document contains a plurality of key-value pairs;
[0036] An encoding module, used to encode the first interface document based on the interface specification of the registered interface in the zero-trust gateway and the preset encoding rules, to obtain a first structure matrix and a first text matrix; wherein each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document; each row of the first text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the first interface document; the key-value pair types represented by the rows with the same sorting position in the first structure matrix and the first text matrix are the same;
[0037] A feature generation module is used to add a first type of noise to the first structural matrix, and input the first input matrix obtained after adding the first type of noise into a pre-trained structural feature generator to obtain a first structural feature matrix, and to add a second type of noise to the first text matrix, and input the second input matrix obtained after adding the second type of noise into a pre-trained text feature generator to obtain a first text feature matrix; wherein the structural feature generator and the text feature generator belong to: a generator in a generative adversarial network trained based on a second structural matrix and a second text matrix of an interface document of a sample interface;
[0038] A decoding module is used to decode the first structural feature matrix and the first text feature matrix based on the interface specification and the preset decoding rules corresponding to the preset encoding rules to obtain a test case; wherein the test case is used to evaluate the security of the zero trust architecture to which the zero trust gateway belongs.
[0039] Optionally, the encoding module includes:
[0040] A determination submodule is used to determine a first number of all key-value pair types contained in the interface specification of the registered interface in the zero-trust gateway, and determine a generation rule for generating a structure matrix and a text matrix; wherein the generation rule represents the key-value pair types corresponding to the first number of rows in the structure matrix and the text matrix to be generated;
[0041] A first encoding submodule is used to encode the data type of the value in each key-value pair in the first interface document according to a first preset encoding rule to obtain a first vector representing the data type of the value in each key-value pair, and generate a first structure matrix with the first number of rows according to the generation rule based on each obtained first vector; wherein the element of the row corresponding to any key-value pair in the first interface document in the first structure matrix is the first vector of the key-value pair;
[0042] The second encoding submodule is used to encode the values in each key-value pair in the first interface document according to a second preset encoding rule to obtain a second vector representing the value in each key-value pair, and generate a first text matrix with the first number of rows according to the generation rule based on each obtained second vector; wherein the element of the row corresponding to any key-value pair in the first interface document in the first text matrix is the second vector of the key-value pair.
[0043] Optionally, the decoding module includes:
[0044] A first decoding submodule, configured to decode each row in the first structural feature matrix according to a preset decoding rule corresponding to the first preset encoding rule, to obtain a data type of a value in a key-value pair corresponding to each row;
[0045] A second decoding submodule, configured to decode each line of the first text feature according to a preset decoding rule corresponding to the second preset encoding rule, to obtain a value in a key-value pair corresponding to each line;
[0046] A generation submodule is used to obtain test cases containing each key-value pair obtained by decoding based on the values in each key-value pair obtained by decoding and the data types of the values in the key-value pair, combined with the key-value pair type corresponding to each row represented by the generation rule.
[0047] Optionally, the first preset encoding rule indicates encoding in a one-hot encoding manner.
[0048] Optionally, the second encoding submodule is specifically used to:
[0049] For any key-value pair in the first interface document, if the data type of the value in the key-value pair is a numeric type, the value in the key-value pair is encoded using binary encoding; if the data type of the value in the key-value pair is a Boolean type, the value in the key-value pair is encoded as a vector with the highest two digits being 01 or 10; if the data type of the value in the key-value pair is a string type, the bag-of-words model is used to encode the value in the key-value pair.
[0050] Optionally, the training process of the generative adversarial network includes:
[0051] Obtain an interface document of a sample interface as a second interface document;
[0052] Based on the interface specification of the registered interface in the zero-trust gateway and the preset encoding rules, the second interface document is encoded to obtain a second structure matrix and a second text matrix; wherein each row of the second structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the second interface document; each row of the second text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the second interface document; the rows with the same sorting position in the second structure matrix and the second text matrix represent the same key-value pair type;
[0053] adding the first type of noise to the second structure matrix, and inputting a third input matrix obtained after adding the first type of noise into an initial structure feature generator to obtain a second structure feature matrix, and adding the second type of noise to the second text matrix, and inputting a fourth input matrix obtained after adding the second type of noise into an initial text feature generator to obtain a second text feature matrix;
[0054] Performing feature fusion on the second structure matrix and the second text matrix to obtain a first fusion feature, and performing feature fusion on the second structure feature matrix and the second text feature matrix to obtain a second fusion feature;
[0055] The obtained fused features are input into the discriminator in the generative adversarial network, and based on the probability output by the discriminator indicating that the input fused features are generated by the generator, and the difference between the labels of the input fused features, the model parameters of the generative adversarial network are adjusted until the preset convergence conditions are reached.
[0056] Optionally, the input data dimension and the output data dimension of the structural feature generator are the same, and the input data dimension and the output data dimension of the text feature generator are the same;
[0057] The method further comprises: performing feature fusion on the second structure matrix and the second text matrix to obtain a first fusion feature, and performing feature fusion on the second structure feature matrix and the second text feature matrix to obtain a second fusion feature, including:
[0058] The rows with the same sorting position in the second structure matrix and the second text matrix are concatenated to obtain the first fusion feature, and the rows with the same sorting position in the second structure feature matrix and the second text feature matrix are concatenated to obtain the second fusion feature.
[0059] Optionally, the first type of noise is Gaussian noise and / or covariance noise; the second type of noise is uniform noise and / or exponential noise.
[0060] Optionally, the network layer in the structural feature generator is a convolutional neural network; the network layer in the text feature generator is a recurrent neural network.
[0061] Optionally, a method for evaluating the security of the zero trust architecture to which the zero trust gateway belongs includes:
[0062] Based on the test results of multiple test cases, the probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is calculated using a first preset formula as an evaluation result of the security of the zero trust architecture to which the zero trust gateway belongs; wherein the first preset formula is:
[0063] (q+T×z) / B×100%;
[0064] Among them, the test result of each test case is a first result indicating that the test case is executed successfully, a second result indicating that the test case is executed unsuccessfully, or a third result indicating that the execution of the test case causes the system to crash; q is the number of second results in the test results, z is the number of third results in the test results, T is a preset weight, and B is the number of the multiple test cases.
[0065] Optionally, the device further comprises:
[0066] A report generation module is used to generate a test report based on the test results of each test case if the calculated probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is higher than a preset threshold; wherein the test report includes: test cases corresponding to the test results indicating execution failure and system crash in the test results.
[0067] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0068] Memory, used to store computer programs;
[0069] The processor is used to implement any of the above-mentioned zero-trust evaluation methods based on adversarial training when executing a program stored in the memory.
[0070] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements any of the above-mentioned zero-trust evaluation methods based on adversarial training.
[0071] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes executable instructions. When the executable instructions are executed on a computer, the computer executes any one of the zero-trust evaluation methods based on adversarial training described above.
[0072] Beneficial effects of the embodiments of the present application:
[0073] The solution provided by the embodiment of the present application is that since each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document, the first structure matrix can represent the relationship between the key-value pair type contained in the first interface document and all the key-value pair types in the interface specification, as well as the data type of the value of each key-value pair in the first interface document, so the first structure matrix can reflect the structural characteristics of the first interface document. The first text matrix can represent the relationship between the key-value pair type contained in the first interface document and all the key-value pair types in the interface specification, as well as the value of each key-value pair in the first interface document, so the first text matrix can reflect the text characteristics of the first interface document. After adding the first type of noise to the first structure matrix, the pre-trained structure feature generator is input to obtain the first structure feature matrix, and after adding the second type of noise to the first text matrix, the pre-trained text feature generator is input to obtain the first text feature matrix, and then based on the preset decoding rules corresponding to the interface specification and the preset encoding rules, the first structure feature matrix and the first text feature matrix are decoded to obtain test cases. It can be seen that this solution can automatically generate test cases based on the generative adversarial network, thereby improving the generation efficiency of test cases. Then, using the generated test cases to evaluate the security of the zero trust architecture to which the zero trust gateway belongs can improve the efficiency of evaluating the zero trust architecture to which the zero trust gateway belongs.
[0074] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0076] Figure 1 A flowchart of a zero-trust evaluation method based on adversarial training provided in an embodiment of the present application;
[0077] Figure 2A flowchart of a training process of a generative adversarial network provided in an embodiment of the present application;
[0078] Figure 3 A schematic diagram of a generative adversarial network provided in an embodiment of the present application;
[0079] Figure 4 A schematic diagram of the structure of a zero-trust evaluation device based on adversarial training provided in an embodiment of the present application;
[0080] Figure 5 A block diagram of an electronic device that implements the zero-trust evaluation method based on adversarial training provided in an embodiment of the present application. DETAILED DESCRIPTION
[0081] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0082] First, the professional terms involved in the embodiments of the present application are introduced.
[0083] Zero Trust: A security concept model that means that entities such as devices, users, and terminals that access the environment are never trusted and are continuously authenticated.
[0084] Fuzzing Test: An automated testing technology whose core idea is to input a large amount of randomly generated unexpected data into the target program, and at the same time collect and monitor the abnormal information of the target program during the execution of test cases, so as to find as many illegal inputs as possible that cause errors in the target program and find the vulnerabilities of the target program.
[0085] Generative Adversarial Network: A deep learning network consisting of a generator and a discriminator. It achieves balance mainly through two-way training and learning of the generator and the discriminator.
[0086] Reinforcement learning: A deep learning method that provides feedback on predictions to optimize the model training process.
[0087] Below, the zero-trust evaluation method based on adversarial training provided in an embodiment of the present application is introduced.
[0088] A zero-trust evaluation method based on adversarial training provided in an embodiment of the present application is applied to a zero-trust gateway and may include the following steps:
[0089] Obtaining an interface document of the interface to be used as a first interface document; wherein the first interface document includes a plurality of key-value pairs;
[0090] Based on the interface specifications of the registered interfaces in the zero-trust gateway and the preset encoding rules, the first interface document is encoded to obtain a first structure matrix and a first text matrix; wherein each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document; each row of the first text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the first interface document; the key-value pair types represented by the rows with the same sorting position in the first structure matrix and the first text matrix are the same;
[0091] A first type of noise is added to the first structural matrix, and a first input matrix obtained after adding the first type of noise is input into a pre-trained structural feature generator to obtain a first structural feature matrix, and a second type of noise is added to the first text matrix, and a second input matrix obtained after adding the second type of noise is input into a pre-trained text feature generator to obtain a first text feature matrix; wherein the structural feature generator and the text feature generator belong to: a generator in a generative adversarial network trained based on a second structural matrix and a second text matrix of an interface document of a sample interface;
[0092] Based on the interface specification and the preset decoding rules corresponding to the preset encoding rules, the first structural feature matrix and the first text feature matrix are decoded to obtain test cases; wherein the test cases are used to evaluate the security of the zero trust architecture to which the zero trust gateway belongs.
[0093] The solution provided by the embodiment of the present application is that since each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document, the first structure matrix can represent the relationship between the key-value pair type contained in the first interface document and all the key-value pair types in the interface specification, as well as the data type of the value of each key-value pair in the first interface document, so the first structure matrix can reflect the structural characteristics of the first interface document. The first text matrix can represent the relationship between the key-value pair type contained in the first interface document and all the key-value pair types in the interface specification, as well as the value of each key-value pair in the first interface document, so the first text matrix can reflect the text characteristics of the first interface document. After adding the first type of noise to the first structure matrix, the pre-trained structure feature generator is input to obtain the first structure feature matrix, and after adding the second type of noise to the first text matrix, the pre-trained text feature generator is input to obtain the first text feature matrix, and then based on the preset decoding rules corresponding to the interface specification and the preset encoding rules, the first structure feature matrix and the first text feature matrix are decoded to obtain test cases. It can be seen that this solution can automatically generate test cases based on the generative adversarial network, thereby improving the generation efficiency of test cases. Then, using the generated test cases to evaluate the security of the zero trust architecture to which the zero trust gateway belongs can improve the efficiency of evaluating the zero trust architecture to which the zero trust gateway belongs.
[0094] Moreover, since the test cases are generated by combining the information in the interface specifications and interface documents, and effectively combining the structural features and text features, the generated test cases can meet the interface specifications, thereby improving the effectiveness of the generated test cases. Therefore, compared with the method of generating test cases by only considering text features, the test cases generated by this solution can more effectively discover the defects of the zero-trust network.
[0095] The following is an introduction to the zero-trust evaluation method based on adversarial training provided by the embodiment of the present application in conjunction with the accompanying drawings. Figure 1 As shown, the method includes steps S101-S104:
[0096] S101, obtaining an interface document of an interface to be used as a first interface document; wherein the first interface document includes a plurality of key-value pairs;
[0097] In this embodiment, the interface to be used can be any interface registered on the zero-trust gateway. It can be understood that the zero-trust gateway provides a unified entrance for the services in the system, and the interfaces of all services in the system are registered on the zero-trust gateway, that is, the zero-trust gateway records the interface documents and interface specifications of all interfaces, so the interface documents of the interface to be used can be obtained from the zero-trust gateway.
[0098] For example, in actual applications, the zero-trust gateway is used to implement zero-trust management and control of interfaces, that is, the interfaces of all services are known and controlled in advance by the zero-trust gateway when the zero-trust architecture is implemented and deployed, and the interfaces of all services need to report the interface specifications and interface documents of the service to the zero-trust gateway for management and control.
[0099] It should be noted that the interface specification mainly defines the behavior and constraints of the interface, including how the interface should respond to different inputs, as well as the performance requirements and security requirements of the interface. The interface document is used to describe the detailed information of the interface, including the name, parameters, return value, request method, etc. For example, in actual applications, the first interface document contains multiple key-value pairs, such as URL (Uniform Resource Locator) key-value pairs, request method key-value pairs, and so on.
[0100] S102, based on the interface specification of the registered interface in the zero trust gateway and the preset encoding rules, encode the first interface document to obtain a first structure matrix and a first text matrix; wherein each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document; each row of the first text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the first interface document; the key-value pair types represented by the rows with the same sorting position in the first structure matrix and the first text matrix are the same;
[0101] In this embodiment, the interface specification of the registered interface in the zero-trust gateway defines the possible key-value pair types in the interface documents of all registered interfaces, as well as the data types of the values of all key-value pairs. Among them, the key-value pair type is the type of key in the key-value pair, which can reflect the meaning of the parameter represented. For example, if the type of key in a key-value pair is URL, the key-value pair type of the key-value pair is URL, and the meaning of the parameter represented by the key-value pair type is the access address of the interface. Exemplarily, in actual applications, all key-value pair types defined in the interface specification may include: URL, request method, User-Agent (user agent identifier), Host (specify the host name and port number of the server), etc. The data types of the values of all key-value pairs may include: numerical type, Boolean type, string type, and so on.
[0102] It is understandable that, in practical applications, an interface document usually includes a URL, a request method, a request header, a request body, a response header, and a response body, wherein the request header, the request body, the response header, and the response body all include multiple key-value pairs. For a request header, a request body, a response header, or a response body, although it can be used as a key-value pair itself, since it also includes multiple key-value pairs inside, if the request header, the request body, the response header, or the response body is respectively used as a key-value pair type, it is not conducive to the model's learning of its internal key-value pairs. Therefore, in this embodiment, statistics of key-value pair types are performed according to the specific key-value pairs inside the request header, the request body, the response header, and the response body in each interface document.
[0103] It can be understood that according to the interface specification, the number of all different key-value pair types can be counted, and the different key-value pair types can be sorted, so that when generating the first structure matrix and the first text matrix, the encoded data corresponding to each key-value pair in the first interface document can be filled into the row representing the key-value pair type in the first structure matrix and the first text matrix according to the sorting order of the different key-value pair types.
[0104] Exemplarily, in one implementation, a matrix of N×m1 and a matrix of N×m2 can be initialized, and all elements in the matrix are 0. N is the number of all key-value pair types in the interface specification, m1 is the number of data types of the values of all key-value pairs, and m2 is the encoding length required to encode all possible values of the values in each key-value pair of the first interface document. All key-value pair types in the interface specification are k1, k2, k3...k N , the sorting order of each key-value pair type can be [k1, k2, k3…k N ], the i-th row in the matrix of N×m1 scale and the matrix of N×m2 scale both correspond to the i-th position in the sorting order. For example, for the key-value pair of key-value pair type k2 in the first interface document, the vector obtained by encoding the data type of the value in the key-value pair is filled into the second row in the matrix of N×m1 scale, and the vector obtained by encoding the value in the key-value pair is filled into the second row in the matrix of N×m2 scale.
[0105] It should be noted that the method of sorting different key-value pair types can be set by relevant technical personnel based on experience. For example, in one implementation, the key-value pair types can be sorted according to the order of appearance in the interface specification. The embodiments of the present application do not limit this.
[0106] Exemplarily, if the number of all key-value pair types defined in the interface specification is 4, and the sorted key-value pair types are: URL, request method, User-Agent, and Host, and if the first interface document includes two key-value pairs, URL and request method, then the generated first structure matrix contains 4 rows of vectors, the elements of the first row represent the data type of the value in the URL key-value pair, and the elements of the second row represent the data type of the value in the request method key-value pair. Since the first interface document does not include User-Agent and Host, the elements of the third and fourth rows in the first structure matrix are 0. Correspondingly, the generated first text matrix also contains 4 rows of vectors, the elements of the first row represent the values in the URL key-value pair, and the elements of the second row represent the values in the request method key-value pair. Since the first interface document does not include User-Agent and Host, the elements of the third and fourth rows in the first text matrix are 0.
[0107] In addition, it should be noted that the preset encoding rules may include a first preset encoding rule for encoding the data type of the value in each key-value pair in the first connection document, and a second preset encoding rule for encoding the value in each key-value pair in the first connection document. In one implementation, based on the interface specification of the registered interface in the zero trust gateway and the preset encoding rule, the first interface document is encoded to obtain a first structure matrix and a first text matrix, including steps A1-A3:
[0108] A1, determining a first number of all key-value pair types contained in the interface specification of the registered interface in the zero trust gateway, and determining a generation rule for generating a structure matrix and a text matrix; wherein the generation rule represents the key-value pair types corresponding to the first number of rows in the structure matrix and the text matrix to be generated;
[0109] In this implementation, the number of all key-value pair types included in the interface specification can be counted as the first number, and the generation rule of the key-value pair type corresponding to each row in the structure matrix and the text matrix to be generated can be determined, so that when the first structure matrix and the first text matrix are subsequently generated, the encoded data corresponding to the key-value pair type can be filled into the row representing the key-value pair type in the first structure matrix and the first text matrix according to the key-value pair type corresponding to each row. It should be noted that in actual applications, the generation rule can be set by relevant technical personnel based on experience, and the embodiment of the present application does not limit this.
[0110] For example, if all key-value pairs in the interface specification are of the following types: URL, request method, User-Agent, and Host, then the generation rule may be that the key-value pair type corresponding to the first row in the structure matrix and text matrix to be generated is URL, the key-value pair type corresponding to the second row is request method, the key-value pair type corresponding to the first row is User-Agent, and the key-value pair type corresponding to the fourth row is Host.
[0111] A2, encoding the data type of the value in each key-value pair in the first interface document according to a first preset encoding rule, obtaining a first vector representing the data type of the value in each key-value pair, and generating a first structure matrix with a first number of rows according to a generation rule based on each obtained first vector; wherein the element of the row corresponding to any key-value pair in the first interface document in the first structure matrix is the first vector of the key-value pair;
[0112] Exemplarily, the first preset encoding rule may represent encoding according to label encoding, one-hot encoding or hash encoding, and so on. Exemplarily, in a specific implementation, one-hot encoding may be used to encode the data type of the value in each key-value pair in the first interface document. It is understandable that one-hot encoding is suitable for processing data with clear, finite and usually non-numerical categorical values, which maps the value of each discrete feature to a binary vector in which only one element is 1 and the rest are 0. This encoding method is intuitive and easy to understand and implement, can avoid misunderstandings of numerical relationships, ensure that each category is completely independent, and can handle categorical variables well.
[0113] Exemplarily, if the data types of the values in the interface specification include three types, namely, numeric type, Boolean type, and string type, then the numeric type can be encoded as (1,0,0), the Boolean type can be encoded as (0,1,0), and the string type can be encoded as (0,0,1) using the one-hot encoding method. If the first interface document contains two key-value pairs, URL and request method, and the data types of the values in the two key-value pairs are both string types, then after encoding using the one-hot encoding method, a first vector (0,0,1) representing the data type of the value in the URL key-value pair and a first vector (0,0,1) representing the data type of the value in the request method key-value pair can be obtained. Then, based on the obtained first vectors and the above-mentioned generation rules, the generated first structure matrix is: .
[0114] A3, encode the values in each key-value pair in the first interface document according to the second preset encoding rule to obtain a second vector representing the value in each key-value pair, and generate a first text matrix with a first number of rows according to the generation rule based on the obtained second vectors; wherein the element of the row corresponding to any key-value pair in the first interface document in the first text matrix is the second vector of the key-value pair.
[0115] In this implementation, the second preset encoding rule may be an encoding rule related to the data type of the value in each key-value pair, that is, different encoding methods are used for encoding values of different data types.
[0116] Exemplarily, in a specific implementation, encoding the value in each key-value pair in the first interface document according to the second preset encoding rule includes:
[0117] For any key-value pair in the first interface document, if the data type of the value in the key-value pair is a numeric type, the value in the key-value pair is encoded using binary encoding; if the data type of the value in the key-value pair is a Boolean type, the value in the key-value pair is encoded as a vector with the highest two digits being 01 or 10; if the data type of the value in the key-value pair is a string type, the bag-of-words model is used to encode the value in the key-value pair.
[0118] It is understandable that, in addition to the key-value pairs contained in the first interface document, possible values of the values in each key-value pair are also defined. In order to encode the values in each key-value pair into vectors of the same length, the maximum number of encoding bits that can realize the encoding of all possible values can be determined based on the possible values of the values in each key-value pair, as the length of the second vector.
[0119] Exemplarily, if the possible values of the numeric type in the first interface document are 0, 1, 2, 3, 4, and 5, the possible values of the Boolean type are true and false, and the possible values of the string type are test and request, and the length of the second vector is 4, then for the key-value pair of the numeric type with a value of 2 in the key-value pair, the value can be binary encoded to obtain the second vector (0, 0, 1, 0); for the key-value pair of the Boolean type with a value of true in the key-value pair, the value can be encoded as a vector with the highest two bits being 10, and the other bits being 0, that is, The second vector obtained is (1,0,0,0); for a Boolean key-value pair whose value is false, the value can be encoded as a vector with the highest two bits being 01 and the other bits being 0, that is, the second vector obtained is (0,1,0,0); for a string-type key-value pair whose value is test, the value can be encoded into a vector of length 4 through the bag-of-words model, where the bag-of-words model can first perform one-hot encoding on all possible values of the string type, and then perform word-embedding processing to obtain a vector of length 4.
[0120] S103, adding a first type of noise to the first structural matrix, and inputting a first input matrix obtained after adding the first type of noise into a pre-trained structural feature generator to obtain a first structural feature matrix, and adding a second type of noise to the first text matrix, and inputting a second input matrix obtained after adding the second type of noise into a pre-trained text feature generator to obtain a first text feature matrix; wherein the structural feature generator and the text feature generator belong to: a generator in a generative adversarial network trained based on a second structural matrix and a second text matrix of an interface document of a sample interface;
[0121] In this embodiment, the first type and the second type can be the same type or different types. It can be understood that after adding the first type of noise to the first structural matrix and then inputting it into the pre-trained structural feature generator, and after adding the second type of noise to the first text matrix and then inputting it into the pre-trained text feature generator, the generator can gradually convert the noise-added data into an output similar to the real sample through a series of neural network layers, thereby helping the generator to learn more features, increase the randomness and variability of the generated samples, and improve the diversity of the results output by the generator.
[0122] It should be noted that the structural feature generator and text feature generator in this embodiment are two generators included in a pre-trained generative adversarial network. For the sake of clarity, the training process of the generative adversarial network is introduced in the following embodiments and will not be repeated here.
[0123] It is understandable that since convolutional neural networks can better process structural features and recurrent neural networks can better process text features, in one implementation, the structural feature generator can use a convolutional neural network as a specific network layer, and the text feature generator can use a recurrent neural network as a specific network layer. Accordingly, in this implementation, the first type of noise can be Gaussian noise and / or covariance noise, and the second type of noise can be uniform noise and / or exponential noise. It is understandable that Gaussian noise and covariance noise have a good effect on convolution operations, and uniform noise and exponential noise can improve the text feature processing effect and make the model converge faster.
[0124] It should be noted that the method of adding noise to the matrix can be: generating a noise matrix of the same size as the original matrix, and then performing mathematical calculations on the noise matrix and the original matrix, such as adding, to obtain a first input matrix after adding noise. Exemplarily, Gaussian noise is a random noise that obeys a normal distribution, and the method of adding Gaussian noise to the first structure matrix is: generating random numbers of a standard normal distribution through a random number generation function to obtain a Gaussian noise matrix of the same size as the first structure matrix, and then adding the Gaussian noise matrix to the first structure matrix, thereby adding Gaussian noise to the first structure matrix to obtain a first input matrix.
[0125] Exemplarily, in practical applications, the structural feature generator includes an encoder and a decoder, and the specific network layer can adopt the network layer in the convolutional neural network. For example, the network layer structure of the encoder and the decoder can be: input layer, convolution layer 1, pooling layer 1, convolution layer 2, pooling layer 2, depooling layer 2, deconvolution layer 2, depooling layer 1, deconvolution layer 1, and output layer are connected in sequence. Among them, the convolution layer and the pooling layer are used to implement encoding, and the deconvolution layer and the depooling layer are used to implement decoding. The structural feature generator encodes and decodes the input tensor after adding the first type of noise, and outputs a tensor of the same scale as the input. For example, if the scale of the first input matrix is N×m1, the scale of the output first structural feature matrix is also N×m1. The overall structure of the text feature generator can be a bidirectional LSTM (Long Short-Term Memory), and the bidirectional LSTM is an encoder-decoder architecture. The text feature generator performs context calculation on the input tensor after adding the second type of noise, and outputs a tensor of the same scale as the input. For example, if the size of the second input matrix is N×m2, the size of the output first text feature matrix is also N×m2.
[0126] It should be noted that the structural feature generator and the text feature generator in the embodiments of the present application are both encoder-decoder architectures, the input data scale and output data scale of any generator are the same, and the meaning of each row in the matrix output by the default generator is the same as the meaning of the row in the input matrix.
[0127] S104, based on the interface specification and the preset decoding rules corresponding to the preset encoding rules, decode the first structural feature matrix and the first text feature matrix to obtain a test case; wherein the test case is used to evaluate the security of the zero trust architecture to which the zero trust gateway belongs.
[0128] It can be understood that since the first structural feature matrix is generated by the structural feature generator based on the first structural matrix, and the first text feature matrix is generated by the text feature generator based on the first text matrix, the first structural feature matrix and the first text feature matrix can be decoded according to the inverse processing method of the encoding method used when generating the first structural matrix and the first text matrix, that is, the preset decoding rules corresponding to the preset encoding rules, to obtain test cases containing various key-value pairs.
[0129] It can be understood that after decoding the first structural feature matrix, the decoding result of each row element in the first structural feature matrix is the data type of the key-value pair value of the key-value pair type represented by the row, and after decoding the first text feature matrix, the decoding result of each row element in the first text feature matrix is the value of the key-value pair of the key-value pair type represented by the row. After obtaining the value of the key-value pair and the data type of the value, combined with the key-value pair type, each key-value pair can be obtained, thereby obtaining a test case containing each key-value pair.
[0130] By repeatedly executing the above steps S101-S104, multiple test cases can be obtained. In this embodiment, after multiple test cases are obtained, the multiple test cases can be run on the zero trust gateway to test the services managed in the zero trust gateway, and the security of the zero trust architecture to which the zero trust gateway belongs can be evaluated through the response of the interface of each service.
[0131] It should be noted that in order to make the solution layout clear, the specific decoding method and the method of evaluating the security of the zero trust architecture to which the zero trust gateway belongs are introduced in the following embodiments and will not be repeated here.
[0132] The solution provided by the embodiment of the present application is that since each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document, the first structure matrix can represent the relationship between the key-value pair type contained in the first interface document and all the key-value pair types in the interface specification, as well as the data type of the value of each key-value pair in the first interface document, so the first structure matrix can reflect the structural characteristics of the first interface document. The first text matrix can represent the relationship between the key-value pair type contained in the first interface document and all the key-value pair types in the interface specification, as well as the value of each key-value pair in the first interface document, so the first text matrix can reflect the text characteristics of the first interface document. After adding the first type of noise to the first structure matrix, the pre-trained structure feature generator is input to obtain the first structure feature matrix, and after adding the second type of noise to the first text matrix, the pre-trained text feature generator is input to obtain the first text feature matrix, and then based on the preset decoding rules corresponding to the interface specification and the preset encoding rules, the first structure feature matrix and the first text feature matrix are decoded to obtain test cases. It can be seen that this solution can automatically generate test cases based on the generative adversarial network, thereby improving the generation efficiency of test cases. Then, using the generated test cases to evaluate the security of the zero trust architecture to which the zero trust gateway belongs can improve the efficiency of evaluating the zero trust architecture to which the zero trust gateway belongs.
[0133] Moreover, since the test cases are generated by combining the information in the interface specifications and interface documents, and effectively combining the structural features and text features, the generated test cases can meet the interface specifications, thereby improving the effectiveness of the generated test cases. Therefore, compared with the method of generating test cases by only considering text features, the test cases generated by this solution can more effectively discover the defects of the zero-trust network.
[0134] Optionally, in an embodiment, in the above step S104, based on the interface specification and the preset decoding rule corresponding to the preset encoding rule, decoding the first structural feature matrix and the first text feature matrix to obtain the test case may include steps B1-B3:
[0135] B1, decoding each row in the first structural feature matrix according to a preset decoding rule corresponding to the first preset encoding rule to obtain the data type of the value in the key-value pair corresponding to each row;
[0136] B2, decoding each row in the first text feature matrix according to a preset decoding rule corresponding to the second preset encoding rule to obtain a value in a key-value pair corresponding to each row;
[0137] It can be understood that the decoding rules corresponding to the encoding rules can restore the encoded data to the data before encoding. Therefore, each row in the first structural feature matrix can be decoded according to the preset decoding rules corresponding to the first preset encoding rules, and each row in the first text feature matrix can be decoded according to the preset decoding rules corresponding to the second preset encoding rules.
[0138] It should be noted that since the first preset encoding rule is to encode the data type of the value in each key-value pair in the first interface document to obtain the encoding rule of the first structure matrix, and the first structure feature matrix is generated by the structure feature generator after adding noise to the first structure matrix, therefore, if the first structure feature matrix is decoded directly according to the preset decoding rule corresponding to the first preset encoding rule, there are row vectors that cannot be restored to the data before encoding. At this time, the first structure feature matrix needs to be normalized first so that each row vector in the normalized first structure feature matrix can be mapped to the data before encoding. Similarly, before decoding the first text feature matrix, the first text feature matrix also needs to be normalized.
[0139] Exemplarily, the normalization processing method can be: for each row vector, the distance between the row vector and each candidate row vector is calculated, and then the candidate row vector with the smallest corresponding distance is used as the normalized row vector of the row vector. Among them, each candidate row vector is a possible value of the row vector. For example, if the first preset encoding rule indicates encoding in a one-hot encoding manner, and the data types include three types: numeric type, Boolean type and string type, the numeric type is encoded as (1,0,0), the Boolean type is encoded as (0,1,0), and the string type is encoded as (0,0,1); if a row vector in the first structural feature matrix is (1.1,0,0), then each candidate row vector is (1,0,0), (0,1,0) and (0,0,1), and after calculating the distance between the row vector and each candidate row vector, the row vector (1,0,0) with the smallest distance is determined as the normalized row vector of the row vector (1.1,0,0). The normalized row vector is decoded to obtain that the data type of the value in the key-value pair of the key-value pair type represented by the row vector is a numeric type.
[0140] For another example, if the value true of the Boolean data type is encoded as (1,0) and false is encoded as (0,1) according to the second preset encoding rule; if a row vector of the Boolean data type representing a value in the first text feature matrix is (0.1, 0.3), then the candidate row vectors corresponding to the row vector are (1,0) and (0,1), and after calculating the distance between the row vector and each candidate row vector, the row vector (0,1) with the smallest distance is determined as the normalized row vector of the row vector (0.1,0.3). The normalized row vector is decoded to obtain the value of the key-value pair of the key-value pair type represented by the row vector, which is false.
[0141] B3, based on the values in each key-value pair obtained by decoding and the data types of the values in the key-value pair, combined with the key-value pair type corresponding to each row represented by the generation rule, obtain a test case containing each key-value pair obtained by decoding.
[0142] It can be understood that after decoding through steps B1 and B2, the data type of the value in the key-value pair corresponding to each row in the first structural feature matrix and the value in the key-value pair corresponding to each row in the first text feature matrix can be obtained. Combined with the key-value pair type corresponding to each row represented by the above generation rule, the key, value and value data type in each key-value pair can be obtained, so that the test case containing each key-value pair can be obtained.
[0143] It can be seen that, through this solution, accurate decoding results can be obtained by decoding according to the preset decoding rules corresponding to the preset encoding rules.
[0144] Optionally, in another embodiment of the present application, Figure 2 As shown, the training process of generating an adversarial network may include steps S201-S205:
[0145] S201, obtaining an interface document of a sample interface as a second interface document; wherein the second interface document includes a plurality of key-value pairs;
[0146] In this embodiment, the sample interface can be any interface registered on the zero trust gateway.
[0147] S202, based on the interface specification of the registered interface in the zero trust gateway and the preset encoding rules, encode the second interface document to obtain a second structure matrix and a second text matrix; wherein each row of the second structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the second interface document; each row of the second text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the second interface document; the key-value pair types represented by the rows with the same sorting position in the second structure matrix and the second text matrix are the same;
[0148] S203, adding the first type of noise to the second structure matrix, and inputting the third input matrix obtained after adding the first type of noise into the initial structure feature generator to obtain a second structure feature matrix, and adding the second type of noise to the second text matrix, and inputting the fourth input matrix obtained after adding the second type of noise into the initial text feature generator to obtain a second text feature matrix;
[0149] It should be noted that the specific implementation of the above steps S201-S203 can refer to the description of the above steps S101-S103, which will not be repeated here.
[0150] S204, performing feature fusion on the second structure matrix and the second text matrix to obtain a first fusion feature, and performing feature fusion on the second structure feature matrix and the second text feature matrix to obtain a second fusion feature;
[0151] In this embodiment, the method of performing feature fusion on the second structure matrix and the second text matrix is the same as the method of performing feature fusion on the second structure feature matrix and the second text feature matrix. Exemplarily, the method of performing feature fusion on the matrices may be to add or multiply the matrices element by element, or to concatenate the elements of the rows representing the same key-value pair type in the matrices to obtain fused features. It should be noted that the embodiment of the present application does not limit the method of feature fusion.
[0152] Optionally, in one implementation, the input data dimension and the output data dimension of the structural feature generator are the same, and the output data have the same meaning as the same row in the input data; the input data dimension and the output data dimension of the text feature generator are the same, and the output data have the same meaning as the same row in the input data; accordingly, in this implementation, the second structural matrix and the second text matrix are feature-fused to obtain a first fused feature, and the second structural feature matrix and the second text feature matrix are feature-fused to obtain a second fused feature, which may include:
[0153] The rows with the same sorting position in the second structure matrix and the second text matrix are concatenated to obtain the first fusion feature, and the rows with the same sorting position in the second structure feature matrix and the second text feature matrix are concatenated to obtain the second fusion feature.
[0154] It can be understood that since the key-value pairs represented by the rows with the same sorting position in the second structural feature matrix and the second text feature matrix are of the same type, the rows with the same sorting position in the second structural feature matrix and the second text feature matrix can be spliced to obtain the second fusion feature.
[0155] Exemplarily, if the size of the second structural feature matrix is N×m1, and the size of the second text feature matrix is N×m2, the size of the second fused feature obtained after splicing is N×(m1+m2). It should be noted that when splicing rows with the same sorting position in the second structural feature matrix and the second text feature matrix, the elements in the second structural feature matrix can be in front and the elements in the second text feature matrix can be in the back, or the elements in the second text feature matrix can be in front and the elements in the second structural feature matrix can be in the back, which are all reasonable. By splicing the second structural feature matrix and the second text feature matrix, the features can be fused at the same level, which can make the generative adversarial network converge faster during training.
[0156] S205, input the obtained fused features into the discriminator in the generative adversarial network, and based on the probability output by the discriminator indicating that the input fused features are generated by the generator, and the difference between the labels of the input fused features, adjust the model parameters of the generative adversarial network until the preset convergence conditions are reached.
[0157] It can be understood that the training process of the generative adversarial network is a cross-training process of the generator and the discriminator. When the generator is trained, the model parameters of the discriminator are fixed, and the generator provides incentives for the generator based on the discriminator's discrimination results. That is, the generator is trained first, and before the discriminator model parameters are updated, the generator is trained and optimized based on the discriminator's discrimination results, and the discriminator is trained once after multiple rounds of generator training.
[0158] Since the purpose of generator training is to deceive the discriminator, during the training process of the structural feature generator and the text feature generator, by reducing the difference between the input data and the output data, reinforcement learning is performed in combination with the feedback of the discriminator, the model parameters of the generator are adjusted, and the training is stopped when the difference is small enough. In this embodiment, the model parameters of the generator are adjusted by minimizing the back propagation method of the difference between the probability that the input fusion feature output by the discriminator is generated by the generator and the label of the fusion feature. It can be understood that since the first fusion feature is obtained based on encoding the second interface document, the first fusion feature represents real data, and its corresponding label is 1, and the second fusion feature is obtained based on the feature generated by the generator, so the second fusion feature represents false data, and the label of the second fusion feature is 0.
[0159] During the training process of the discriminator, the model parameters of the generator are fixed. The discriminator can adopt a fully connected neural network architecture, and the input of the discriminator includes generated data (false data) and real data. In this embodiment, the second fused feature is used as the generated data, and the first fused feature is used as the real data, which are input into the discriminator, and the discriminator outputs the probability that the current input data is generated by the generator. The discriminator adjusts the model parameters of the discriminator by back propagation in a way that minimizes the difference between the input data and the corresponding label.
[0160] It is understandable that the training process of the generator and the discriminator are actually two contradictory processes. It is difficult for the generative adversarial network to converge during training. The best state is that the loss values of the generator and the discriminator in the generative adversarial network reach the Nash equilibrium state. At this time, the loss value of the generator may drop to a certain level, and oscillate slightly around a certain value, while the loss value of the discriminator decreases at the beginning. As the generator is optimized, the loss value finally rises to a certain level, and then oscillates slightly around a certain value. Therefore, the preset convergence condition can be that the loss values of the generator and the discriminator reach the Nash equilibrium state, that is, stop training when the output result of the discriminator is close to 0.5.
[0161] For example, a generative adversarial network can be Figure 3As shown, it includes a structural feature generator, a text feature generator and a discriminator. The input sample is the second structural matrix and the second text matrix obtained by encoding the second interface document, wherein the second structural matrix is added with structural noise (corresponding to the first type of noise mentioned above) and then input into the structural feature generator, and the second text matrix is added with text noise (corresponding to the second type of noise mentioned above) and then input into the text feature generator. The outputs of the structural feature generator and the text feature generator are subjected to feature fusion, and the obtained second fused features are used as false samples. The second structural matrix and the second text matrix are subjected to feature fusion as true samples, and the false samples and the true samples are respectively input into the discriminator for discrimination. When the generator is trained, the output result fed back by the discriminator is received for training.
[0162] It can be seen that through this scheme, the generative adversarial network containing dual generators is trained, so that the trained generator can extract the structural features and text features in the interface specifications and interface documents and effectively combine them, so as to use the generator in the trained generative adversarial network to generate test cases, which can improve the quality of the generated test cases.
[0163] Optionally, in another embodiment of the present application, a method for evaluating the security of a zero-trust architecture to which a zero-trust gateway belongs includes:
[0164] Based on the test results of multiple test cases, the probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is calculated using the first preset formula as an evaluation result of the security of the zero trust architecture to which the zero trust gateway belongs; wherein the first preset formula is:
[0165] (q+T×z) / B×100%;
[0166] Among them, the test result of each test case is a first result indicating that the test case is executed successfully, a second result indicating that the test case is executed unsuccessfully, or a third result indicating that the execution of the test case causes the system to crash; q is the number of second results in the test result, z is the number of third results in the test result, T is the preset weight, and B is the number of multiple test cases.
[0167] In this embodiment, the multiple test cases are run on the zero trust gateway to obtain the test results of each test case. Based on the test results of each test case, an evaluation result of the security of the zero trust architecture to which the zero trust gateway belongs is calculated, thereby evaluating the security of the zero trust architecture to which the zero trust gateway belongs.
[0168] It is understandable that the more test results in which the test case execution fails or the test case execution causes the system to crash, the greater the probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements. Therefore, the evaluation result of the security of the zero trust architecture to which the zero trust gateway belongs can be calculated according to the above-mentioned first preset formula. In addition, since the consequences of the system crash caused by the test case execution are more serious, the test result that causes the system crash has a greater impact on the evaluation result, and a greater weight can be set for the third result than the second result, that is, T>1.
[0169] In this implementation, T can be set by relevant technicians based on experience. For example, in one implementation, T can be set to 10.
[0170] It should be noted that the embodiments of the present application do not limit the method of calculating the security evaluation results of the zero trust architecture to which the zero trust gateway belongs based on the test results of each test case. For example, in another implementation method, if the test results include a third result indicating that the execution of the test case causes the system to crash, it can be directly determined that the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements.
[0171] Optionally, in one implementation, the above-mentioned zero-trust evaluation method based on adversarial training may further include:
[0172] If the calculated probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is higher than the preset threshold, a test report is generated based on the test results of each test case; wherein the test report includes: the test cases corresponding to the test results indicating execution failure or system crash in the test results.
[0173] Exemplarily, the preset threshold may be 10%, 20%, etc. It should be noted that in practical applications, the preset threshold may be set by relevant technicians based on experience, and the embodiments of the present application are not limited thereto.
[0174] It is understandable that the more test results in which the test case execution fails or the test case execution causes the system to crash, the greater the probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements. When the probability calculated according to the above-mentioned first preset formula is higher than the preset threshold, the zero trust architecture to which the zero trust gateway belongs can be considered unreliable. At this time, a test report can be output, that is, the test cases that failed to execute and caused the system to crash are exported in the form of a report to assist relevant technical personnel in locating and evaluating problems based on the test report. Among them, the security issues of the zero trust architecture to which the zero trust gateway belongs include: incomplete interface parameter verification, the existence of hidden interfaces, insufficient interface robustness, etc.
[0175] It can be seen that through this solution, since the test cases are generated based on the generative adversarial network, the test process can be fully automated, and fuzzy testing can be achieved based on running test cases, so as to evaluate the implementation and deployment of the zero-trust architecture and help users quickly judge the effectiveness of the zero-trust network. In addition, the test cases are generated by combining the structural features and text features of the interface specifications and interface documents, which greatly improves the quality of the test cases. Compared with only considering text features, the test cases generated by running the zero-trust evaluation method based on adversarial training provided by this solution can more effectively discover the defects of the zero-trust network. Testing with this test case can more effectively evaluate the security of the zero-trust architecture to which the zero-trust gateway belongs.
[0176] Corresponding to the above method embodiment, the present application embodiment also provides a zero-trust evaluation device based on adversarial training, which is applied to a zero-trust gateway, such as Figure 4 As shown, the device comprises:
[0177] The acquisition module 410 is used to acquire an interface document of the interface to be used as a first interface document; wherein the first interface document contains a plurality of key-value pairs;
[0178] The encoding module 420 is used to encode the first interface document based on the interface specification of the registered interface in the zero trust gateway and the preset encoding rules to obtain a first structure matrix and a first text matrix; wherein each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document; each row of the first text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the first interface document; the key-value pair types represented by the rows with the same sorting position in the first structure matrix and the first text matrix are the same;
[0179] The feature generation module 430 is used to add a first type of noise to the first structural matrix, and input the first input matrix obtained after adding the first type of noise into a pre-trained structural feature generator to obtain a first structural feature matrix, and to add a second type of noise to the first text matrix, and input the second input matrix obtained after adding the second type of noise into a pre-trained text feature generator to obtain a first text feature matrix; wherein the structural feature generator and the text feature generator belong to: a generator in a generative adversarial network trained based on a second structural matrix and a second text matrix of an interface document of a sample interface;
[0180] The decoding module 440 is used to decode the first structural feature matrix and the first text feature matrix based on the interface specification and the preset decoding rules corresponding to the preset encoding rules to obtain a test case; wherein the test case is used to evaluate the security of the zero trust architecture to which the zero trust gateway belongs.
[0181] Optionally, the encoding module 420 includes:
[0182] A determination submodule is used to determine a first number of all key-value pair types contained in the interface specification of the registered interface in the zero-trust gateway, and determine a generation rule for generating a structure matrix and a text matrix; wherein the generation rule represents the key-value pair types corresponding to the first number of rows in the structure matrix and the text matrix to be generated;
[0183] A first encoding submodule is used to encode the data type of the value in each key-value pair in the first interface document according to a first preset encoding rule to obtain a first vector representing the data type of the value in each key-value pair, and generate a first structure matrix with the first number of rows according to the generation rule based on each obtained first vector; wherein the element of the row corresponding to any key-value pair in the first interface document in the first structure matrix is the first vector of the key-value pair;
[0184] The second encoding submodule is used to encode the values in each key-value pair in the first interface document according to a second preset encoding rule to obtain a second vector representing the value in each key-value pair, and generate a first text matrix with the first number of rows according to the generation rule based on each obtained second vector; wherein the element of the row corresponding to any key-value pair in the first interface document in the first text matrix is the second vector of the key-value pair.
[0185] Optionally, the decoding module 440 includes:
[0186] A first decoding submodule, configured to decode each row in the first structural feature matrix according to a preset decoding rule corresponding to the first preset encoding rule, to obtain a data type of a value in a key-value pair corresponding to each row;
[0187] A second decoding submodule, configured to decode each line of the first text feature according to a preset decoding rule corresponding to the second preset encoding rule, to obtain a value in a key-value pair corresponding to each line;
[0188] A generation submodule is used to obtain test cases containing each key-value pair obtained by decoding based on the values in each key-value pair obtained by decoding and the data types of the values in the key-value pair, combined with the key-value pair type corresponding to each row represented by the generation rule.
[0189] Optionally, the first preset encoding rule indicates encoding in a one-hot encoding manner; and / or, the second encoding submodule is specifically used to:
[0190] For any key-value pair in the first interface document, if the data type of the value in the key-value pair is a numeric type, the value in the key-value pair is encoded using binary encoding; if the data type of the value in the key-value pair is a Boolean type, the value in the key-value pair is encoded as a vector with the highest two digits being 01 or 10; if the data type of the value in the key-value pair is a string type, the bag-of-words model is used to encode the value in the key-value pair.
[0191] Optionally, the training process of the generative adversarial network includes:
[0192] Obtain an interface document of a sample interface as a second interface document;
[0193] Based on the interface specification of the registered interface in the zero-trust gateway and the preset encoding rules, the second interface document is encoded to obtain a second structure matrix and a second text matrix; wherein each row of the second structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the second interface document; each row of the second text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the second interface document; the rows with the same sorting position in the second structure matrix and the second text matrix represent the same key-value pair type;
[0194] adding the first type of noise to the second structure matrix, and inputting a third input matrix obtained after adding the first type of noise into an initial structure feature generator to obtain a second structure feature matrix, and adding the second type of noise to the second text matrix, and inputting a fourth input matrix obtained after adding the second type of noise into an initial text feature generator to obtain a second text feature matrix;
[0195] Performing feature fusion on the second structure matrix and the second text matrix to obtain a first fusion feature, and performing feature fusion on the second structure feature matrix and the second text feature matrix to obtain a second fusion feature;
[0196] The obtained fused features are input into the discriminator in the generative adversarial network, and based on the probability output by the discriminator indicating that the input fused features are generated by the generator, and the difference between the labels of the input fused features, the model parameters of the generative adversarial network are adjusted until the preset convergence conditions are reached.
[0197] Optionally, the input data dimension and the output data dimension of the structural feature generator are the same, and the input data dimension and the output data dimension of the text feature generator are the same;
[0198] The method further comprises: performing feature fusion on the second structure matrix and the second text matrix to obtain a first fusion feature, and performing feature fusion on the second structure feature matrix and the second text feature matrix to obtain a second fusion feature, including:
[0199] The rows with the same sorting position in the second structure matrix and the second text matrix are concatenated to obtain the first fusion feature, and the rows with the same sorting position in the second structure feature matrix and the second text feature matrix are concatenated to obtain the second fusion feature.
[0200] Optionally, the first type of noise is Gaussian noise and / or covariance noise; the second type of noise is uniform noise and / or exponential noise.
[0201] Optionally, the network layer in the structural feature generator is a convolutional neural network; the network layer in the text feature generator is a recurrent neural network.
[0202] Optionally, a method for evaluating the security of the zero trust architecture to which the zero trust gateway belongs includes:
[0203] Based on the test results of multiple test cases, the probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is calculated using a first preset formula as an evaluation result of the security of the zero trust architecture to which the zero trust gateway belongs; wherein the first preset formula is:
[0204] (q+T×z) / B×100%;
[0205] Among them, the test result of each test case is a first result indicating that the test case is executed successfully, a second result indicating that the test case is executed unsuccessfully, or a third result indicating that the execution of the test case causes the system to crash; q is the number of second results in the test results, z is the number of third results in the test results, T is a preset weight, and B is the number of the multiple test cases.
[0206] Optionally, the method further comprises:
[0207] If the calculated probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is higher than a preset threshold, a test report is generated based on the test results of each test case; wherein the test report includes: the test cases corresponding to the test results in the test results indicating execution failure and system crash.
[0208] In the technical solution of the present application, the operations of obtaining, storing, using, processing, transmitting, providing and disclosing the interface specifications and interface documents involved are all carried out with the user's authorization.
[0209] The present application also provides an electronic device, such as Figure 5 As shown, it includes: a memory 501 for storing computer programs; a processor 502 for implementing any of the steps of the above-mentioned zero-trust evaluation method based on adversarial training when executing the program stored in the memory 501. In addition, the above-mentioned electronic device may also include a communication bus and / or a communication interface, and the processor 502, the communication interface, and the memory 501 communicate with each other through the communication bus.
[0210] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0211] The communication interface is used for communication between the electronic device and other devices. The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor.
[0212] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0213] In another embodiment provided in the present application, a computer-readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned zero-trust evaluation methods based on adversarial training are implemented.
[0214] In another embodiment provided in the present application, a computer program product comprising instructions is also provided. When the computer is run on a computer, the computer executes any one of the zero-trust evaluation methods based on adversarial training in the above embodiments.
[0215] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0216] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0217] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0218] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A zero-trust evaluation method based on adversarial training, characterized in that: Applied to a zero-trust gateway, the method includes: Obtaining an interface document of the interface to be used as a first interface document; wherein the first interface document contains a plurality of key-value pairs; Based on the interface specification of the registered interface in the zero-trust gateway and the preset encoding rules, the first interface document is encoded to obtain a first structure matrix and a first text matrix; wherein each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document; each row of the first text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the first interface document; the key-value pair types represented by the rows with the same sorting position in the first structure matrix and the first text matrix are the same; A first type of noise is added to the first structural matrix, and a first input matrix obtained after adding the first type of noise is input into a pre-trained structural feature generator to obtain a first structural feature matrix, and a second type of noise is added to the first text matrix, and a second input matrix obtained after adding the second type of noise is input into a pre-trained text feature generator to obtain a first text feature matrix; wherein the structural feature generator and the text feature generator belong to: a generator in a generative adversarial network trained based on a second structural matrix and a second text matrix of an interface document of a sample interface; Based on the interface specification and the preset decoding rules corresponding to the preset encoding rules, the first structural feature matrix and the first text feature matrix are decoded to obtain test cases; wherein, the test cases are used to evaluate the security of the zero trust architecture to which the zero trust gateway belongs.
2. The method according to claim 1, characterized in that The encoding of the first interface document based on the interface specification of the registered interface in the zero trust gateway and the preset encoding rule to obtain a first structure matrix and a first text matrix includes: Determine a first number of all key-value pair types contained in the interface specification of the registered interface in the zero-trust gateway, and determine a generation rule for generating a structure matrix and a text matrix; wherein the generation rule represents the key-value pair types corresponding to the first number of rows in the structure matrix and the text matrix to be generated; Encode the data type of the value in each key-value pair in the first interface document according to a first preset encoding rule to obtain a first vector representing the data type of the value in each key-value pair, and generate a first structure matrix having the first number of rows according to the generation rule based on each obtained first vector; wherein the element of the row corresponding to any key-value pair in the first interface document in the first structure matrix is the first vector of the key-value pair; The values in each key-value pair in the first interface document are encoded according to a second preset encoding rule to obtain a second vector representing the value in each key-value pair, and based on the obtained second vectors and according to the generation rule, a first text matrix with the first number of rows is generated; wherein the element of the row corresponding to any key-value pair in the first interface document in the first text matrix is the second vector of the key-value pair.
3. The method according to claim 2, characterized in that Based on the interface specification and the preset decoding rules corresponding to the preset encoding rules, the first structural feature matrix and the first text feature matrix are decoded to obtain test cases, including: according to the preset decoding rules corresponding to the first preset encoding rules, each row in the first structural feature matrix is decoded to obtain the data type of the value in the key-value pair corresponding to each row; according to the preset decoding rules corresponding to the second preset encoding rules, each row in the first text feature matrix is decoded to obtain the value in the key-value pair corresponding to each row; based on the values in each key-value pair obtained by decoding and the data type of the values in the key-value pair, combined with the key-value pair type corresponding to each row represented by the generation rule, a test case containing each key-value pair obtained by decoding is obtained; and / or, The first preset encoding rule indicates encoding according to a one-hot encoding method; and / or, The values in each key-value pair in the first interface document are encoded according to a second preset encoding rule, including: for any key-value pair in the first interface document, if the data type of the value in the key-value pair is a numeric type, the value in the key-value pair is encoded in binary encoding; if the data type of the value in the key-value pair is a Boolean type, the value in the key-value pair is encoded as a vector with the highest two bits being 01 or 10; if the data type of the value in the key-value pair is a string type, a bag-of-words model is used to encode the value in the key-value pair.
4. The method according to any one of claims 1 to 3, characterized in that: The training process of the generative adversarial network includes: Obtain an interface document of a sample interface as a second interface document; Based on the interface specification of the registered interface in the zero-trust gateway and the preset encoding rules, the second interface document is encoded to obtain a second structure matrix and a second text matrix; wherein each row of the second structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the second interface document; each row of the second text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the second interface document; the rows with the same sorting position in the second structure matrix and the second text matrix represent the same key-value pair type; adding the first type of noise to the second structure matrix, and inputting a third input matrix obtained after adding the first type of noise into an initial structure feature generator to obtain a second structure feature matrix, and adding the second type of noise to the second text matrix, and inputting a fourth input matrix obtained after adding the second type of noise into an initial text feature generator to obtain a second text feature matrix; Performing feature fusion on the second structure matrix and the second text matrix to obtain a first fusion feature, and performing feature fusion on the second structure feature matrix and the second text feature matrix to obtain a second fusion feature; The obtained fused features are input into the discriminator in the generative adversarial network, and based on the probability output by the discriminator indicating that the input fused features are generated by the generator, and the difference between the labels of the input fused features, the model parameters of the generative adversarial network are adjusted until the preset convergence conditions are reached.
5. The method according to claim 4, characterized in that The input data dimension and the output data dimension of the structural feature generator are the same, and the input data dimension and the output data dimension of the text feature generator are the same; the second structural matrix and the second text matrix are subjected to feature fusion to obtain a first fused feature, and the second structural feature matrix and the second text feature matrix are subjected to feature fusion to obtain a second fused feature, including: splicing the rows with the same sorting position in the second structural matrix and the second text matrix to obtain the first fused feature, and splicing the rows with the same sorting position in the second structural feature matrix and the second text feature matrix to obtain the second fused feature; and / or, The first type of noise is Gaussian noise and / or covariance noise; the second type of noise is uniform noise and / or exponential noise; and / or, The network layer in the structural feature generator is a convolutional neural network; the network layer in the text feature generator is a recurrent neural network.
6. The method according to claim 1, characterized in that Methods for evaluating the security of the zero trust architecture to which the zero trust gateway belongs include: Based on the test results of multiple test cases, the probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is calculated using a first preset formula as an evaluation result of the security of the zero trust architecture to which the zero trust gateway belongs; wherein the first preset formula is: (q+T×z) / B×100%; Among them, the test result of each test case is a first result indicating that the test case is executed successfully, a second result indicating that the test case is executed unsuccessfully, or a third result indicating that the execution of the test case causes the system to crash; q is the number of second results in the test results, z is the number of third results in the test results, T is a preset weight, and B is the number of the multiple test cases.
7. The method according to claim 6, characterized in that The method further comprises: If the calculated probability that the security of the zero trust architecture to which the zero trust gateway belongs does not meet the security requirements is higher than a preset threshold, a test report is generated based on the test results of each test case; wherein the test report includes: the test cases corresponding to the test results in the test results indicating execution failure and system crash.
8. A zero-trust evaluation device based on adversarial training, characterized in that: Applied to a zero-trust gateway, the device comprises: An acquisition module, used to acquire an interface document of the interface to be used as a first interface document; wherein the first interface document contains a plurality of key-value pairs; An encoding module, used to encode the first interface document based on the interface specification of the registered interface in the zero-trust gateway and the preset encoding rules, to obtain a first structure matrix and a first text matrix; wherein each row of the first structure matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the data type of the value in the key-value pair of the key-value pair type in the first interface document; each row of the first text matrix corresponds to a key-value pair type in the interface specification, and the elements of the row represent the value in the key-value pair of the key-value pair type in the first interface document; the key-value pair types represented by the rows with the same sorting position in the first structure matrix and the first text matrix are the same; A feature generation module is used to add a first type of noise to the first structural matrix, and input the first input matrix obtained after adding the first type of noise into a pre-trained structural feature generator to obtain a first structural feature matrix, and to add a second type of noise to the first text matrix, and input the second input matrix obtained after adding the second type of noise into a pre-trained text feature generator to obtain a first text feature matrix; wherein the structural feature generator and the text feature generator belong to: a generator in a generative adversarial network trained based on a second structural matrix and a second text matrix of an interface document of a sample interface; A decoding module is used to decode the first structural feature matrix and the first text feature matrix based on the interface specification and the preset decoding rules corresponding to the preset encoding rules to obtain a test case; wherein the test case is used to evaluate the security of the zero trust architecture to which the zero trust gateway belongs.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing the method according to any one of claims 1 to 7 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product comprising instructions, characterized in that When the computer program product is executed on a computer, the computer is enabled to implement the method according to any one of claims 1 to 7.
