CN114021133A - Code processing method and device, electronic equipment and storage medium - Google Patents

Code processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114021133A
CN114021133A CN202111293276.XA CN202111293276A CN114021133A CN 114021133 A CN114021133 A CN 114021133A CN 202111293276 A CN202111293276 A CN 202111293276A CN 114021133 A CN114021133 A CN 114021133A
Authority
CN
China
Prior art keywords
code
security component
component
program code
security
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111293276.XA
Other languages
Chinese (zh)
Inventor
徐猛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Insurance Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taikang Insurance Group Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN202111293276.XA priority Critical patent/CN114021133A/en
Publication of CN114021133A publication Critical patent/CN114021133A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • G06F21/563Static detection by source code analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • General Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a code processing method, a code processing device, electronic equipment and a storage medium, and relates to the technical field of computers. One embodiment of the method comprises: receiving a code processing request, and acquiring a code identifier in the code processing request so as to inquire a corresponding program code from a code library; calling a preset conversion model to identify a target code statement in a program code, and converting the target code statement into a calling code statement corresponding to a security component; and acquiring the security component from the component library, and integrating the security component with the converted program code to obtain a code file comprising the security component. The implementation method can solve the problem of low efficiency caused by improvement of the security function in the code through a static code security test means.

Description

Code processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a code processing method and apparatus, an electronic device, and a storage medium.
Background
In some scenarios, such as writing input data into a database, it is necessary to ensure the security of the input data in addition to writing the input data into the database, so that in the development of corresponding codes, it is necessary to design a function for ensuring the security of the data in the developed codes in view of security. In the prior art, code development is usually completed, and then a security function in the code is improved by means of static code security testing to ensure the security of input data during code operation, but the efficiency of the method is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a code processing method, an apparatus, an electronic device, and a storage medium, which can solve the problem of low efficiency due to improvement of a security function in a code by a static code security test.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of code processing.
The code processing method of the embodiment of the invention comprises the following steps: receiving a code processing request, acquiring a code identifier in the code processing request, and inquiring a corresponding program code from a code library; calling a preset conversion model to identify a target code statement in the program code, and converting the target code statement into a calling code statement corresponding to the security component; and acquiring a security component from the component library, and integrating the security component with the converted program code to obtain a code file comprising the security component.
In an embodiment, before the invoking the preset conversion model, the method further includes:
identifying a character string in a preset format in the program code;
inquiring a replacement symbol corresponding to the preset format to replace the character string with the replacement symbol;
integrating the security component with the converted program code, comprising:
and replacing the replacing characters in the converted program codes with the character strings, and integrating the replaced program codes with the security component.
In another embodiment, before the invoking the preset conversion model, the method further includes:
collecting a history program code segment, wherein the history program code segment comprises codes before a calling code statement is converted and codes after the calling code statement is converted;
and training a preset machine learning model based on the code segment to obtain the conversion model.
In yet another embodiment, integrating the security component with the converted program code comprises:
acquiring the identifier of the security component to update the identifier of the security component to a configuration file corresponding to the program code;
and obtaining a code file comprising the security component based on the configuration file, the security component and the converted program code combination.
In yet another embodiment, the obtaining security component includes:
inquiring version identification of the security component from a preset knowledge base, and acquiring component identification of the security component of the highest version so as to acquire the security component from the preset component base based on the component identification.
In yet another embodiment, the method further comprises:
receiving an update message of a security component, and acquiring a component identifier of the updated security component and an updated version identifier in the update message;
and storing the component identification of the updated security component and the updated version identification to the knowledge base.
In another embodiment, before the invoking the preset conversion model, the method further includes:
calling a preset code error recognition model, recognizing the program code, and judging whether an error code is included;
if so, sending a prompt message corresponding to the error code to prompt to correct the error code in the program code; if not, calling a preset conversion model.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a code processing apparatus.
A code processing apparatus of an embodiment of the present invention includes: the code processing device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a code processing request, acquiring a code identifier in the code processing request and inquiring a corresponding program code from a code library; the conversion unit is used for calling a preset conversion model so as to identify a target code statement in the program code and convert the target code statement into a calling code statement corresponding to the security component; and the integration unit is used for acquiring the security component from the component library, integrating the security component with the converted program code and obtaining a code file comprising the security component.
In one embodiment, the apparatus further comprises:
the identification unit is used for identifying a character string in a preset format in the program code;
the replacing unit is used for inquiring a replacing symbol corresponding to the preset format so as to replace the character string with the replacing symbol;
the integration unit is specifically configured to replace the replacement symbol in the converted program code with the character string, and integrate the replaced program code with the security component.
In yet another embodiment, the apparatus further comprises:
the system comprises a collecting unit, a judging unit and a judging unit, wherein the collecting unit is used for collecting historical program code segments, and the historical program code segments comprise codes before calling code statements are converted and codes after the calling code statements are converted;
and the training unit is used for training a preset machine learning model based on the code segment to obtain the conversion model.
In another embodiment, the integrated unit is specifically configured to:
acquiring the identifier of the security component to update the identifier of the security component to a configuration file corresponding to the program code;
and obtaining a code file comprising the security component based on the configuration file, the security component and the converted program code combination.
In another embodiment, the integrated unit is specifically configured to:
inquiring version identification of the security component from a preset knowledge base, and acquiring component identification of the security component of the highest version so as to acquire the security component from the preset component base based on the component identification.
In another embodiment, the receiving unit is further configured to receive an update message of the security component, and obtain a component identifier and an updated version identifier of the updated security component in the update message;
the device further comprises:
and storing the component identification of the updated security component and the updated version identification to the knowledge base.
In another embodiment, the identifying unit is further configured to invoke a preset code error identification model, identify the program code, and determine whether an error code is included; if so, sending a prompt message corresponding to the error code to prompt to correct the error code in the program code; if not, calling a preset conversion model.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus.
An electronic device of an embodiment of the present invention includes: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the code processing method provided by the embodiment of the invention.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a computer-readable medium.
A computer-readable medium of an embodiment of the present invention stores thereon a computer program, which, when executed by a processor, implements a code processing method provided by an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: in the embodiment of the invention, after receiving the code processing request, the corresponding program code, namely the code program needing to be processed, can be inquired based on the code identifier in the code processing request; the conversion model is preset, target code statements in the program codes, namely code statements needing to be converted, can be identified by calling the conversion model, and then the target code statements are converted into calling code statements corresponding to the security component, so that the program codes run to the calling code statements when running, and calling of the security component can be realized; after the security component is obtained from the component library, the security component is integrated with the converted program code to obtain a code file including the security component, that is, a code file having a security guarantee for the input data. In the embodiment of the invention, the program code can be converted through the conversion model, and then the security component and the converted program code are integrated to obtain the code file comprising the security component.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a system architecture of a system of code processing according to an embodiment of the invention;
FIG. 2 is a schematic diagram of one primary flow of a method of code processing according to an embodiment of the invention;
FIG. 3 is a schematic diagram of yet another major flow of a method of code processing according to an embodiment of the invention;
FIG. 4 is a schematic diagram of the main elements of an apparatus for code processing according to an embodiment of the present invention;
FIG. 5 is a diagram of yet another exemplary system architecture to which embodiments of the present invention may be applied;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing embodiments of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
Embodiments of the present invention provide a code processing system, which may be used in a scenario in which security of a program code is designed, and in particular, may be used in a scenario in which a security component is integrated with a program code.
In the embodiment of the present invention, as shown in fig. 1, a system architecture diagram of a code processing system in the embodiment of the present invention is shown. The code processing system may include a security component auto-integration system, a code repository, and a security component library. The security component automatic integration system may be used for integrating the security components and the program code, and may include two parts, namely, an integration engine and a knowledge base, wherein the integration engine may perform a function of integrating the security components and the program code, and the knowledge base may store parameters required for integrating the security components and the program code, that is, parameters required for providing the operation of the integration engine, such as version information and component information of the security components, and the like. The code repository may be used to store various codes, such as program code for integrating security components and code files that have integrated security components, and the like. The code warehouse can perform data interaction with the integration engine, so that the integration engine acquires codes of the security components which are not integrated yet from the code warehouse or sends code files of the security components which are integrated already to the code warehouse for storage, and each code in the code warehouse stores an engineering file corresponding to the code, so that the integration engine can acquire the codes from the code warehouse or send the codes to the code warehouse in the form of the engineering file. The security component library is a preset component library, wherein each version of security component can be stored, and the security component can perform data interaction with the integration engine, so that the integration engine can acquire the security component from the security component library.
It should be noted that, in the embodiment of the present invention, the code processing system may run on a general hardware platform such as x86, and the integration engine may store in advance APIs corresponding to the code repository and the security component library, and further implement data interaction with the code repository and the security component library by calling the corresponding APIs. Specifically, the integration engine may obtain the code engineering file from the code repository through a tool such as Git, so as to obtain the program code to be processed.
An embodiment of the present invention provides a code processing method, which may be performed by the security component automatic integration system shown in fig. 1, and as shown in fig. 2, the method includes:
s201: and receiving a code processing request, and acquiring a code identifier in the code processing request so as to inquire the corresponding program code from a code library.
The code processing request is triggered when the code needs to be integrated by a security component, and can be triggered manually or automatically by an operating environment. After receiving the code processing request, the code processing request may be responded to obtain the code identifier in the code processing request. The code identification represents program code that requires security component integration, so the integration engine can query the code repository for the corresponding program code based on the code identification, i.e., read the code from the code repository to identify the corresponding program code. Specifically, the integration engine may query a corresponding code engineering file from the code repository based on the code identifier, and may further obtain the program code from the code engineering file, where the following code is a part of the program code in the code engineering file.
Figure BDA0003335675670000071
S202: and calling a preset conversion model to identify a target code statement in the program code and convert the target code statement into a calling code statement corresponding to the security component.
The conversion model is preset and can be used for converting codes in the program codes. In the embodiment of the invention, the security component and the program code are integrated, so that the security component can be directly called to perform security detection on input data in the running process of the integrated code file, thereby ensuring the security of the input data. In order to realize that the security component can be directly called in the running process of the code file, some codes in the program code need to be rewritten, namely, the original code statement (object code statement) is converted into the calling code statement called by the security component at the position in the program code where the security component needs to be called. When the converted program code runs, the calling of the security component can be automatically triggered when the converted calling code statement is executed. Therefore, in this step, the target code statement in the program code, that is, the code statement to be converted, may be recognized first through the conversion model, and the target code statement is further converted into the calling code statement corresponding to the security component.
It should be noted that, in the embodiment of the present invention, the conversion model may adopt a machine learning model, for example, a tensrflow (symbolic mathematical system based on data flow programming) machine learning platform Transformer model. Before the step, historical program code segments can be collected in advance, wherein the historical program code segments comprise codes before the code statements are converted and codes after the code statements are converted, namely target code statements are converted into codes before the code statements are called and program codes after the target code statements are converted into the code statements; and training a preset machine learning model based on the code segments to obtain the conversion model. Specifically, a code (source) after the call code statement is converted and a code (target) before the call code statement is converted may be input into a preset machine learning model for training, so that the machine learning model learns the mapping relationship between the source and the target, thereby implementing the conversion of the program code. In the embodiment of the invention, if the code segments used for model training are not enough to support model training, the code conversion rules between the target code statements in the program codes and the calling code statements corresponding to the security components can be extracted to generate the conversion models corresponding to the code conversion rules.
In the embodiment of the invention, after the program code is developed, errors may exist in the program code, and in order to avoid that the errors affect the accuracy of code conversion in the step, the program code may be subjected to error recognition before the step is executed. Specifically, the following may be implemented: calling a preset code error recognition model to recognize the program code to obtain an error code in the program code; and sending a prompt message of the error code to prompt the error code in the correcting program code.
The code error recognition model can be pre-trained, and particularly can be an LSTM model. After the error codes in the program codes are identified, a prompt message corresponding to the error codes can be sent to prompt developers and the like to correct the program codes in time, namely prompt the developers to correct the error codes in the program codes.
S203: and acquiring the security component from the component library, and integrating the security component with the converted program code to obtain a code file comprising the security component.
The integration engine may acquire the security component from a component library (security component library), for example, may acquire a Jar package of the security component, and then integrate the security component with the converted program code.
In the embodiment of the present invention, the program code generally includes character strings in various formats, such as variable names, etc., and since these character strings may be defined by developers, there is a possibility that they may interfere with the recognition of the target code statements by the conversion model, so before step S202 is executed, these character strings that may interfere with each other may be replaced with preset replacement characters, and after this step is executed, these character strings are replaced back, and then integrated with the security component. Specifically, before step S202, the following steps may be performed: identifying a character string in a preset format in a program code; inquiring a replacement symbol corresponding to a preset format to replace the character string with the replacement symbol; the integration operation in step S203 may be specifically performed as: and replacing the replacing characters in the converted program codes with character strings, and integrating the replaced program codes with the security component.
The format of the character string to be replaced may be preset, and specifically, the format of the character string to be replaced may be set based on the format of each character string included in the program code. The replacement character can also be set based on requirements, conversion of calling code statements is not affected under normal conditions, and different replacement characters need to be set for different character strings, so that confusion of the replaced character strings is avoided, and errors of program codes are caused. Taking the code in step S201 as an example, the replaced code may be as follows, in which the variable name and the character string are replaced by the preset number: and $ v0, $ v1, $ v2, $ s 0.
Figure BDA0003335675670000091
On the basis of the replaced program code, step S202 may be executed, and then the converted code is obtained as shown below, wherein the target code statement is converted into a calling code statement of the security component, and "ESAPI" represents the identifier of the security component.
Figure BDA0003335675670000092
For the converted program code, the substitute symbol may be replaced with the variable name in the program code of step S201, and the result after replacement may be as follows.
Figure BDA0003335675670000093
Figure BDA0003335675670000101
It should be noted that, integrating the security component and the converted program code in this step may include adding the security component to a code engineering file of the program code, and updating a configuration file corresponding to the program code. Specifically, the following may be implemented: acquiring the identifier of the security component to update the identifier of the security component to a configuration file corresponding to the program code; based on the configuration file, the security component, and the converted program code, a code file is derived that includes the security component. Combining the updated configuration file, the security component, and the converted program code may be performed to update the updated configuration file, the security component, and the converted program code all into the engineering file of the program code, so as to obtain a code file including the security component. After the code file is obtained in this step, the code file can be sent to a code warehouse for storage.
In the embodiment of the present invention, the knowledge base stores versions and component identifiers of security components, and in order to improve security functions in a program code, in this step, a security component with the highest version is usually selected to be integrated into a code file, so that obtaining security components in this step may be specifically executed as: and inquiring the version identification of the security component from a preset knowledge base, and acquiring the component identification of the security component of the highest version so as to acquire the security component from the preset component base based on the component identification.
The version identification of each safety component can be inquired from the knowledge base, then the safety components of the highest version can be screened out, then the component identification of the safety component of the highest version can be obtained, and the corresponding safety component can be obtained from the component base after the component identification is obtained.
It should be noted that, in the embodiment of the present invention, when the version of the security component is updated, the knowledge base needs to be updated in time, so that the integration engine may query the security component with the highest version. Specifically, the following may be implemented: receiving an updating message of the security component, and acquiring a component identifier of the updated security component and an updated version identifier in the updating message; and storing the component identification of the updated security component and the updated version identification to a knowledge base. The updated component identification of the security component and the updated version identification of the security component may be included in the update message and then stored in the knowledge base for subsequent use.
In the embodiment of the invention, after receiving the code processing request, the corresponding program code, namely the code program needing to be processed, can be inquired based on the code identifier in the code processing request; the conversion model is preset, target code statements in the program codes, namely code statements needing to be converted, can be identified by calling the conversion model, and then the target code statements are converted into calling code statements corresponding to the security component, so that the program codes run to the calling code statements when running, and calling of the security component can be realized; after the security component is obtained from the component library, the security component is integrated with the converted program code to obtain a code file including the security component, that is, a code file having a security guarantee for the input data. In the embodiment of the invention, the program code can be converted through the conversion model, and then the security component and the converted program code are integrated to obtain the code file comprising the security component.
The following describes a code processing method in the embodiment of the present invention in detail with reference to the system architecture shown in fig. 1 and the embodiment shown in fig. 2, and as shown in fig. 3, the method includes:
s301: and receiving a code processing request, and acquiring a code identifier in the code processing request so as to inquire the corresponding program code from a code library.
S302: identifying a character string in a preset format in a program code; and querying a replacement character corresponding to the preset format to replace the character string with the replacement character.
S303: and calling a preset conversion model to identify a target code statement in the program code and convert the target code statement into a calling code statement corresponding to the security component.
S304: and inquiring the version identification of the security component from a preset knowledge base, and acquiring the component identification of the security component of the highest version so as to acquire the security component from the preset component base based on the component identification.
S305: updating the identification of the security component to a configuration file corresponding to the program code; based on the configuration file, the security component, and the converted program code, a code file is derived that includes the security component.
S306: and sending the code file to a code warehouse.
It should be noted that the data processing principle in the embodiment of the present invention is the same as the data processing principle in the embodiment shown in fig. 2, and is not described herein again.
In the embodiment of the invention, the program code can be converted through the conversion model, and then the security component and the converted program code are integrated to obtain the code file comprising the security component.
In order to solve the problems in the prior art, an embodiment of the present invention provides a code processing apparatus 400, as shown in fig. 4, where the apparatus 400 includes:
a receiving unit 401, configured to receive a code processing request, acquire a code identifier in the code processing request, so as to query a corresponding program code from a code library;
a conversion unit 402, configured to invoke a preset conversion model to identify a target code statement in the program code, and convert the target code statement into a calling code statement corresponding to the security component;
an integrating unit 403, configured to obtain a security component from the component library, integrate the security component with the converted program code, and obtain a code file including the security component.
It should be understood that the manner of implementing the embodiment of the present invention is the same as the manner of implementing the embodiment shown in fig. 2, and the description thereof is omitted.
In an implementation manner of the embodiment of the present invention, the apparatus 400 further includes:
the identification unit is used for identifying a character string in a preset format in the program code;
the replacing unit is used for inquiring a replacing symbol corresponding to the preset format so as to replace the character string with the replacing symbol;
the integration unit is specifically configured to replace the replacement symbol in the converted program code with the character string, and integrate the replaced program code with the security component.
In another implementation manner of the embodiment of the present invention, the apparatus 400 further includes:
the system comprises a collecting unit, a judging unit and a judging unit, wherein the collecting unit is used for collecting historical program code segments, and the historical program code segments comprise codes before calling code statements are converted and codes after the calling code statements are converted;
and the training unit is used for training a preset machine learning model based on the code segment to obtain the conversion model.
In another implementation manner of the embodiment of the present invention, the integration unit 402 is specifically configured to:
acquiring the identifier of the security component to update the identifier of the security component to a configuration file corresponding to the program code;
and obtaining a code file comprising the security component based on the configuration file, the security component and the converted program code combination.
In another implementation manner of the embodiment of the present invention, the integration unit 402 is specifically configured to:
inquiring version identification of the security component from a preset knowledge base, and acquiring component identification of the security component of the highest version so as to acquire the security component from the preset component base based on the component identification.
In another implementation manner of the embodiment of the present invention, the receiving unit 401 is further configured to receive an update message of a security component, and obtain a component identifier and an updated version identifier of the updated security component in the update message;
the apparatus 400 further comprises:
and storing the component identification of the updated security component and the updated version identification to the knowledge base.
In another implementation manner of the embodiment of the present invention, the identification unit is further configured to call a preset code error identification model, and identify the program code to determine whether an error code is included; if so, sending a prompt message corresponding to the error code to prompt to correct the error code in the program code; if not, calling a preset conversion model.
It should be understood that the embodiment of the present invention is implemented in the same manner as the embodiment shown in fig. 2 or fig. 3, and is not repeated herein.
In the embodiment of the invention, the program code can be converted through the conversion model, and then the security component and the converted program code are integrated to obtain the code file comprising the security component.
According to an embodiment of the present invention, an electronic device and a readable storage medium are also provided.
The electronic device of the embodiment of the invention comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the processor, and the instructions are executed by the at least one processor to cause the at least one processor to execute the code processing method provided by the embodiment of the invention.
Fig. 5 illustrates an exemplary system architecture 500 to which a code processing method or code processing apparatus of an embodiment of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. Various client applications may be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 may be, but are not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server that provides various services, and may analyze and process data such as a received code processing request and feed back a processing result (e.g., a code file, for example only) to the terminal device.
It should be noted that the code processing method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the code processing apparatus is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use in implementing embodiments of the present invention is shown. The computer system illustrated in FIG. 6 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a unit, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit, a converting unit, and an integrating unit. The names of these units do not in some cases constitute a limitation to the unit itself, and for example, a receiving unit may also be described as a "unit that processes a request receiving function of a code".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform the code processing methods provided by the present invention.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A code processing method, comprising:
receiving a code processing request, acquiring a code identifier in the code processing request, and inquiring a corresponding program code from a code library;
calling a preset conversion model to identify a target code statement in the program code, and converting the target code statement into a calling code statement corresponding to the security component;
and acquiring a security component from the component library, and integrating the security component with the converted program code to obtain a code file comprising the security component.
2. The method of claim 1, wherein before the invoking the predetermined transformation model, further comprising:
identifying a character string in a preset format in the program code;
inquiring a replacement symbol corresponding to the preset format to replace the character string with the replacement symbol;
integrating the security component with the converted program code, comprising:
and replacing the replacing characters in the converted program codes with the character strings, and integrating the replaced program codes with the security component.
3. The method of claim 1, wherein integrating the security component with the transformed program code comprises:
acquiring the identifier of the security component to update the identifier of the security component to a configuration file corresponding to the program code;
and obtaining a code file comprising the security component based on the configuration file, the security component and the converted program code combination.
4. The method of claim 1, wherein before the invoking the predetermined transformation model, further comprising:
collecting a history program code section including a code before converting the calling code statement and a code after converting the calling code statement;
and training a preset machine learning model based on the historical program code segment to obtain the conversion model.
5. The method of claim 1, wherein the obtaining the security component comprises:
inquiring version identification of the security component from a preset knowledge base, and acquiring component identification of the security component of the highest version so as to acquire the security component from the preset component base based on the component identification.
6. The method of claim 5, further comprising:
receiving an update message of a security component, and acquiring a component identifier of the updated security component and an updated version identifier in the update message;
and storing the component identification of the updated security component and the updated version identification to the knowledge base.
7. The method of claim 1, wherein before the invoking the predetermined transformation model, further comprising:
calling a preset code error recognition model, recognizing the program code, and judging whether an error code is included;
if so, sending a prompt message corresponding to the error code to prompt to correct the error code in the program code; if not, calling a preset conversion model.
8. A code processing apparatus, comprising:
the code processing device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a code processing request, acquiring a code identifier in the code processing request and inquiring a corresponding program code from a code library;
the conversion unit is used for calling a preset conversion model so as to identify a target code statement in the program code and convert the target code statement into a calling code statement corresponding to the security component;
and the integration unit is used for acquiring the security component from the component library, integrating the security component with the converted program code and obtaining a code file comprising the security component.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202111293276.XA 2021-11-03 2021-11-03 Code processing method and device, electronic equipment and storage medium Pending CN114021133A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111293276.XA CN114021133A (en) 2021-11-03 2021-11-03 Code processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111293276.XA CN114021133A (en) 2021-11-03 2021-11-03 Code processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114021133A true CN114021133A (en) 2022-02-08

Family

ID=80059957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111293276.XA Pending CN114021133A (en) 2021-11-03 2021-11-03 Code processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114021133A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114625440A (en) * 2022-03-10 2022-06-14 中国建设银行股份有限公司 Model data processing method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114625440A (en) * 2022-03-10 2022-06-14 中国建设银行股份有限公司 Model data processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11237844B2 (en) Method and apparatus for loading kernel module
CN109359194B (en) Method and apparatus for predicting information categories
CN112559354A (en) Front-end code specification detection method and device, computer equipment and storage medium
CN107643984B (en) Method and apparatus for outputting information
CN106055375B (en) Application program installation method and device
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN113268245A (en) Code analysis method, device and storage medium
CN114021133A (en) Code processing method and device, electronic equipment and storage medium
US20190073198A1 (en) Multi-flavored software execution from a singular code base
CN115951916A (en) Component processing method and device, electronic equipment and storage medium
CN110795259A (en) Method and device for analyzing application collapse
CN113656050B (en) Method and apparatus for generating version number
CN114625373A (en) Application conversion method and device, electronic equipment and storage medium
CN115514632A (en) Resource template arranging method, device and equipment for cloud service and storage medium
US11030087B2 (en) Systems and methods for automated invocation of accessibility validations in accessibility scripts
CN109298831B (en) Information storage method and device
CN114492324A (en) Component data statistical method and device
CN113918525A (en) Data exchange scheduling method, system, electronic device, medium, and program product
CN114416895A (en) Map data processing method and device, electronic equipment and storage medium
CN113312900A (en) Data verification method and device
CN111538651A (en) Interface testing method, device, server and storage medium
CN114253595A (en) Code warehouse management method and device, computer equipment and storage medium
CN109918895B (en) Method, electronic device, and computer-readable medium for outputting data
CN113590483A (en) Case operation method and device
US10067758B1 (en) Systems and methods for improved workflow processing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination