Source code monitoring method and device, electronic equipment and storage medium

By obtaining and analyzing the unit identification information and core source code of the target unit, and using natural language processing model for feature extraction and comparison, efficient and accurate anti-leakage monitoring of the source code in the code hosting platform is achieved, and the problems of low and inaccurate monitoring in the existing technology are solved.

CN119808071APending Publication Date: 2025-04-11EVERSEC BEIJING TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411864219.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

When the existing technology monitors the source code in the code hosting platform for leak prevention, it is inefficient and inaccurate enough, making it difficult to effectively protect the business secrets and technical information of the enterprise.

Method used

By obtaining the unit identification information and core source code of the target unit, using the natural language processing model to extract features, determine the target feature information, and comparing the entire source code in the public source code library based on these feature information to achieve accurate and convenient leakage prevention monitoring of the source code.

Benefits of technology

Improves the efficiency and accuracy of source code monitoring, reduces the dependence of manual monitoring, reduces the false positive rate, and improves the real-time response capabilities to source code leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119808071A_ABST
    Figure CN119808071A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a source code monitoring method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring unit identification information and a core source code corresponding to a to-be-monitored target unit; performing feature extraction based on the unit identification information, the core source code and a target natural language processing model, and determining target feature information corresponding to the target unit; and determining target source code monitoring information corresponding to the target unit based on the target feature information and a full-amount source code in a public source code library. Through the technical scheme of the embodiment of the invention, leakage-proof monitoring can be accurately and conveniently carried out on full-quantity source codes in the public source code library, so that the source code monitoring efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of information technology, and in particular to a source code monitoring method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of information technology, software source code has become one of the core assets of enterprises. Source code contains the company's trade secrets, technical details and innovative ideas, and its security is crucial to the competitiveness of the company. The leakage of source code may cause the company to lose its market competitive advantage, suffer economic losses, and may even cause security vulnerabilities and be maliciously exploited. In addition, the disclosure of source code may also violate the confidentiality agreement signed with customers or partners, leading to legal risks.

[0003] Currently, the popularity of code hosting platforms, such as GitHub, has made code sharing and collaboration more convenient, but it also increases the risk of source code leakage. Developers may accidentally push sensitive code to public repositories, or private repositories may be made public due to configuration errors. Currently, manual monitoring is usually used to monitor all source code in code hosting platforms for leakage prevention. However, this manual monitoring method is time-consuming and labor-intensive, reduces monitoring efficiency, and cannot guarantee the accuracy of monitoring. Summary of the invention

[0004] Embodiments of the present invention provide a source code monitoring method, device, electronic device and storage medium to accurately and conveniently perform leakage prevention monitoring on the full amount of source code in a public source code library, thereby improving the efficiency and accuracy of source code monitoring.

[0005] In a first aspect, an embodiment of the present invention provides a source code monitoring method, comprising:

[0006] Obtain unit identification information and core source code corresponding to the target unit to be monitored;

[0007] Perform feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine target feature information corresponding to the target unit;

[0008] Based on the target feature information and the full amount of source code in the public source code library, target source code monitoring information corresponding to the target unit is determined.

[0009] Optionally, the method further includes: inputting the unit identification information into a target natural language processing model for feature extraction, and determining target user features corresponding to the target unit; inputting the core source code into a target natural language processing model for feature extraction, and determining target privacy features corresponding to the target unit.

[0010] Optionally, the method further includes: determining candidate source code corresponding to the target unit based on the target user characteristics and the full source code in the public source code library; and determining target source code monitoring information corresponding to the target unit based on the target private characteristics and the candidate source code.

[0011] Optionally, the method further includes: determining candidate source codes corresponding to the target unit based on the target user characteristics and the full source code in the public source code library; determining the target user corresponding to the target unit based on the candidate source codes and source code transmission information in the platform to which the public source code library belongs; and determining target source code monitoring information corresponding to the target unit based on the reference source code corresponding to the target user and the target privacy characteristics.

[0012] Optionally, the method further includes: acquiring historical sample data with pre-labeled tags; iteratively training a preset natural language processing model based on the historical sample data, and stopping the training until a preset convergence condition is met, thereby obtaining a trained target natural language processing model.

[0013] Optionally, the method further includes: if the target source code monitoring information includes a preset monitoring result, generating an alarm message based on the preset monitoring result, and generating and submitting a delisting request message based on the source code corresponding to the preset monitoring result.

[0014] In a second aspect, an embodiment of the present invention further provides a source code monitoring device, the device comprising:

[0015] An information acquisition module, used to obtain unit identification information and core source code corresponding to the target unit to be monitored;

[0016] A target feature information determination module, used to perform feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine the target feature information corresponding to the target unit;

[0017] The target source code monitoring information determination module is used to determine the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library.

[0018] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0019] one or more processors;

[0020] A memory for storing one or more programs;

[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement the source code monitoring method provided by any embodiment of the present invention.

[0022] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a source code monitoring method as provided in any embodiment of the present invention.

[0023] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which, when executed by a processor, implements a source code monitoring method as provided in any embodiment of the present invention.

[0024] The technical solution of the embodiment of the present invention obtains the unit identification information and core source code corresponding to the target unit to be monitored; performs feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine the target feature information corresponding to the target unit, thereby obtaining the target feature information that conforms to the source code writing habits of the target unit and / or has a specific identification; determines the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library, thereby accurately and conveniently performing anti-leakage monitoring on the full source code in the public source code library, thereby improving the efficiency and accuracy of source code monitoring.

[0025] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0027] Figure 1 is a flow chart of a source code monitoring method provided by Embodiment 1 of the present invention;

[0028] Figure 2 is a flow chart of a source code monitoring method provided by Embodiment 2 of the present invention;

[0029] Figure 3 is a flow chart of a source code monitoring method provided by Embodiment 3 of the present invention;

[0030] Figure 4is a schematic diagram of the structure of a source code monitoring device provided by Embodiment 4 of the present invention;

[0031] Figure 5 It is a structural schematic diagram of an electronic device for implementing the source code monitoring method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] Embodiment 1

[0035] Figure 1 A flowchart of a source code monitoring method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of monitoring the leakage prevention of public or shared source code. The method can be executed by a source code monitoring device. The source code monitoring device can be implemented in the form of hardware and / or software. The source code monitoring device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0036] S110: Obtain unit identification information and core source code corresponding to the target unit to be monitored.

[0037] The target unit may refer to a company, enterprise or user cluster that needs to be monitored for source code leakage prevention. Unit identification information may refer to information that is unique to the unit and used to identify the unit. For example, unit identification information may be information unique to the unit, such as the unit name, internal domain name and external domain name. Core source code may refer to source code that cannot be leaked by the target unit. For example, the core source code may contain the target unit's business secrets, technical details and innovative ideas.

[0038] Specifically, the unit identification information and core source code corresponding to the target unit are obtained from the information uploaded autonomously by the target unit to be monitored.

[0039] S120: Perform feature extraction based on the unit identification information, the core source code, and the target natural language processing model to determine target feature information corresponding to the target unit.

[0040] The target natural language processing model may be pre-trained based on a preset natural language processing model. The target feature information may refer to feature information that can characterize the unique characteristics of the target unit. For example, the target feature information may include, but is not limited to, feature information of the target unit's source code writing habits and feature information with a specific identifier of the target unit.

[0041] Specifically, the unit identification information and core source code carrying the data category can be input into the target natural language processing model, and feature extraction of specific categories is performed based on the carried data category to obtain target feature information corresponding to the target unit.

[0042] Based on the above technical solution, "extracting features based on unit identification information, core source code and target natural language processing model to determine the target feature information corresponding to the target unit" may include: inputting the unit identification information into the target natural language processing model for feature extraction to determine the target user features corresponding to the target unit; inputting the core source code into the target natural language processing model for feature extraction to determine the target private features corresponding to the target unit.

[0043] Among them, the target user characteristics may refer to characteristic information unique to users belonging to the target unit. The target user characteristics may be, but are not limited to, the user's habitual characteristics for writing source code and user identity characteristics. For example, the target user characteristics may be the company logo, internal and external domain names, and host names of the target unit. The target privacy characteristics may refer to the identifiers contained in the core source code of the target unit. The target privacy characteristics may be, but are not limited to, pre-set anti-leakage identifiers and specific writing methods of the core source code. For example, the target privacy characteristics may be application names, package names, databases, and VPN connection information. In an embodiment of the present invention, for data that does not carry a data category, the target natural language processing model may first determine its data category, and then perform feature extraction based on the determined specific category.

[0044] Specifically, the unit identification information is input into the target natural language processing model for category recognition and feature extraction to determine the target user features corresponding to the target unit. The core source code is input into the target natural language processing model for category recognition and feature extraction to determine the target privacy features corresponding to the target unit. Traditional methods, such as adding anti-leakage identifiers to the source code, may lead to a high false alarm rate due to misuse or misunderstanding of identifiers. The technical solution of the embodiment of the present invention can reduce the false alarm rate and improve the accuracy of monitoring through machine learning. In addition, adding anti-leakage identifiers to the source code will increase the complexity and cost of code maintenance. Once deployed, the technical solution of the embodiment of the present invention can automatically perform monitoring tasks and reduce long-term operating costs.

[0045] Based on the above technical solution, the training process of the target natural language processing model may include: obtaining historical sample data with pre-labeled tags; iteratively training the preset natural language processing model based on the historical sample data until the preset convergence condition is met, and the training is stopped to obtain a trained target natural language processing model.

[0046] Among them, the label may refer to the accurate feature information corresponding to the pre-labeled data to be extracted. The preset natural language processing model may refer to a natural language processing model that has not been trained. The preset convergence condition may be, but is not limited to, the number of iterations reaching the preset number of iterations, or the accuracy of the model output result reaching the preset threshold. In an embodiment of the present invention, the natural language processing model can be replaced by any general large language model, such as GPT4 or Wenxinyiyan.

[0047] S130: Determine target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library.

[0048] Among them, the public source code repository may refer to a resource library for sharing source code. All source codes in the public source code repository can be viewed and used by other users other than the source code uploader. The public source code repository may be located in a hosting platform. The hosting platform may refer to a hosting platform for open source and private software projects. For example, the hosting platform may be but is not limited to GitHub. The full source code may refer to all source codes in the public source code repository. The target source code monitoring information may refer to the results of source code leakage prevention monitoring for the target unit. The target source code monitoring information may include: source code and the risk level corresponding to each source code.

[0049] Specifically, all source codes in the public source code library are traversed, and the full source codes are compared and screened based on the target feature information, such as credibility comparison, to determine the risk level corresponding to each source code, thereby determining the target source code monitoring information corresponding to the target unit.

[0050] It should be noted that the traditional method is only applicable to a specific code base or organization, while the technical solution of the embodiment of the present invention can be widely applied to different code hosting platforms and environments, and has better versatility.

[0051] The technical solution of the embodiment of the present invention obtains the unit identification information and core source code corresponding to the target unit to be monitored; performs feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine the target feature information corresponding to the target unit, thereby obtaining the target feature information that conforms to the source code writing habits of the target unit and / or has a specific identification; determines the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library, thereby accurately and conveniently performing anti-leakage monitoring on the full source code in the public source code library, thereby improving the efficiency and accuracy of source code monitoring.

[0052] Based on the above technical solution, the method also includes: if the target source code monitoring information includes preset monitoring results, generating alarm information based on the preset monitoring results, and generating and submitting removal request information based on the source code corresponding to the preset monitoring results.

[0053] The preset monitoring result may refer to a high risk level. Other monitoring results may refer to a low risk level. The warning information may include: a high risk level prompt and source code corresponding to the high risk level.

[0054] Specifically, if there are no preset monitoring results in the target source code monitoring information, that is, there is no high risk level, then the source code will continue to be monitored regularly. If the target source code monitoring information includes preset monitoring results, an alarm message is generated based on the preset monitoring results, and a removal request message is generated and submitted based on the source code corresponding to the preset monitoring results. After discovering a core source code leak, traditional methods usually require manual intervention to analyze the source of the leak (such as the leaked user account) and the scope of impact, which is not only time-consuming but also prone to errors. The technical solution of the embodiment of the present invention can realize automated monitoring and early warning, reduce manual participation, and improve response speed.

[0055] It should be noted that the technical solution of the embodiment of the present invention can also be implemented by using an automated monitoring center, an alarm handling center and a source code hosting platform. Specifically, it includes: obtaining the unit identification information and core source code corresponding to the target unit to be monitored in the automated monitoring center; performing feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine the target feature information corresponding to the target unit; determining the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library; if the target source code monitoring information includes a preset monitoring result, a generation disposal event is generated and sent to the alarm handling center. In the alarm handling center, a removal email is automatically sent to the source code monitoring platform through preset processing rules, such as the Digital Millennium Copyright Act (DMAC) processing rules, to request the platform level to remove the relevant source code, and at the same time, the unit security manager is reminded in real time through internal office emails.

[0056] Embodiment 2

[0057] Figure 2 This is a flowchart of a source code monitoring method provided by Embodiment 2 of the present invention. Based on the above embodiments, this embodiment describes in detail the process of determining the target source code monitoring information corresponding to the target unit. The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here. Figure 2 As shown, the method includes:

[0058] S210: Obtain unit identification information and core source code corresponding to the target unit to be monitored.

[0059] S220: Input the unit identification information into the target natural language processing model for feature extraction to determine the target user features corresponding to the target unit.

[0060] S230: Input the core source code into the target natural language processing model for feature extraction, and determine the target private features corresponding to the target unit.

[0061] S240: Determine candidate source codes corresponding to the target unit based on target user characteristics and the full source code in the public source code library.

[0062] The candidate source code may refer to a source code that meets the source code writing habits of users in the target unit.

[0063] Specifically, based on the target user characteristics, the full amount of source code in the public source code library is compared and screened to determine the candidate source code corresponding to the target unit.

[0064] S250: Determine target source code monitoring information corresponding to the target unit based on the target privacy feature and the candidate source code.

[0065] Specifically, the candidate source codes are compared and screened based on the target privacy features to determine the target source code monitoring information corresponding to the target unit.

[0066] The technical solution of the embodiment of the present invention determines the candidate source code corresponding to the target unit based on the target user characteristics and the full source code in the public source code library, thereby first narrowing the source code monitoring scope based on some characteristics; based on the target private characteristics and the candidate source code, the target source code monitoring information corresponding to the target unit is determined, and then the remaining characteristics are used to perform source code monitoring on the source code with a narrowed scope, thereby further improving the efficiency and accuracy of source code monitoring.

[0067] Embodiment 3

[0068] Figure 3 This is a flowchart of a source code monitoring method provided by Embodiment 3 of the present invention. Based on the above embodiments, this embodiment describes in detail the process of determining the target source code monitoring information corresponding to the target unit. The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here. Figure 3 As shown, the method includes:

[0069] S310: Obtain unit identification information and core source code corresponding to the target unit to be monitored.

[0070] S320: Input the unit identification information into the target natural language processing model for feature extraction to determine the target user features corresponding to the target unit.

[0071] S330: Input the core source code into the target natural language processing model for feature extraction, and determine the target private features corresponding to the target unit.

[0072] S340: Determine candidate source codes corresponding to the target unit based on target user characteristics and the full source code in the public source code library.

[0073] S350: Determine a target user corresponding to the target unit based on the candidate source code and source code transmission information in the platform to which the public source code library belongs.

[0074] The source code transmission information may refer to the association between the source code and the uploading user. The target user may refer to the user who uploaded the selected source code. In the embodiment of the present invention, the target user may be a source code writer or source code uploader in the target unit.

[0075] Specifically, based on the candidate source code, the user who uploaded the candidate source code is searched from the source code transmission information in the platform to which the public source code library belongs, and the user is determined as the target user corresponding to the target unit.

[0076] It should be noted that the method of adding anti-leakage identifiers to the source code may make it difficult to track the source of the leak because the identifier is not obvious or is deliberately removed. However, in the embodiment of the present invention, by analyzing multiple features of the source code, such as function naming, comment style, code structure, etc., and comprehensively judging the company's ownership based on the behavior of the code repository manager and other information, the leak source, that is, the target user or target user account, can be identified more accurately.

[0077] S360: Determine target source code monitoring information corresponding to the target unit based on the reference source code corresponding to the target user and the target privacy feature.

[0078] The reference source code may refer to all source codes uploaded by the target user's account in the platform to which the public source code library belongs.

[0079] Specifically, the reference source code corresponding to the target user is compared and screened based on the target privacy feature to determine the target source code monitoring information corresponding to the target unit.

[0080] It should be noted that, in the embodiment of the present invention, the comparison and screening operation can be performed by a pre-trained feature similarity comparison model, and source code with feature similarity or credibility greater than a preset similarity threshold can be screened out and used as source code corresponding to a high risk level.

[0081] Exemplarily, in an embodiment of the present invention, all target source code monitoring information needs to be sent to the unit security officer, thereby achieving regular monitoring of all user accounts of the target unit, i.e., the unit, on the platform and all source codes uploaded by each user account, further improving the target unit's own source code monitoring efficiency and accuracy.

[0082] The technical solution of the embodiment of the present invention determines the candidate source code corresponding to the target unit based on the target user characteristics and the full source code in the public source code library; determines the target user corresponding to the target unit based on the candidate source code and the source code transmission information in the platform to which the public source code library belongs, thereby tracing back all user accounts belonging to the target unit based on the source code containing the source code writing habits of the target unit; determines the target source code monitoring information corresponding to the target unit based on the reference source code corresponding to the target user and the target privacy characteristics, thereby performing source code leakage prevention monitoring on all source codes under all user accounts in the target unit, further improving the efficiency and accuracy of the target unit's own source code monitoring.

[0083] The following is an embodiment of a source code monitoring device provided by an embodiment of the present invention. The device and the source code monitoring methods of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the source code monitoring device, reference can be made to the embodiment of the above source code monitoring method.

[0084] Embodiment 4

[0085] Figure 4 This is a schematic diagram of the structure of a source code monitoring device provided by Embodiment 4 of the present invention. Figure 4 As shown, the device includes: an information acquisition module 410 , a target characteristic information determination module 420 and a target source code monitoring information determination module 430 .

[0086] Among them, the information acquisition module 410 is used to obtain the unit identification information and core source code corresponding to the target unit to be monitored; the target feature information determination module 420 is used to perform feature extraction based on the unit identification information, core source code and target natural language processing model to determine the target feature information corresponding to the target unit; the target source code monitoring information determination module 430 is used to determine the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library.

[0087] The technical solution of the embodiment of the present invention obtains the unit identification information and core source code corresponding to the target unit to be monitored; performs feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine the target feature information corresponding to the target unit, thereby obtaining the target feature information that conforms to the source code writing habits of the target unit and / or has a specific identification; determines the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library, thereby accurately and conveniently performing anti-leakage monitoring on the full source code in the public source code library, thereby improving the efficiency and accuracy of source code monitoring.

[0088] Based on the above technical solution, the target feature information determination module 420 is specifically used to: input the unit identification information into the target natural language processing model for feature extraction, and determine the target user features corresponding to the target unit; input the core source code into the target natural language processing model for feature extraction, and determine the target private features corresponding to the target unit.

[0089] Based on the above technical solution, the target source code monitoring information determination module 430 may include:

[0090] A first candidate source code determination submodule is used to determine the candidate source code corresponding to the target unit based on the target user characteristics and the full source code in the public source code library;

[0091] The first target source code monitoring information determination submodule is used to determine the target source code monitoring information corresponding to the target unit based on the target privacy feature and the candidate source code.

[0092] Based on the above technical solution, the target source code monitoring information determination module 430 may include:

[0093] A second candidate source code determination submodule is used to determine the candidate source code corresponding to the target unit based on the target user characteristics and the full source code in the public source code library;

[0094] A target user determination submodule is used to determine the target user corresponding to the target unit based on the source code transmission information in the platform to which the candidate source code and the public source code library belong;

[0095] The second target source code monitoring information determination submodule is used to determine the target source code monitoring information corresponding to the target unit based on the reference source code corresponding to the target user and the target privacy feature.

[0096] On the basis of the above technical solution, the device further comprises: a training module of a target natural language processing model;

[0097] The training module is specifically used to: obtain historical sample data with pre-labeled tags; iteratively train a preset natural language processing model based on the historical sample data until the training is stopped when the preset convergence conditions are met, and obtain a trained target natural language processing model.

[0098] On the basis of the above technical solution, the device also includes:

[0099] The source code delisting module is used to generate warning information based on the preset monitoring result if the target source code monitoring information includes the preset monitoring result, and generate and submit delisting request information based on the source code corresponding to the preset monitoring result.

[0100] The source code monitoring device provided in the embodiment of the present invention can execute the source code monitoring method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the source code monitoring method.

[0101] It is worth noting that in the above-mentioned source code monitoring embodiment, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0102] Embodiment 5

[0103] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0104] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0105] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0106] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the source code monitoring method.

[0107] In some embodiments, the source code monitoring method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the source code monitoring method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the source code monitoring method in any other appropriate manner (e.g., by means of firmware).

[0108] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0109] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0110] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0111] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0112] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0113] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0114] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the source code monitoring method provided in any embodiment of the present application.

[0115] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, and the programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and also includes a conventional procedural programming language, such as "C" language or similar programming language. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). The program product and the source code monitoring method disclosed in each embodiment of the present application belong to the same inventive concept, so it is not repeated here.

[0116] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0117] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A source code monitoring method, characterized in that: include: Obtain unit identification information and core source code corresponding to the target unit to be monitored; Perform feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine target feature information corresponding to the target unit; Based on the target feature information and the full amount of source code in the public source code library, target source code monitoring information corresponding to the target unit is determined.

2. The method according to claim 1, characterized in that The performing feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine the target feature information corresponding to the target unit includes: Inputting the unit identification information into a target natural language processing model for feature extraction to determine target user features corresponding to the target unit; The core source code is input into a target natural language processing model for feature extraction to determine the target private features corresponding to the target unit.

3. The method according to claim 2, characterized in that The determining the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library includes: Determine candidate source codes corresponding to the target unit based on the target user characteristics and the full amount of source codes in the public source code library; Based on the target privacy feature and the candidate source code, target source code monitoring information corresponding to the target unit is determined.

4. The method according to claim 2, characterized in that: The determining the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library includes: Determine candidate source codes corresponding to the target unit based on the target user characteristics and the full amount of source codes in the public source code library; Determine a target user corresponding to the target unit based on the candidate source code and source code transmission information in the platform to which the public source code library belongs; Based on the reference source code corresponding to the target user and the target privacy feature, target source code monitoring information corresponding to the target unit is determined.

5. The method according to claim 1, characterized in that The training process of the target natural language processing model includes: Get historical sample data with pre-labeled tags; The preset natural language processing model is iteratively trained based on the historical sample data until the training is stopped when a preset convergence condition is met, thereby obtaining a trained target natural language processing model.

6. The method according to claim 1, characterized in that The method further comprises: If the target source code monitoring information includes a preset monitoring result, an alarm message is generated based on the preset monitoring result, and a delisting request message is generated and submitted based on the source code corresponding to the preset monitoring result.

7. A source code monitoring device, characterized in that: The device comprises: An information acquisition module, used to obtain unit identification information and core source code corresponding to the target unit to be monitored; A target feature information determination module, used to perform feature extraction based on the unit identification information, the core source code and the target natural language processing model to determine the target feature information corresponding to the target unit; The target source code monitoring information determination module is used to determine the target source code monitoring information corresponding to the target unit based on the target feature information and the full source code in the public source code library.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the source code monitoring method as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the source code monitoring method as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the source code monitoring method according to any one of claims 1 to 6.