Code behavior prediction method and device
Using big models and big data technology to analyze users' historical code behavior and predict future behavioral characteristics solves the limitations of traditional methods in code security and behavior prediction, realizes automated and preventive code security management, and improves security and efficiency. .
Patent Information
- Application Number
- CN202410466319.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2024-08-30
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional code security detection tools are difficult to identify new threats and complex security issues, and enterprises rely on manual operations and reactive processing in terms of code security and behavior prediction, lacking automation and preventive measures, resulting in high resource consumption and difficulty in comprehensive data collection and analysis. ,precise.
Using code behavior prediction methods based on big models and big data, we obtain user historical code behavior data, perform preprocessing and analysis, extract behavioral characteristics, predict future behavioral characteristics, and determine decision-making plans based on this, including resource allocation, permission management, and Risk warning.
Improved code security and business efficiency, identified potential risks through automated analysis and prediction, and achieved rapid and timely risk intervention and resource optimization.
Smart Images

Figure CN118567972A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and device for predicting code behavior. Background Art
[0002] With the development of Internet technology and the growth of business, enterprise code security issues are becoming more and more important. However, there are shortcomings or deficiencies in current enterprise code security and behavior prediction. For example, traditional code security detection tools can often only identify known security vulnerabilities and common code quality issues and simple user behaviors that endanger code security. They may not be able to effectively detect new threats and complex security issues.
[0003] Many companies still use manual and reactive methods in code security and behavior prediction, lacking automation and preventive measures. Data collection and analysis on user behavior and code security requires a lot of manpower and resources, and it is often difficult to achieve comprehensive and accurate data collection and analysis.
[0004] These problems reflect the limitations and shortcomings of traditional methods in code security and behavior prediction, and require enterprises to take more comprehensive, automated and preventive measures to address them.
[0005] With the development of artificial intelligence technology, technologies such as big models and big data are becoming more and more important, and are playing an increasingly important role in all walks of life. Therefore, a code processing method based on artificial intelligence technology is needed. Summary of the invention
[0006] Based on this, it is necessary to provide a method and device based on big models, big data and other technologies to quickly and timely detect enterprise code security in response to the above technical problems.
[0007] A code behavior prediction method, the method comprising:
[0008] Acquire historical code behavior data of the user, and preprocess the historical code behavior data;
[0009] Based on the big model, the pre-processed historical code behavior data of the user is analyzed to obtain the historical code behavior characteristics of the user;
[0010] Future code behavior characteristics are predicted based on the user's historical code behavior characteristics, and a decision plan is determined based on the future code behavior characteristics.
[0011] In some embodiments, the user's historical code behavior data includes the user's historical login data; the user's historical code behavior features include the user's login activity features and login mode features;
[0012] The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes:
[0013] Analyze the user's historical login data based on the big model to obtain the user's login activity characteristics and login mode characteristics;
[0014] Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including:
[0015] Predicting the user's future login time and future login mode based on the user's login activity characteristics and login mode characteristics;
[0016] Based on the predicted future login time and future login pattern of the user, corresponding resources are allocated or recommended to the user.
[0017] In some embodiments, the historical code behavior data includes historical code submission data of the user, and the historical code behavior characteristics of the user include the user's code submission frequency characteristics, code type characteristics, and code quality characteristics;
[0018] The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes:
[0019] Analyze the user's historical code submission data based on the big model to obtain the user's code submission frequency characteristics, code type characteristics, and code quality characteristics;
[0020] Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including:
[0021] Based on the user's code submission frequency characteristics, code type characteristics, and code quality characteristics, obtaining the user's future contribution value to the code base;
[0022] Allocate and optimize resources based on the user's future contribution to the code base.
[0023] In some embodiments, the historical code behavior data includes historical file access data of the user, and the historical code behavior characteristics of the user include the user's access file path characteristics, access frequency characteristics, and access permission characteristics;
[0024] The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes:
[0025] Analyze the user's historical code submission data based on the big model to obtain the user's historical access file path characteristics, access frequency characteristics, and access permission characteristics;
[0026] Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including:
[0027] Based on the file access path characteristics, access frequency characteristics and access permission characteristics of the user's history, the user's future needs and concerns for code files are obtained;
[0028] Based on the user's needs and concerns about code files, corresponding resources or permissions are allocated or recommended to the user.
[0029] In some embodiments, the historical code behavior data includes historical permission operation data of the user, and the historical code behavior characteristics of the user include the permission adding operation characteristics, deleting operation characteristics and modifying operation characteristics of the user;
[0030] The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes:
[0031] Analyze the user's historical code submission data based on the big model to obtain the user's historical permission addition operation characteristics, deletion operation characteristics, and modification operation characteristics;
[0032] Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including:
[0033] Based on the user's historical permission adding operation features, deleting operation features, and modifying operation features, predict the user's future permission adjustment needs and permission operation risks;
[0034] Based on the predicted future needs of users for permission adjustment and existing permission operation risks, corresponding permission management controls are allocated or adjusted for users.
[0035] In some embodiments, the historical code behavior data includes the user's historical project participation data, and the user's historical code behavior characteristics include the user's project quantity characteristics and the activity characteristics of the project participation;
[0036] The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes:
[0037] Analyze the user's historical code submission data based on the big model to obtain the user's historical project quantity characteristics and the activity characteristics of participating projects;
[0038] Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including:
[0039] Predict the user's future project participation and contribution based on the number of projects the user has participated in and the activity characteristics of the projects they have participated in.
[0040] Based on the predicted future project participation characteristics of users, the project contribution is estimated and the user's work attitude and teamwork ability are evaluated.
[0041] In some embodiments, the historical code behavior data includes historical abnormal behavior data of the user, and the historical code behavior characteristics of the user include historical abnormal login characteristics, abnormal submission characteristics, and abnormal file access data characteristics of the user;
[0042] The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes:
[0043] Analyze the user's historical code submission data based on the big model to obtain the user's historical abnormal login features, abnormal submission features, and abnormal file access data features;
[0044] Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including:
[0045] Predict future abnormal behaviors of users based on their historical abnormal login features, abnormal submission features, and abnormal file access data features;
[0046] Based on the predicted future abnormal behavior of users, formulate corresponding abnormal behavior response strategies.
[0047] In some embodiments, the method further comprises:
[0048] Obtain log data and / or interaction data generated by interacting with large models;
[0049] Performing behavior action risk identification based on the log data and / or interaction data;
[0050] In response to the identification of risks, risk warnings are issued.
[0051] In some embodiments, the method further includes: performing data preprocessing on the code behavior data of the user, wherein the data preprocessing includes extracting features and converting features on the historical code behavior data to obtain a data format for input into a large model;
[0052] The large model includes a Transformer model, and the training method of the Transformer model includes: freezing at least part of the Transformer layer parameters and adjusting the output layer parameters to perform model training optimization.
[0053] A code behavior prediction device, comprising:
[0054] A code hosting platform, used to receive the user's code operation behavior, wherein the user's historical code behavior data is determined based on the user's code operation behavior;
[0055] A behavior prediction agent monitors the code operation behavior of users in the code hosting platform in real time based on a large model, and predicts the user's future code operation behavior, wherein the user's future code behavior characteristics are determined based on the user's future code operation behavior;
[0056] Compliance and security agent, which monitors the code change behavior in the code hosting platform in real time based on a large model and predicts potential risk issues;
[0057] The warning and processing module is used to receive the user's code operation behavior predicted by the behavior prediction agent and the potential risk issues predicted by the compliance and security agent, and to warn and respond to the risks. The decision-making plan includes warning and responding to the risks.
[0058] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned code behavior prediction method when executing the computer program.
[0059] A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned code behavior prediction method when executed by a processor.
[0060] The above solution can automatically analyze user behavior characteristics through a large model, and predict the user's possible future behavior characteristics and potential risks, greatly improving business efficiency and security. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A schematic diagram of a flow chart of a code behavior prediction method provided in one embodiment;
[0062] Figure 2 A schematic diagram of a code behavior prediction device provided in one embodiment;
[0063] Figure 3 A structural block diagram of a code behavior prediction device provided in one embodiment;
[0064] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0066] In one embodiment, Figure 1 As shown, a code behavior prediction method is provided, comprising the following steps:
[0067] Step 101, obtaining historical code behavior data of a user, and preprocessing the historical code behavior data.
[0068] For example, data is first collected and preprocessed. Data collection includes collecting historical code behavior data of users in the code hosting platform. The historical code behavior data includes, but is not limited to: historical code submission records, file access records, permission change records, etc. More specifically, historical code submission records include submitted code content, submission timestamp, submitter's identity information, etc. File access records may include file paths, access times, access permissions, etc. accessed by users. Permission change records may include user permission modification records for projects or code libraries, such as adding or deleting user access permissions, etc.
[0069] In some embodiments, the collected historical code data may be obtained through an API provided by a code hosting platform, or through log files, database queries, and the like.
[0070] In some embodiments, the acquired historical code behavior data is also cleaned and processed. The collected raw data is cleaned and preprocessed to ensure the quality and availability of the data.
[0071] Among them, the data cleaning operations include but are not limited to missing value processing, data deduplication, and outlier processing. Specifically, missing value processing includes detecting and processing missing values in the data, such as filling missing timestamps, deleting missing records, etc. Data deduplication processing includes detecting and deleting duplicate records to ensure the uniqueness of the data. Outlier processing includes detecting and processing outliers, such as timestamps outside the normal range, abnormal behavior records, etc.
[0072] Among them, the operations of data preprocessing include but are not limited to feature extraction, feature conversion, and data segmentation and partitioning. Among them, feature extraction includes extracting meaningful features from the original data, such as extracting the number of submitted code lines, file paths and other features from the code submission records. Feature conversion includes converting the extracted features into a format that can be used by machine learning algorithms, such as encoding, standardizing or normalizing categorical features. Data segmentation and partitioning includes segmenting the preprocessed data according to time series, dividing it into training sets, validation sets and test sets. The training set is used for model training, the validation set is used for model parameter tuning and performance evaluation, and the test set is used to evaluate the generalization ability and effect of the model.
[0073] In some embodiments, the method further includes data storage and management, storing the preprocessed data in an appropriate storage medium, such as a database, a file system, etc. Data management and maintenance include data backup, version control, and authority management.
[0074] Step 102: Analyze the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user.
[0075] Among them, the large model can be a pre-trained model that can be used to identify and analyze historical code behavior data.
[0076] The historical code behavior features can be used to characterize the historical code behavior characteristics of the user, for example, the user's historical code login behavior, code operation behavior, and code activity behavior, etc. By obtaining the user's historical code behavior features, the user's historical behavior characteristics can be known, and then resources can be further allocated, such as matching the corresponding permissions for the user or allocating corresponding resources based on the user's behavior personalization.
[0077] In some embodiments, the user's code behavior characteristics may include historical code behavior characteristics used to characterize the user's historical behavior characteristics, the user's future code behavior characteristics used to predict the user's possible future behavior, and potential code behavior risks obtained based on the user's historical behavior analysis. In this way, through the big data processing capabilities and powerful analysis capabilities of the big model, the code behavior characteristics of each user can be quickly and accurately extracted, and possible future behavior characteristics can be predicted, as well as potential risks can be identified, and risk intervention can be carried out in a timely manner to improve code security.
[0078] In some embodiments, the large model may include a Transformer model, and the training method of the Transformer model includes: freezing at least part of the Transformer layer parameters, and adjusting the output layer parameters to perform model training optimization.
[0079] In some embodiments, the fine-tuning training and optimization steps of the large model include first loading a pre-trained Transformer model. Select a pre-trained open source Transformer model, which is usually pre-trained on a large-scale corpus and has good language understanding and representation learning capabilities. Load the pre-trained model parameters, and you can use an existing pre-trained model library or obtain the model parameters from the author of the pre-trained model. Furthermore, define the fine-tuning task. Determine the specific tasks to be fine-tuned on the Transformer model, behavior prediction, and safety compliance analysis. According to the characteristics of the task and the situation of the data set, adjust the output layer structure and loss function of the model to meet the needs of the task. Then fine-tune the model. Input the cleaned fine-tuning data set into the loaded pre-trained Transformer model for fine-tuning training. During the fine-tuning process, some or all of the Transformer layer parameters can be frozen, and only the output layer parameters can be fine-tuned to reduce the amount of calculation and memory consumption during the fine-tuning process. Then parameter tuning is also required. By evaluating the model on the validation set, adjust the hyperparameters in the fine-tuning process, such as the learning rate, batch size, and the freezing strategy of the fine-tuning layer. Different optimizers (such as Adam, SGD, etc.) and learning rate schedulers (such as learning rate decay) can be used to improve fine-tuning performance. Then perform model evaluation and verification. Use the fine-tuned model to evaluate on the validation set to evaluate the performance and generalization ability of the model. According to the evaluation results on the validation set, adjust the model and hyperparameters to further improve the model performance. Finally, save and deploy the model. After the fine-tuning training is completed, save the fine-tuned model parameters for subsequent application and deployment. Deploy the fine-tuned model to the production environment to achieve real-time behavior prediction and security protection.
[0080] In some embodiments, the user's historical code behavior data includes the user's historical login data; the user's historical code behavior characteristics include the user's login activity and login mode;
[0081] The method of analyzing the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: analyzing the historical login data of the user based on the big model to obtain the login activity characteristics and login mode characteristics of the user;
[0082] Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including: predicting the user's future login time and future login mode based on the user's login activity characteristics and login mode characteristics; allocating or recommending corresponding resources to the user based on the predicted future login time and future login mode of the user.
[0083] In some embodiments, the user's historical code behavior data includes: the user's historical login data. The user's historical code behavior features include: the user's login activity features and the user's login mode features. The user's future code behavior features include: the user's next login time and login mode. The decision plan includes: allocating corresponding resources.
[0084] Through the above embodiments, the user's login and activity prediction can be realized, wherein the prediction of the user's login behavior may include login time, login frequency, etc., so as to understand the user's activity and login mode. By analyzing the historical login data, the user's next login time or login mode can be predicted to help the system optimize resource allocation and personalized recommendations.
[0085] In some embodiments, the big model can predict the user's behavior pattern by analyzing the user's historical behavior data, including login time, access frequency, access duration, etc. For example, predict the user's login time period and login frequency, as well as the user's preference for different types of resources.
[0086] In some embodiments, based on the prediction of user behavior patterns, the big model can recommend resources that suit each user's needs and preferences. For example, for users who often log in and access specific types of resources in the morning, the relevant resources can be recommended to load in advance in the morning to improve the user's work efficiency.
[0087] In some embodiments, based on the prediction results of user behavior patterns, the big model can optimize resource allocation strategies to ensure that resources are provided to users at the right time and place. For example, for users predicted to log in during peak hours, more server resources can be allocated to them in advance to ensure system stability and user experience.
[0088] In some embodiments, the large model can monitor user behavior data in real time and adjust the resource allocation strategy based on the real-time data. For example, when the system detects that the user's login mode has changed, the resource allocation strategy can be adjusted in time to adapt to the user's new needs.
[0089] In some embodiments, the historical code behavior data includes historical code submission data of the user, and the historical code behavior characteristics of the user include the user's code submission frequency characteristics, code type characteristics, and code quality characteristics;
[0090] The method of analyzing the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: analyzing the historical code submission data of the user based on the big model to obtain the code submission frequency characteristics, code type characteristics and code quality characteristics of the user;
[0091] Based on the user's historical code behavior characteristics, future code behavior characteristics are predicted, and a decision plan is determined based on the future code behavior characteristics, including: based on the user's code submission frequency characteristics, code type characteristics, and code quality characteristics, predicting the user's code submission standardization and future contribution value to the code base; allocating and optimizing resources based on the user's code submission standardization and future contribution value to the code base.
[0092] In the above embodiment, the prediction of the user's code submission behavior can be performed. The user's submission behavior to the code library is predicted, including submission frequency, submitted file type, submitted code volume, etc. By analyzing the user's historical submission data, the user's future contribution to the code library can be predicted, which helps the team evaluate the workload and project progress.
[0093] In some embodiments, indicators may be predefined and predicted based on the big model, wherein the predefined indicators may include contribution balance, per capita code equivalent, per capita productivity, per capita thousand-equivalent bug rate, department productivity, and personal 360 environmental assessment.
[0094] In some embodiments, the team's results can be evaluated numerically. For example, if the contribution balance of more than 40% of the people in a team reaches 80% of the output, it can be considered that there are no obvious problems in the operation of the team.
[0095] In some embodiments, malicious submission behavior can also be predicted based on the code data submitted by the user. Predicting the malicious code submission behavior that the user may perform includes inserting malicious code, tampering with other people's code, etc. Through code review, static code analysis, dynamic code detection and other technologies, possible malicious submission behavior can be identified, and corresponding security review and repair can be performed.
[0096] In some embodiments, the historical code behavior data includes historical file access data of the user, and the historical code behavior characteristics of the user include the user's access file path characteristics, access frequency characteristics, and access permission characteristics;
[0097] The method of analyzing the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: analyzing the historical code submission data of the user based on the big model to obtain the historical access file path characteristics, access frequency characteristics and access permission characteristics of the user;
[0098] Predict future code behavior characteristics based on the user's historical code behavior characteristics, and determine a decision plan based on the future code behavior characteristics, including: obtaining the user's future needs and concerns for code files based on the user's historical access file path characteristics, access frequency characteristics, and access permission characteristics; and allocating or recommending corresponding resources or permissions to the user based on the user's needs and concerns for code files.
[0099] In the above embodiment, the file access behavior can be predicted. The user's access behavior to files can be predicted, including the file path accessed, the frequency of access, the access permissions, etc. By analyzing the user's historical file access data, the user's future needs and concerns for files can be predicted, which helps the team manage file resources and permission settings.
[0100] In some embodiments, the detailed historical file access data analysis can not only analyze the simple number of times a user accesses a file, but also deeply analyze the detailed information such as the user's access frequency, access period, access duration, etc. of different types of files, so as to more accurately understand the user's file needs and concerns.
[0101] In some embodiments, in addition to file access data, other data sources, such as user work tasks, project participation, team communication records, etc., can be combined to comprehensively analyze the user's work patterns and demand characteristics to further improve the accuracy of the prediction.
[0102] In some embodiments, machine learning algorithms, such as classification algorithms and clustering algorithms, are used to model and analyze historical file access data to predict future user needs and concerns for files. This can achieve more accurate predictions and optimize file resources and permission settings based on the prediction results.
[0103] In the above embodiment, the user's needs and concerns for files can be evaluated by pre-defining objective indicators, such as file access frequency, file download times, file modification times, etc. By predicting the quantitative analysis of these indicators through a large model, the user's behavioral characteristics and work needs can be understood more objectively.
[0104] In some embodiments, the historical code behavior data includes historical permission operation data of the user, and the historical code behavior characteristics of the user include the permission adding operation characteristics, deleting operation characteristics and modifying operation characteristics of the user;
[0105] The method of analyzing the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: analyzing the historical code submission data of the user based on the big model to obtain the historical permission adding operation characteristics, deleting operation characteristics and modifying operation characteristics of the user;
[0106] Based on the user's historical code behavior characteristics, future code behavior characteristics are predicted, and a decision plan is determined based on the future code behavior characteristics, including: based on the user's historical permission addition operation characteristics, deletion operation characteristics, and modification operation characteristics, the user's future permission adjustment needs and permission operation risks are predicted; based on the predicted user's future permission adjustment needs and existing permission operation risks, corresponding permission management controls are allocated or adjusted for the user.
[0107] In the above embodiment, permission change behavior prediction can be performed. Predicting the user's permission change behavior, including adding, deleting or modifying user permissions, etc. By analyzing the user's historical permission change records, the user's future permission adjustment needs can be predicted, which helps the system to perform automated permission management and security control.
[0108] In the above embodiment, it is also possible to predict the abuse of rights and predict the operations that users may perform by abusing their rights, such as modifying the rights of others, illegally obtaining sensitive information, etc. Through technologies such as rights review, behavior analysis, and anomaly detection, it is possible to identify possible abuse of rights and perform corresponding rights management and security control.
[0109] In some embodiments, the historical code behavior data includes the user's historical project participation data, and the user's historical code behavior features include the user's project quantity features and the activeness features of participating in the projects. The analyzing the pre-processed historical code behavior data of the user based on the big model to obtain the user's historical code behavior features includes: analyzing the user's historical code submission data based on the big model to obtain the user's historical project quantity features and the activeness features of participating in the projects.
[0110] Based on the user's historical code behavior characteristics, future code behavior characteristics are predicted, and a decision plan is determined based on the future code behavior characteristics, including: based on the user's historical project quantity characteristics and the activity characteristics of participating in projects; predicting the user's future project participation and project contribution; estimating the project contribution based on the predicted user's future project participation, and evaluating the user's work attitude and teamwork ability.
[0111] Among them, permission review includes reviewing and verifying the permissions of users and roles in the system to ensure that they can only access legally authorized resources and functions. Specifically, the identity of the user or role and the requested permissions can be compared with the access rules defined in the system to determine whether the corresponding user's access is authorized.
[0112] In some embodiments, permission review can be used in identity authentication and authorization management scenarios to ensure that the access behavior of users or roles complies with security policies and access control rules.
[0113] In some embodiments, behavioral analysis includes monitoring, analyzing, and identifying the behavioral patterns of users or entities to discover potential abnormal behaviors or security risks. Specifically, behavioral analysis technology usually uses machine learning, statistical analysis, pattern recognition and other methods to analyze and mine large amounts of behavioral data, and by establishing a normal behavior model for users, identify abnormal behaviors that do not match it. In some embodiments, behavioral analysis can be used in security incident detection, identity authentication, threat intelligence analysis and other fields, and can be used to detect security threats such as malicious behavior, internal threats and data leaks.
[0114] In some embodiments, anomaly detection includes identifying abnormal behaviors, abnormal patterns, or abnormal events in data or systems that are inconsistent with normal behaviors. Anomaly detection can use statistical, machine learning, data mining and other methods to analyze and model data, and identify abnormal behaviors that are inconsistent with pre-defined normal patterns by comparing them. Specifically, anomaly detection is widely used in security monitoring, network traffic analysis, equipment fault detection and other fields, and can be used to discover abnormal situations such as unknown threats, network attacks and system failures.
[0115] In some embodiments, privileged account monitoring includes monitoring and reviewing privileged accounts, especially accounts with higher permissions, promptly detecting abnormal activities of privileged accounts, and taking necessary measures to investigate and respond.
[0116] In the above embodiment, the user's project participation behavior can be predicted. The user's project participation behavior can be predicted, including the number of projects participated in, the activity of the project, etc. By analyzing the user's historical participation behavior, the user's future participation and contribution to the project can be predicted, which helps the team evaluate the user's work attitude and teamwork ability.
[0117] In some embodiments, the historical code behavior data includes historical abnormal behavior data of the user, and the historical code behavior features of the user include historical abnormal login features, abnormal submission features, abnormal file access data features, abnormal download features, and abnormal deletion features of the user;
[0118] The method of analyzing the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior features of the user includes: analyzing the historical code submission data of the user based on the big model to obtain the abnormal login features, abnormal submission features, abnormal file access data features, abnormal download features and abnormal deletion features of the user's history;
[0119] Based on the user's historical code behavior characteristics, future code behavior characteristics are predicted, and a decision plan is determined based on the future code behavior characteristics, including: predicting the user's future abnormal behavior based on the user's historical abnormal login characteristics, abnormal submission characteristics, abnormal file access data characteristics, abnormal download characteristics, and abnormal deletion characteristics; based on the predicted future abnormal behavior of the user, a corresponding abnormal behavior response strategy is formulated.
[0120] The large model can predict behavior through historical participation behavior, and in some embodiments, the accuracy and comprehensiveness of the prediction can be further improved. For example, in addition to historical participation behavior, other multi-dimensional data can be considered in multi-dimensional data analysis, such as the user's skill level, project demand matching, team collaboration history, etc., and these factors can be considered comprehensively to more comprehensively evaluate the user's work attitude and team collaboration ability. Real-time feedback and adjustment, the prediction model can be designed to support real-time feedback and adjustment. By monitoring the user's actual participation behavior and contribution, the prediction model can be updated in time to adapt to the user's changing behavior and attitude. Custom feature engineering can be performed. Custom feature engineering can be designed for specific team and project needs to capture the user's specific behavior and characteristics. These features can include project participation frequency, number of code submissions, problem solving speed, etc., which helps to improve the accuracy and personalization of the prediction. User feedback and evaluation system, establish a user feedback and evaluation system, and collect user evaluation and feedback information on the project. This information can be used as an additional input feature to more comprehensively evaluate the user's work attitude and team collaboration ability.
[0121] In the above embodiment, objective data such as contribution balance, per capita code equivalent, code equivalent productivity, year-on-year productivity and month-on-month productivity can be used for evaluation. The big model can be allowed to generate predicted data through prompt words, and the predicted data can be compared with the actual data to gradually correct the prediction ability of the big model.
[0122] The above embodiments can be used to detect abnormal behavior of users and predict abnormal behavior of users, such as abnormal login, abnormal submission, abnormal file access, etc. By analyzing the historical behavior patterns of users, possible abnormal behavior of users in the future can be predicted, which helps the system to perform abnormal detection and security prevention.
[0123] For example, we can predict the deletion behavior of users. We can predict the deletion operations that users may perform, including deleting the entire code base or a large number of files. By analyzing the user's historical behavior and permissions, as well as abnormal behavior detection technology, we can identify potential deletion behaviors and take corresponding preventive measures.
[0124] For example, we can predict the large-scale code downloading behavior of users. We can predict the large-scale code downloading behavior that users may carry out, which may involve stealing code or maliciously distributing code. By analyzing the downloading behavior patterns and download volume of users, as well as monitoring network traffic and data transmission, we can identify possible large-scale downloading behaviors and take corresponding security measures.
[0125] In the above embodiment, user behavior prediction and security protection prediction can be performed. The user behavior prediction agent monitors the user usage log and other contents of the code hosting platform in real time, and connects the content to the prediction through a large model to perform behavior analysis, alarm and intelligent processing, and predict the user's behavior and formulate corresponding resource allocation and security precautions in a timely manner based on the predicted behavior, which greatly improves security.
[0126] In some embodiments, the method further includes: acquiring log data and / or interaction data generated by interacting with a large model; identifying behavioral action risks based on the log data and / or interaction data; and issuing risk warnings in response to identifying risks.
[0127] For example, the method also includes irregular usage statistics and alarms and automatic processing. For irregular usage behavior statistics, the user behavior prediction agent identifies irregular behaviors by interacting with log data and the big model, such as abnormal submission frequency, unauthorized file access, abnormal changes in permissions, etc. For alarm generation, when the big model identifies irregular usage behavior, the behavior prediction agent sends the result to the alarm processing system, and the alarm processing system performs different processing according to predefined advanced rules and levels, generates alarm information, and triggers automatic processing, etc. The alarm information can include detailed information such as the type of abnormal behavior, the time of occurrence, the users or files involved, and the possible impact, so that the administrator can conduct further processing and investigation.
[0128] After the alarm is generated, it can also include automatic processing. When the alarm is generated, the alarm processing system can automatically perform some preventive or repair operations according to pre-set rules and policies. For example, for malicious submission behavior, the user's submission permission can be automatically prohibited or the tampered code can be rolled back; for abnormal file access behavior, the user's access rights can be automatically revoked or file access control can be strengthened.
[0129] After the alarm is generated, feedback and adjustment can also be included. The system can feed back the processing results to the big model for further learning and optimization of the model. If the automatic processing causes errors or adverse effects, the system can pass the corresponding feedback information to the big model to help the model make more accurate predictions and processing.
[0130] It should be noted that in the solution provided in the present application, a visual display can also be performed, and the intermediate data or final data obtained can be displayed visually, which can improve the user experience and enable more intuitive discovery and location of problems.
[0131] In some embodiments, the solution provided by the present application can also perform analysis of static code or static behavior characteristics based on a large model, and can also perform dynamic analysis based on dynamic data. In this way, the contextual relationship between multiple matters can be associated for dynamic analysis, and potential behavioral characteristics and possible deep-seated potential risk issues can be further discovered, thereby further improving the beneficial effects of this solution.
[0132] The present application also provides a code behavior prediction device 300, the device comprising:
[0133] A code hosting platform, used to receive the user's code operation behavior, wherein the user's historical code behavior data is determined based on the user's code operation behavior;
[0134] A behavior prediction agent monitors the code operation behavior of users in the code hosting platform in real time based on a large model, and predicts the user's future code operation behavior, wherein the user's future code behavior characteristics are determined based on the user's future code operation behavior;
[0135] Compliance and security agent, which monitors the code change behavior in the code hosting platform in real time based on a large model and predicts potential risk issues;
[0136] The warning and processing module is used to receive the user's code operation behavior predicted by the behavior prediction agent and the potential risk issues predicted by the compliance and security agent, and to warn and respond to the risks. The decision-making plan includes warning and responding to the risks.
[0137] In a specific embodiment, see Figure 2 , the solution provided in this application includes the following steps:
[0138] Users use the code hosting platform to operate the code. The behavior prediction agent monitors the user's operation behavior in the code hosting platform in real time. At the same time, the security compliance agent also monitors the changes of the code in the code hosting platform in real time. The behavior prediction agent interacts with the security compliance agent in real time, and analyzes and predicts the user's behavior through the pre-trained local fine-tuning large model, and sends the obtained problem points and prediction results to the alarm and intelligent processing system through the security compliance agent and the behavior prediction agent. The alarm and intelligent processing system intelligently processes and notifies the user. Mr. Qi, the local fine-tuning large model is fine-tuned based on the user's historical user behavior data and the security compliance data in the industry. Among them, the specific industry can be the securities industry or other industries, which are not limited here.
[0139] In the current scenario, the shortcomings or deficiencies in enterprise code security and behavior prediction are mainly concentrated in the following aspects:
[0140] Limited detection capabilities: Traditional code security detection tools can often only identify known security vulnerabilities and common code quality issues as well as simple user behaviors that endanger code security. They may not be able to effectively detect new threats and complex security issues.
[0141] The lack of detection capabilities for unknown vulnerabilities and emerging threats can easily lead to missing important security issues.
[0142] Manual and reactive processing: Many companies still use manual and reactive processing methods for code security and behavior prediction, lacking automation and preventive measures.
[0143] The lack of automated tools and processes leads to late discovery of security issues and long response times, increasing security risks and costs.
[0144] Difficulty in data collection and analysis: Data collection and analysis on user behavior and code security requires a lot of manpower and resources, and it is often difficult to achieve comprehensive and accurate data collection and analysis.
[0145] The lack of effective data collection and analysis tools makes it difficult for enterprises to fully understand user behavior and code security status, and to make timely predictions and adjustments.
[0146] Lack of a holistic view: The lack of a holistic view of code security and behavior prediction makes it difficult for enterprises to fully understand and manage code security issues and user behavior.
[0147] The lack of integrated analysis and reporting tools makes it difficult to comprehensively monitor and manage code security and user behavior.
[0148] Lack of customized solutions: Traditional code security and behavior prediction solutions often lack customization and personalization capabilities and cannot fully adapt to the specific needs and environments of different enterprises.
[0149] The lack of flexibility and scalability makes it difficult for enterprises to customize security management and behavior prediction based on their own circumstances.
[0150] These problems reflect the limitations and shortcomings of traditional methods in code security and behavior prediction, and require enterprises to take more comprehensive, automated and preventive measures to address them.
[0151] In the above embodiment, using the AI big model to predict harmful user behaviors, statistically warn of irregular usage behaviors, and perform code security analysis on the code hosting platform has the following benefits and advantages:
[0152] 1) Prediction of user harmful behavior.
[0153] Behavioral pattern analysis: AI models can analyze the historical behavioral patterns of users of the code hosting platform, such as frequent code submissions, number of times sensitive files or codes are accessed, interactions with team members, etc.
[0154] Anomaly detection: Based on learning from user behavior patterns, AI models can identify abnormal behaviors, such as sudden large-scale code deletions, abnormally frequent permission changes, etc., which may indicate malicious behavior or misoperation of users.
[0155] 2) Statistical alerts on irregular usage behavior.
[0156] Definition of code of conduct: Enterprises can define the usage standards of the code hosting platform, such as stipulating the amount of code submitted each time, stipulating the permissions for accessing sensitive code, etc.
[0157] Illegal behavior detection: AI models can analyze whether user behavior complies with regulations, identify behaviors that do not comply with regulations, and generate alerts.
[0158] Real-time monitoring and alerting: AI models can monitor user behavior in real time. Once violations are detected, alerts are immediately generated and relevant team members or security teams are notified for processing.
[0159] 3) Code security analysis.
[0160] Static code analysis: AI models can perform static code analysis on submitted code to identify potential security vulnerabilities, code quality issues, etc.
[0161] Dynamic behavior analysis: AI models can analyze the runtime behavior of the code and identify potential security risks, such as memory leaks and sensitive information leakage.
[0162] Vulnerability prediction and repair suggestions: Based on the learned historical data and code base, the AI model can predict potential vulnerabilities that may exist in new code and provide corresponding repair suggestions.
[0163] 4) Improve safety awareness.
[0164] Through warnings and reminders, team members can pay more attention to security issues and enhance their safety awareness and vigilance.
[0165] 5) Reduce security risks.
[0166] Discovering and resolving security issues in a timely manner can reduce the company's security risks and avoid losses such as data leakage and service interruptions caused by security vulnerabilities.
[0167] 6) Improve team efficiency.
[0168] Automated security analysis and alert mechanisms can help teams quickly identify and resolve security issues, improving team work efficiency and productivity.
[0169] 7) Meet compliance requirements.
[0170] Taking preventive security measures and monitoring mechanisms can help companies meet relevant compliance requirements and standards and avoid penalties from legal and regulatory authorities.
[0171] In the above embodiment, regarding context-aware static code analysis, the AI big model can be trained to understand the context information of the code, including variable naming, function call relationships, control flow, etc. In this way, the model can more accurately understand the meaning and logical structure of the code, thereby more accurately identifying potential problems.
[0172] Multimodal and multi-language static code analysis. In addition to plain text code, modern software development also involves multiple forms of code and related information such as graphical interfaces, configuration files, and documents. AI big models can be extended to multimodal data, such as combining code text and code comments, code change history, and other data sources to improve the ability to detect and understand code quality issues.
[0173] Continuous learning and self-optimization: AI large models can be designed to have continuous learning and self-optimization capabilities. By continuously receiving new code samples and feedback information, the model can dynamically adjust its own parameters and rules, thereby continuously improving its ability to identify code quality issues.
[0174] Regarding dynamic code analysis and behavioral pattern recognition, AI models can be trained to recognize specific behavioral patterns, such as memory leaks, sensitive information leakage, etc. By analyzing the runtime behavior of the code, the model can detect abnormal behaviors related to these patterns and provide warnings or suggestions.
[0175] Context-aware analysis, similar to static code analysis, dynamic behavior analysis can also benefit from understanding the context of the code. AI models can consider contextual information of dynamic behavior, such as function call relationships, data flow dynamics, system status, etc., to more accurately identify potential security risks. Real-time monitoring and feedback, dynamic behavior analysis usually requires monitoring and analysis while the code is running. Therefore, AI models can be designed to support real-time monitoring and feedback, and identify and report potential security issues in a timely manner. This can be achieved through integration with runtime environments, such as application containers, cloud platforms, etc. Real-time monitoring and feedback. Automated remediation suggestions, in addition to identifying security risks, AI models can also provide automated remediation suggestions. Based on the analysis of the runtime behavior of the code, the model can generate suggestions for repairing the code and help developers quickly fix potential security issues.
[0176] In summary, using AI big models to predict user behavior and analyze code security on code hosting platforms can bring many benefits and advantages, helping enterprises protect code resources and data security, improve the team's security awareness and production efficiency, reduce security risks and meet compliance requirements.
[0177] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the accompanying drawings may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0178] For the specific definition of the code behavior prediction device, please refer to the definition of the code behavior prediction method above, which will not be repeated here. Each module in the above device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0179] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store code behavior data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a code behavior data prediction method is implemented.
[0180] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0181] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0182] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0183] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0184] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0185] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A code behavior prediction method, characterized in that: The method comprises: Acquire historical code behavior data of the user, and preprocess the historical code behavior data; Based on the big model, the pre-processed historical code behavior data of the user is analyzed to obtain the historical code behavior characteristics of the user; Future code behavior characteristics are predicted based on the user's historical code behavior characteristics, and a decision plan is determined based on the future code behavior characteristics.
2. The method according to claim 1, characterized in that The user's historical code behavior data includes the user's historical login data; the user's historical code behavior characteristics include the user's login activity characteristics and login mode characteristics; The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: Analyze the user's historical login data based on the big model to obtain the user's login activity characteristics and login mode characteristics; Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including: Predicting the user's future login time and future login mode based on the user's login activity characteristics and login mode characteristics; Based on the predicted future login time and future login pattern of the user, corresponding resources are allocated or recommended to the user.
3. The method according to claim 1, characterized in that The historical code behavior data includes the user's historical code submission data, and the user's historical code behavior characteristics include the user's code submission frequency characteristics, code type characteristics, and code quality characteristics; The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: Analyze the user's historical code submission data based on the big model to obtain the user's code submission frequency characteristics, code type characteristics, and code quality characteristics; Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including: Based on the user's code submission frequency characteristics, code type characteristics, and code quality characteristics, obtaining the user's future contribution value to the code base; Allocate and optimize resources based on the user's future contribution to the code base.
4. The method according to claim 1, characterized in that The historical code behavior data includes the user's historical file access data, and the user's historical code behavior characteristics include the user's access file path characteristics, access frequency characteristics, and access permission characteristics; The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: Analyze the user's historical code submission data based on the big model to obtain the user's historical access file path characteristics, access frequency characteristics, and access permission characteristics; Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including: Based on the file access path characteristics, access frequency characteristics and access permission characteristics of the user's history, the user's future needs and concerns for code files are obtained; Based on the user's needs and concerns about code files, corresponding resources or permissions are allocated or recommended to the user.
5. The method according to claim 1, characterized in that The historical code behavior data includes the user's historical permission operation data, and the user's historical code behavior characteristics include the user's permission increase operation characteristics, deletion operation characteristics, and modification operation characteristics; The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: Analyze the user's historical code submission data based on the big model to obtain the user's historical permission addition operation characteristics, deletion operation characteristics, and modification operation characteristics; Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including: Based on the user's historical permission adding operation features, deleting operation features, and modifying operation features, predict the user's future permission adjustment needs and permission operation risks; Based on the predicted future needs of users for permission adjustment and existing permission operation risks, corresponding permission management controls are allocated or adjusted for users.
6. The method according to claim 1, characterized in that The historical code behavior data includes the user's historical project participation data, and the user's historical code behavior characteristics include the user's project quantity characteristics and the activity characteristics of the project participation; The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: Analyze the user's historical code submission data based on the big model to obtain the user's historical project quantity characteristics and the activity characteristics of participating projects; Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including: Predict the user's future project participation and contribution based on the number of projects the user has participated in and the activity characteristics of the projects they have participated in. Based on the predicted future project participation characteristics of users, the project contribution is estimated and the user's work attitude and teamwork ability are evaluated.
7. The method according to claim 1, characterized in that The historical code behavior data includes the user's historical abnormal behavior data, and the user's historical code behavior features include the user's historical abnormal login features, abnormal submission features, and abnormal file access data features; The analysis of the pre-processed historical code behavior data of the user based on the big model to obtain the historical code behavior characteristics of the user includes: Analyze the user's historical code submission data based on the big model to obtain the user's historical abnormal login features, abnormal submission features, and abnormal file access data features; Predicting future code behavior characteristics based on the user's historical code behavior characteristics, and determining a decision plan based on the future code behavior characteristics, including: Predict future abnormal behaviors of users based on their historical abnormal login features, abnormal submission features, and abnormal file access data features; Based on the predicted future abnormal behavior of users, formulate corresponding abnormal behavior response strategies.
8. The method according to claim 1, characterized in that The method further comprises: Obtain log data and / or interaction data generated by interacting with large models; Performing behavior action risk identification based on the log data and / or interaction data; In response to the identification of risks, risk warnings are issued.
9. The method according to any one of claims 1 to 8, characterized in that The method further includes: performing data preprocessing on the code behavior data of the user, wherein the data preprocessing includes extracting features and converting features of the historical code behavior data to obtain a data format for input into a large model; The large model includes a Transformer model, and the training method of the Transformer model includes: freezing at least part of the Transformer layer parameters and adjusting the output layer parameters to perform model training optimization.
10. A code behavior prediction device, characterized in that: The code behavior prediction method according to any one of claims 1 to 9, wherein the device comprises: A code hosting platform, used to receive the user's code operation behavior, wherein the user's historical code behavior data is determined based on the user's code operation behavior; A behavior prediction agent monitors the code operation behavior of users in the code hosting platform in real time based on a large model, and predicts the user's future code operation behavior, wherein the user's future code behavior characteristics are determined based on the user's future code operation behavior; Compliance and security agent, which monitors the code change behavior in the code hosting platform in real time based on a large model and predicts potential risk issues; The warning and processing module is used to receive the user's code operation behavior predicted by the behavior prediction agent and the potential risk issues predicted by the compliance and security agent, and to warn and respond to the risks. The decision-making plan includes warning and responding to the risks.
Citation Information
Patent Citations
Permission management method, device and system and computer readable storage medium
CN112765591A
Code hosting platform risk control system and method based on deep learning
CN115659286A
User abnormal behavior detection method and device, equipment and storage medium
CN117688434A
Network information security analysis method and system based on big data
CN117749530A
Detecting abnormal user behavior via temporally regularized tensor factorization
US11012454B1
Cited By
Software development data security management method and platform and electronic equipment
CN122372610A
