Data leakage prevention method and device for code generation tool and electronic equipment
Patent Information
- Application Number
- CN202611012527.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-08
- Publication Date
- 2026-10-13
AI Technical Summary
[0004]本发明提供了一种面向代码生成工具的数据防泄漏方法、装置及电子设备,解决了现有技术在单轮会话中瞬时泄漏敏感信息,或者在多轮会话中渐进泄漏敏感信息的问题,有效规避了代码生成过程中的数据泄漏风险,显著提升了代码生成过程中的数据安全性
[0008]本发明的技术方案,通过在通过代码生成工具生成代码的每个会话轮次中,获取待传输至代码生成工具的原始编码请求;生成与各原始编码请求分别对应的最小上下文集合,并基于各最小上下文集合,确定与各原始编码请求对应的会话轨迹风险特征集;基于会话轨迹风险特征集,确定各原始编码请求是否存在多轮会话泄漏风险;当确定各原始编码请求存在多轮会话泄漏风险时,对各最小上下文集合进行防泄漏处理的技术手段,解决了现有技术在单轮会话中瞬时泄漏敏感信息,或者在多轮会话中渐进泄漏敏感信息的问题,有效规避了代码生成过程中的数据泄漏风险,显著提升了代码生成过程中的数据安全性。
Smart Images

Figure CN122904331A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data security, and in particular to a method, apparatus, and electronic device for preventing data leakage in code generation tools. Background Technology
[0002] As code generation tools become increasingly prevalent throughout the software development process, developers can leverage features such as natural language commands, code auto-completion, code refactoring suggestions, automatic unit test generation, and code vulnerability repair to invoke large language models deployed locally or in the cloud. These tools automatically collect various types of development context data during operation and integrate all collected information to generate model invocation requests for large language models.
[0003] However, while this type of call pattern improves R&D efficiency, it also brings new data leakage risks: On the one hand, sensitive assets such as core algorithms, business rules, key configurations, customer data, and architecture documents may be leaked in their entirety during the request construction phase. On the other hand, the leakage may not be completed in one go, but rather through multiple rounds of question-and-answer sessions to gradually break down, rewrite, deduce, and piece together complete sensitive information. Summary of the Invention
[0004] This invention provides a data leakage prevention method, device, and electronic device for code generation tools, which solves the problem of instantaneous leakage of sensitive information in a single-round session or progressive leakage of sensitive information in multiple round sessions in the prior art, effectively avoids the risk of data leakage in the code generation process, and significantly improves the data security in the code generation process.
[0005] In a first aspect, embodiments of the present invention provide a data leakage prevention method for code generation tools, comprising: in each session round of code generation by the code generation tool, obtaining the original encoding request to be transmitted to the code generation tool; generating a minimum context set corresponding to each original encoding request, and determining a session trajectory risk feature set corresponding to each original encoding request based on each minimum context set; determining whether each original encoding request has a multi-round session leakage risk based on the session trajectory risk feature set; and when it is determined that each original encoding request has a multi-round session leakage risk, performing leakage prevention processing on each minimum context set.
[0006] Secondly, embodiments of the present invention also provide a data leakage prevention device for code generation tools, comprising: an encoding request acquisition module, configured to acquire the original encoding request to be transmitted to the code generation tool in each session round of code generation by the code generation tool; a feature set determination module, configured to generate a minimum context set corresponding to each original encoding request, and determine a session trajectory risk feature set corresponding to each original encoding request based on each minimum context set; a session leakage risk determination module, configured to determine whether each original encoding request has a multi-round session leakage risk based on the session trajectory risk feature set; and a leakage prevention processing module, configured to perform leakage prevention processing on each minimum context set when it is determined that each original encoding request has a multi-round session leakage risk.
[0007] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the data leakage prevention method for code generation tools provided in any embodiment of the present invention.
[0008] The technical solution of this invention solves the problem of instantaneous leakage of sensitive information in a single-round session or gradual leakage of sensitive information in multiple round sessions in existing technologies. This is achieved by obtaining the original encoding request to be transmitted to the code generation tool in each session round of code generation; generating a minimum context set corresponding to each original encoding request; determining the session trajectory risk feature set corresponding to each original encoding request based on the minimum context set; determining whether each original encoding request has a multi-round session leakage risk based on the session trajectory risk feature set; and performing anti-leakage processing on each minimum context set when it is determined that each original encoding request has a multi-round session leakage risk. This effectively avoids the data leakage risk in the code generation process and significantly improves data security in the code generation process.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart of a data leakage prevention method for code generation tools provided according to Embodiment 1 of the present invention.
[0012] Figure 2 This is a flowchart of another data leakage prevention method for code generation tools provided according to Embodiment 2 of the present invention.
[0013] Figure 3 This is a schematic diagram of a data leakage prevention device for code generation tools provided in Embodiment 4 of the present invention.
[0014] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Detailed Implementation
[0015] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0016] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0017] Example 1 Figure 1 This is a flowchart of a data leakage prevention method for code generation tools according to Embodiment 1 of the present invention. This embodiment is applicable to the implementation of data leakage prevention processing for code generation tools. The method can be executed by a data leakage prevention device for code generation tools. The data leakage prevention device for code generation tools can be implemented in hardware and / or software and can be configured in electronic devices such as computers.
[0018] like Figure 1 As shown in the figure, this embodiment discloses a data leakage prevention method for code generation tools, including S110-S140.
[0019] S110. In each session round of generating code through the code generation tool, obtain the original encoding request to be transmitted to the code generation tool.
[0020] In this embodiment, the code generation tool can be understood as a development tool that relies on a large language model and provides code assistance capabilities for software development scenarios, supporting the automatic generation of program code through multi-round conversational interaction. The original encoding request can be understood as an encoding request that encapsulates encoding requirements but has not yet been preprocessed by the code generation tool.
[0021] S120. Generate a minimum context set corresponding to each original encoding request, and determine the session trajectory risk feature set corresponding to each original encoding request based on each minimum context set.
[0022] In this step, specifically, a pre-defined context acquisition component can be used to collect the original context sets corresponding to each original encoding request within the actual development environment associated with that original encoding request. This pre-defined context acquisition component can include integrated development environment extension interfaces, local inter-process communication channels, network proxy channels, command-line hook programs, and generative artificial intelligence plugin software development kits, etc. Then, based on each original encoding request, each original context set can be trimmed to obtain a minimum context set corresponding to each original context set. Finally, based on each minimum context set, the semantic trajectory curvature, asset homing, and cross-wheel puzzle risk value corresponding to each original encoding request can be determined, and these three factors are used together as the session trajectory risk feature set corresponding to each original encoding request.
[0023] S130. Based on the session trajectory risk feature set, determine whether there is a risk of multi-round session leakage in each original encoding request.
[0024] In this step, specifically, based on the session trajectory risk feature set, it can be determined whether each original encoding request hits any multi-round session leakage pattern, and based on the hit results, it can be determined whether each original encoding request has a multi-round session leakage risk. Among them, multi-round session leakage patterns include implicit probing patterns, split puzzle patterns, reverse reconstruction patterns, bypass strategy patterns, and multi-tool linkage patterns, etc.
[0025] S140. When it is determined that there is a risk of multi-round session leakage for each original encoding request, leakage prevention processing is performed on each minimum context set.
[0026] In this step, specifically, when it is determined that each original encoding request carries a risk of multi-round session leakage, semantic conformal desensitization, semantic substitute desensitization, and mapping management are performed on each minimal context set to obtain an updated minimal context set corresponding to each original encoding request. Then, based on each original encoding request and the updated minimal context set corresponding to each original encoding request, a model invocation request for a large language model can be generated.
[0027] The technical solution of this embodiment solves the problem of instantaneous leakage of sensitive information in a single-round session or gradual leakage of sensitive information in multiple round sessions by obtaining the original encoding request to be transmitted to the code generation tool in each session round of code generation through the code generation tool; generating a minimum context set corresponding to each original encoding request; determining the session trajectory risk feature set corresponding to each original encoding request based on each minimum context set; determining whether each original encoding request has a multi-round session leakage risk based on the session trajectory risk feature set; and performing anti-leakage processing on each minimum context set when it is determined that each original encoding request has a multi-round session leakage risk. This effectively avoids the data leakage risk in the code generation process and significantly improves the data security in the code generation process.
[0028] Example 2 Figure 2 This is a flowchart of another data leakage prevention method for code generation tools provided by Embodiment 2 of the present invention. This embodiment is a further optimization and extension based on the above embodiments and can be combined with various optional technical solutions in the above embodiments.
[0029] like Figure 2 As shown, this embodiment discloses a data leakage prevention method for code generation tools, including steps S210-S280.
[0030] S210. In each session round of generating code using the code generation tool, obtain the original encoding request to be transmitted to the code generation tool.
[0031] S220. Based on the actual development environment associated with each original encoding request, generate an original context set corresponding to each original encoding request, and based on each original encoding request, trim each original context set to obtain multiple trimmed context sets corresponding to each original context set.
[0032] In this step, specifically, a pre-defined context acquisition component can be used to collect the original context sets corresponding to each original encoding request within the actual development environment associated with that request. These original context sets can include the currently active file, selected code snippet, code window near the editing cursor, function signature of the current symbol, class definition, caller, callee, dependency radius, test failure logs, terminal output, stack trace, user prompts, historical dialogue summaries, tool call plans, automatic proxy task lists, project metadata, repository security level, user permissions, branch status, and access source. Then, each original encoding request can be parsed to obtain its corresponding encoding requirements. Based on these requirements, the code generation task objectives for each original encoding request can be determined. Finally, based on the code generation task objectives, a context trimming method can be determined for each original encoding request. Using this method, the original context sets corresponding to each original encoding request can be trimmed, resulting in multiple trimmed context sets.
[0033] For example, when the code generation task aims to fix syntax errors, a local dependency pruning method can be used to prune the original context set, resulting in multiple pruned context sets that remove irrelevant business logic implementations and retain only error lines, relevant function signatures, local variable definitions, and error stacks. When the code generation task aims to generate interface call examples, an interface contract extraction method can be used to prune the original context set, resulting in multiple pruned context sets that remove the actual data flow transformation process inside the interface and retain only public interface definitions, type declarations, and fake call examples. When the code generation task aims to generate unit tests, a boundary condition desensitization extraction method can be used to prune the original context set, resulting in multiple pruned context sets that retain function signatures, input / output contracts, and desensitized boundary conditions, but not the actual business rule judgment bodies. When the code generation task aims to explain the architecture, an abstract topology generation method can be used to prune the original context set, resulting in multiple pruned context sets that retain the module relationship diagram and abstract responsibility descriptions, but not the core algorithm implementation and actual deployment node information.
[0034] S230. Determine the validity score and outbound risk score of each trimmed context set respectively, and based on the validity score and outbound risk score of each trimmed context set, determine the minimum context set corresponding to each original context set from among multiple trimmed context sets corresponding to each original context set.
[0035] In this step, specifically, either the element coverage method or the output alignment method can be used to determine the validity score of each clipped context set, and the outbound risk score of each clipped context set can be determined based on the proportion of sensitive information in each clipped context set. Specifically, the element coverage method determines the validity score of the clipped context set based on the proportion of task-essential elements in the clipped context set; the task-essential element proportion is the coverage ratio of the code generation task-essential elements in the clipped context set. The output alignment method determines the validity score of the clipped context set based on the similarity between the clipped context set and the original context set. Then, clipped context sets with validity scores greater than or equal to a validity score threshold and outbound risk scores less than or equal to an outbound risk score threshold can be selected as candidate context sets. Finally, among the multiple candidate context sets corresponding to the original context set, the smallest one can be selected as the minimum context set.
[0036] S240. Based on each minimum context set, determine the deduction risk value corresponding to each original encoding request, and based on each deduction risk value, determine the remaining risk amount under multiple session rounds.
[0037] In this step, specifically, based on the minimum context set corresponding to each original encoding request and the asset fingerprint database corresponding to the encoding request initiator, the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original encoding request can be determined. Then, based on these sensitivityes, the deduction risk value corresponding to each original encoding request can be determined. The deduction risk value is a value greater than or equal to 0 and less than or equal to 1. Finally, the remaining risk amount across multiple session rounds can be obtained by subtracting each deduction risk value from the preset total risk value. The preset total risk value can be understood as the available risk amount set based on user needs and historical experience; for example, the preset total risk value can be set to 1.
[0038] Optionally, based on each minimum context set, determine the deduction risk value corresponding to each original encoding request, including: obtaining the encoding request initiator corresponding to each original encoding request, and the asset fingerprint database corresponding to the encoding request initiator; based on the asset fingerprint database and each minimum context set, determine the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original encoding request; based on the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original encoding request, determine the comprehensive sensitivity corresponding to each original encoding request; based on the comprehensive sensitivity corresponding to each original encoding request, determine the deduction risk value corresponding to each original encoding request.
[0039] The asset fingerprint database can include each sensitive asset of the party initiating the encoding request, as well as the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint, and behavioral fingerprint corresponding to each sensitive asset.
[0040] Specifically, the structural sensitivity corresponding to each original encoding request can be determined based on the number of structural fingerprints matching each minimal context set. The semantic sensitivity corresponding to each original encoding request can be determined based on the number of semantic fingerprints matching each minimal context set. The intent sensitivity corresponding to each original encoding request can be determined based on the number of behavioral fingerprints matching each minimal context set. The historical sensitivity corresponding to each original encoding request can be determined based on the exposed asset coverage of historical encoding requests corresponding to each minimal context set. The permission sensitivity corresponding to each original encoding request can be determined based on the number of text fingerprints and relationship fingerprints matching each minimal context set.
[0041] After determining the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original coding request, a weighted summation of these sensitivityes can be performed to determine the overall sensitivity corresponding to each original coding request. Then, an activation function can be used to map the overall sensitivity corresponding to each original coding request to the [0,1] interval, yielding the comprehensive sensitivity corresponding to each original coding request. Finally, based on the comprehensive sensitivity corresponding to each original coding request, the coverage rate of new elements, the tendency to link assets, the tendency to induce desensitization, and the asset co-orientation between each original coding request and the sensitive asset cluster center, the deduction risk value corresponding to each original coding request can be determined.
[0042] Optionally, before obtaining the asset fingerprint database corresponding to the encoding request initiator, the method further includes: obtaining each sensitive asset of the encoding request initiator; determining the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint, and behavioral fingerprint corresponding to each sensitive asset; and constructing the asset fingerprint database corresponding to the encoding request initiator based on each sensitive asset and the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint, and behavioral fingerprint corresponding to each sensitive asset.
[0043] Text fingerprints can include keywords, phrases, entities, paths, configuration items, and domain terms. Structural fingerprints can include abstract syntax tree subtrees, intermediate representation fragments, call chains, data flow graphs, and control flow graphs. Semantic fingerprints can include code embedding vectors, document embedding vectors, and asset cluster centers. Relational fingerprints can include dependency graph locations, module affiliations, upstream and downstream interfaces, data sources, and data sinks. Behavioral fingerprints can include typical debugging intentions, extraction intentions, refactoring intentions, and abnormal access sequences.
[0044] S250. When the remaining risk limit is greater than the preset limit threshold, determine the session trajectory risk feature set corresponding to each original encoding request based on each minimum context set.
[0045] The preset credit limit threshold can be understood as a credit limit threshold set according to user needs and historical experience. For example, the preset credit limit threshold can be set to 0.
[0046] Optionally, based on each minimum context set, a session trajectory risk feature set corresponding to each original encoding request is determined, including: based on the minimum context set corresponding to each original encoding request, a sensitivity vector corresponding to each original encoding request is determined, and based on each sensitivity vector, a semantic trajectory curvature corresponding to each original encoding request is determined; based on the minimum context set corresponding to each original encoding request, an asset coverage vector corresponding to each original encoding request is determined, and based on each asset coverage vector and the sensitive asset cluster center vector corresponding to the encoding request initiator, an asset co-direction between each original encoding request and the sensitive asset cluster center is determined; based on the minimum context set corresponding to each original encoding request, an exposed asset set corresponding to each original encoding request is determined, and based on each exposed asset set, a cross-wheel puzzle risk value corresponding to each original encoding request is determined; the semantic trajectory curvature, asset co-direction, and cross-wheel puzzle risk value are used together as the session trajectory risk feature set corresponding to each original encoding request.
[0047] Specifically, for semantic trajectory curvature, sensitive assets corresponding to each original encoding request can be determined based on the minimum context set corresponding to each original encoding request, and sensitivity vectors corresponding to each original encoding request can be determined based on the sensitive assets corresponding to each original encoding request.
[0048] Then, the semantic trajectory curvature corresponding to each original encoding request can be determined using the following specific calculation formula: .
[0049] in, Represents the curvature of a semantic trajectory. The larger the value, the more drastic the intention reversal, such as suddenly shifting from interpreting general code to extracting core algorithms; Indicates the first Sensitivity vector of the original encoding request Compared to the first Wheel sensitivity vector The displacement vector; Indicates the first Sensitivity vector of the original encoding request Compared to the first Wheel sensitivity vector The displacement vector; This represents the minimum constant to prevent the denominator from being zero; Indicates parameters sensitive to step size changes, such as 2; It represents the sine of the angle between two displacement vectors, indicating the degree of directional deflection.
[0050] For asset homogeneity, the various sensitive assets corresponding to each original encoding request can be determined based on the minimum context set corresponding to each original encoding request. Then, the asset coverage vector corresponding to each original encoding request can be determined based on the presentation method and presentation frequency of each sensitive asset in the corresponding minimum context set.
[0051] Finally, it can be done through the formula Determine the asset alignment degree corresponding to each original coding request. Among them, Indicates the degree of alignment of assets. Indicates the first The asset coverage vector of the round, Indicates the preceding The cumulative asset coverage vector of the round, Represents the cluster center vector of sensitive assets. Used for calculation and Cosine similarity between them.
[0052] The cross-wheel puzzle risk value can be determined using the following specific calculation formula, which corresponds to the risk value of each original encoding request: .
[0053] in, This represents the risk value of the puzzle piece, with a value range of [0, 1]. The larger the value, the higher the risk of puzzle piece leakage. Indicates the degree of alignment of assets; No. The portfolio of assets exposed in the round, Indicates the preceding The union of the asset sets that have been exposed in the round. Functions are used to calculate The value ranges from [0, 1] relative to the coverage of all sensitive assets in the asset fingerprint database.
[0054] S260. When the remaining risk limit is less than or equal to the preset limit threshold, the minimum context set is de-identified to obtain the de-identified minimum context set, and the session trajectory risk feature set corresponding to each original encoding request is determined based on the de-identified minimum context set.
[0055] In this step, specifically, at least one of the following operations can be performed on each minimal context set: semantic conformal masking, semantic surrogate masking, identifier conformal replacement, constant conformal replacement, control flow security replacement, data flow truncation, document digest replacement, and mapping management, to obtain the masked minimal context sets. Specifically, semantic conformal masking is used to replace sensitive configuration identifiers while maintaining the code structure elements unchanged; code structure elements include function signatures, class structures, type relationships, exception paths, and interface contracts; sensitive configuration identifiers include variable names, constants, business rules, specific thresholds, keys, URLs, and customer identifiers.
[0056] Semantic aliasing desensitization is used to encapsulate sensitive algorithm implementations in a sandbox, preserving branch counts, return types, exception handling structures, and input / output contracts. Identifier conformance-preserving replacement replaces variable names, function names, and class names with stable pseudo-names, maintaining consistency across files. Constant conformance-preserving replacement performs type-, format-, length-, or distribution-based replacements for sensitive fields such as keys, URLs, IPs, customer numbers, business thresholds, prices, and ratios. Control flow security replacement preserves branch counts, exception handling structures, and return types while replacing real judgment conditions. Data flow truncation preserves the abstract relationship between data sources and data sinks, deleting real field mappings and business conversion rules. Document digest replacement replaces internal architecture documents with abstract responsibility statements and interface contract summaries. Mapping management converts real identifiers into desensitized identifiers; specifically, it can automatically convert low-risk identifiers, perform partial conversions or require manual confirmation for medium-risk identifiers, block outgoing high-risk identifiers, and provide security warnings for core asset identifiers.
[0057] By setting up the above methods, we can maintain code syntax, interface contracts, and tool availability while stripping away business value, thereby ensuring data security during the code generation process.
[0058] S270. Based on the session trajectory risk feature set, determine whether there is a risk of multi-round session leakage in each original encoding request.
[0059] Specifically, in this step, if it is determined that the remaining risk limit is greater than the preset limit threshold and the original encoding request does not have the risk of multi-round session leakage, the model call request generated from the original encoding request and the corresponding minimum context set can be directly allowed. If it is determined that the remaining risk limit is less than or equal to the preset limit threshold and the original encoding request does not have the risk of multi-round session leakage, the model call request generated from the original encoding request and the corresponding de-identified minimum context set can be directly allowed.
[0060] Optionally, based on the session trajectory risk feature set, determine whether each original encoding request has a multi-round session leakage risk, including: based on the session trajectory risk feature set, determine whether each original encoding request hits any multi-round session leakage pattern; wherein, the multi-round session leakage pattern includes implicit probing pattern, split puzzle pattern, reverse restoration pattern, bypass strategy pattern, and multi-tool linkage pattern; if each original encoding request hits any multi-round session leakage pattern, then it is determined that each original encoding request has a multi-round session leakage risk; if each original encoding request does not hit any multi-round session leakage pattern, then it is determined that each original encoding request does not have a multi-round session leakage risk.
[0061] The implicit heuristic mode involves continuous requests with a general interpretation, but the semantic direction gradually approaches the same asset cluster. In this mode, the computation focuses on asset co-orientation; if multiple rounds of displacement vectors all point to the same sensitive asset cluster center, an alarm will be triggered even if the step size of a single round is small. The split-puzzle mode involves each round of requests containing only local functions, local configurations, or local rules, but cumulatively covering the core process. In this mode, the computation focuses on cross-round puzzle risk; by taking the union of the exposed asset sets, an alarm is triggered if the cross-round puzzle risk value exceeds a threshold.
[0062] The reverse restoration mode first requests anonymized code interpretation, then requests the restoration of the real name, real threshold, or complete call chain. In reverse restoration mode, the computation focuses on abrupt changes in semantic trajectory curvature; if a sharp reversal of the intent vector is detected, the semantic trajectory curvature will be significantly amplified, triggering interception. The bypass strategy mode includes prompts that ignore rules, compress output, segment output, or rewrite descriptive instructions. The multi-tool linkage mode involves the same session requesting related content across integrated development environments, terminals, browsers, or proxy tasks.
[0063] By using the above settings, we can detect induced, split, and reverse-reverse leakage behaviors that cannot be identified by single-round rules, thereby ensuring data security during the code generation process.
[0064] S280. When it is determined that there is a risk of multi-round session leakage for each original encoding request, leakage prevention processing shall be performed on each minimum context set.
[0065] Specifically, in this step, when it is determined that the remaining risk limit is greater than a preset limit threshold and the original encoding request has a risk of leakage from multiple rounds of sessions, leakage prevention processing is performed on each minimum context set. When it is determined that the remaining risk limit is less than or equal to the preset limit threshold and the original encoding request has a risk of leakage from multiple rounds of sessions, leakage prevention processing is performed on each de-identified minimum context set.
[0066] For example, when it is determined that the remaining risk limit is greater than the preset limit threshold, each original encoding request has a risk of multi-round session leakage, and the hit multi-round session leakage pattern is the bypass strategy pattern, the session can be isolated, the subsequent threshold level can be increased, and each minimum context set can be processed to prevent leakage.
[0067] Optionally, the context data and decision-making basis for each encoding request can be comprehensively recorded to generate a chained summary audit log. This context data and decision-making basis includes, but is not limited to, request summary, user, project, time, tool type, task intent, context selection result and reason for non-selection, structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, permission sensitivity, overall sensitivity, summary before and after de-identification, mapped managed summary, final policy action (allow or de-identify), risk value deduction, semantic trajectory curvature, asset coverage, alarm reason, related manual approval opinions, user feedback, and subsequent security events. Then, based on the chained summary audit log, the data leakage prevention strategy can be automatically optimized through self-learning. Optimization actions include adjusting the sensitivity weights of each dimension and improving the asset fingerprint database. Finally, the optimized data leakage prevention strategy will be packaged into a signed configuration package and hot-updated to the local agent, thereby influencing the overall sensitivity composition, risk value deduction, and semantic trajectory curvature calculation in the next evaluation, achieving dynamic closed-loop improvement of the leakage prevention strategy.
[0068] The technical solution of this embodiment generates an original context set corresponding to each original encoding request through the actual development environment associated with each original encoding request; based on each original encoding request, each original context set is trimmed to obtain multiple trimmed context sets corresponding to each original context set; the validity score and outbound risk score of each trimmed context set are determined respectively; based on the validity score and outbound risk score of each trimmed context set, the minimum context set corresponding to each original context set is determined from the multiple trimmed context sets corresponding to each original context set, which can reduce unnecessary context outbound transmission and reduce the risk of leakage caused by default uploading of complete files or directories. Secondly, by using each minimum context set, the deduction risk value corresponding to each original encoding request is determined, and based on each deduction risk value, the remaining risk amount under multiple session rounds is determined. When the remaining risk amount is less than or equal to a preset threshold, each minimum context set is anonymized to obtain an anonymized minimum context set, and based on the anonymized minimum context set, the session trajectory risk feature set corresponding to each original encoding request is determined. Based on the session trajectory risk feature set, it is determined whether each original encoding request has a multi-round session leakage risk. When it is determined that each original encoding request has a multi-round session leakage risk, leakage prevention processing is performed on each minimum context set, which can constrain the cumulative exposure in multi-round sessions and defend against the gradual leakage formed by low-sensitivity multi-round splicing.
[0069] Example 3 This embodiment discloses a data leakage prevention system for code generation tools. This system can be deployed independently on a developer's terminal, a local security agent, or an enterprise edge gateway, or in a composite operating environment built upon these three components. The system includes: a context capture component, a minimum necessary context set generation component, a multi-dimensional semantic sensitivity assessment engine, a semantic risk budget management component, a policy routing and approval component, a conformal de-identification and semantic surrogate generation component, a reversible mapping hosting component, a cross-cycle leakage trajectory monitoring component, an audit and evidence collection component, and a policy self-learning optimization component.
[0070] In this embodiment, the context capture component can be used to acquire the original encoding request to be transmitted to the code generation tool in each session round of code generation via the code generation tool; based on the actual development environment associated with each original encoding request, it generates an original context set corresponding to each original encoding request. The minimum necessary context set generation component can be used to trim each original context set based on each original encoding request, obtaining multiple trimmed context sets corresponding to each original context set; determine the validity score and outbound risk score of each trimmed context set; based on the validity score and outbound risk score of each trimmed context set, determine the minimum context set corresponding to each original context set from among the multiple trimmed context sets corresponding to each original context set.
[0071] The multidimensional semantic sensitivity assessment engine can be used to determine the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original encoding request, based on an asset fingerprint database and each minimum context set. The asset fingerprint modeling component can be used to acquire each sensitive asset of the encoding request initiator; determine the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint, and behavioral fingerprint corresponding to each sensitive asset; and construct an asset fingerprint database corresponding to the encoding request initiator based on each sensitive asset and its corresponding text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint, and behavioral fingerprint.
[0072] The semantic risk budget management component can be used to determine the comprehensive sensitivity corresponding to each original encoding request based on the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original encoding request; determine the deduction risk value corresponding to each original encoding request based on the comprehensive sensitivity corresponding to each original encoding request; and determine the remaining risk amount under multiple session rounds based on each deduction risk value.
[0073] The policy routing and approval component can be used to determine the session trajectory risk feature set corresponding to each original encoding request based on each minimum context set when the remaining risk limit is greater than the preset limit threshold; when the remaining risk limit is less than or equal to the preset limit threshold, the minimum context set is de-identified to obtain the de-identified minimum context set, and the session trajectory risk feature set corresponding to each original encoding request is determined based on the de-identified minimum context set.
[0074] The conformal masking and semantic substitution generation components can be used to perform semantic conformal masking, semantic substitution masking, and mapping management operations on each minimal context set to obtain the masked minimal context sets. Specifically, semantic conformal masking replaces sensitive configuration identifiers while preserving the code structure elements; semantic substitution masking encapsulates sensitive algorithm implementations into a sandbox; and mapping management converts real identifiers into masked identifiers. The reversible mapping management component can be used to locally store the mapping relationship between real identifiers and masked identifiers.
[0075] The cross-round leakage trajectory monitoring component can be used to determine whether each original encoding request hits any multi-round session leakage pattern based on the session trajectory risk feature set. Among them, the multi-round session leakage patterns include implicit probing pattern, split puzzle pattern, reverse reconstruction pattern, bypass strategy pattern, and multi-tool linkage pattern. If each original encoding request hits any multi-round session leakage pattern, it is determined that each original encoding request has a multi-round session leakage risk, and leakage prevention processing is performed on each minimum context set. If each original encoding request does not hit any multi-round session leakage pattern, it is determined that each original encoding request does not have a multi-round session leakage risk.
[0076] The audit and forensics component can be used to comprehensively record the context data and decision-making basis of each encoding request, generating a chained summary audit log. The strategy self-learning optimization component can be used to automatically learn and optimize data leakage prevention strategies based on the chained summary audit log.
[0077] The technical solution of this invention, through the cooperation of a context capture component, a minimum necessary context set generation component, a multi-dimensional semantic sensitivity assessment engine, a semantic risk budget management component, a policy routing and approval component, a conformal desensitization and semantic substitute generation component, a reversible mapping hosting component, a cross-round leakage trajectory monitoring component, an audit and evidence collection component, and a policy self-learning optimization component, solves the problem of instantaneous leakage of sensitive information in a single round of conversation or progressive leakage of sensitive information in multiple rounds of conversation in existing technologies. It effectively avoids the risk of data leakage during the code generation process and significantly improves the data security during the code generation process.
[0078] Example 4 Figure 3 This is a schematic diagram of a data leakage prevention device for code generation tools according to Embodiment 4 of the present invention. This embodiment can be applied to the situation of implementing data leakage prevention processing for code generation tools. The data leakage prevention device for code generation tools can be implemented in hardware and / or software form, and can be configured in electronic devices such as computers.
[0079] like Figure 3As shown, the data leakage prevention device for code generation tools disclosed in this embodiment includes an encoding request acquisition module 31, a feature set determination module 32, a session leakage risk determination module 33, and a leakage prevention processing module 34.
[0080] The encoding request acquisition module 31 is used to acquire the original encoding request to be transmitted to the code generation tool in each session round of code generation through the code generation tool; The feature set determination module 32 is used to generate a minimum context set corresponding to each original encoding request, and to determine the session trajectory risk feature set corresponding to each original encoding request based on each minimum context set; The session leakage risk determination module 33 is used to determine whether there is a risk of multi-round session leakage in each original encoded request based on the session trajectory risk feature set; The anti-leakage processing module 34 is used to perform anti-leakage processing on each minimum context set when it is determined that there is a risk of multi-round session leakage for each original encoding request.
[0081] The technical solution in this embodiment, through the cooperation of the encoding request acquisition module 31, the feature set determination module 32, the session leakage risk determination module 33, and the anti-leakage processing module 34, solves the problem of instantaneous leakage of sensitive information in a single-round session or gradual leakage of sensitive information in multiple round sessions in the prior art, effectively avoids the data leakage risk in the code generation process, and significantly improves the data security in the code generation process.
[0082] Optionally, the feature set determination module 32 includes: The raw context generation unit is used to generate a set of raw contexts corresponding to each raw encoding request, based on the actual development environment associated with each raw encoding request. The context trimming unit is used to trim each original context set based on each original encoding request, so as to obtain multiple trimmed context sets corresponding to each original context set. The context scoring determination unit is used to determine the effectiveness score and outbound risk score of each clipped context set, respectively. The minimum context generation unit is used to determine the minimum context set corresponding to each original context set from multiple trimmed context sets based on the validity score and outbound risk score of each trimmed context set. The risk deduction value determination unit is used to determine the risk deduction value corresponding to each original encoding request based on each minimum context set; The remaining risk limit determination unit is used to determine the remaining risk limit for multiple session rounds based on each deducted risk value. The first feature set determination unit is used to determine the session trajectory risk feature set corresponding to each original encoding request based on each minimum context set when the remaining risk limit is greater than the preset limit threshold. The second feature set determination unit is used to perform desensitization processing on each minimum context set when the remaining risk limit is less than or equal to the preset limit threshold, to obtain each desensitized minimum context set, and to determine the session trajectory risk feature set corresponding to each original encoding request based on each desensitized minimum context set. The semantic trajectory curvature determination unit is used to determine the sensitivity vector corresponding to each original encoding request based on the minimum context set corresponding to each original encoding request, and to determine the semantic trajectory curvature corresponding to each original encoding request based on each sensitivity vector. The asset directionality determination unit is used to determine the asset coverage vector corresponding to each original encoding request based on the minimum context set corresponding to each original encoding request, and to determine the asset directionality between each original encoding request and the sensitive asset cluster center based on each asset coverage vector and the sensitive asset cluster center vector corresponding to the encoding request initiator. The cross-wheel puzzle risk value determination unit is used to determine the set of exposed assets corresponding to each original coding request based on the minimum context set corresponding to each original coding request, and to determine the cross-wheel puzzle risk value corresponding to each original coding request based on each set of exposed assets. The third feature set determination unit is used to combine semantic trajectory curvature, asset homogeneity, and cross-wheel puzzle risk value as the session trajectory risk feature set corresponding to each original encoding request.
[0083] Optionally, the risk deduction value determination unit is specifically used for: obtaining the encoding request initiator corresponding to each original encoding request, and the asset fingerprint database corresponding to the encoding request initiator; determining the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original encoding request based on the asset fingerprint database and each minimum context set; determining the comprehensive sensitivity corresponding to each original encoding request based on the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each original encoding request; and determining the risk deduction value corresponding to each original encoding request based on the comprehensive sensitivity corresponding to each original encoding request.
[0084] Optionally, the device further includes an asset fingerprint database construction unit, which is used to: acquire each sensitive asset of the encoding request initiator; determine the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint and behavioral fingerprint corresponding to each sensitive asset respectively; and construct an asset fingerprint database corresponding to the encoding request initiator based on each sensitive asset and the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint and behavioral fingerprint corresponding to each sensitive asset respectively.
[0085] Optionally, the second feature set determination unit is specifically used to: perform semantic conformal desensitization, semantic substitution desensitization, and mapping management operations on each minimum context set to obtain each desensitized minimum context set; wherein, the semantic conformal desensitization operation is used to replace each sensitive configuration identifier while keeping the code structure elements unchanged; the semantic substitution desensitization operation is used to encapsulate the sensitive algorithm implementation program into a sandbox; and the mapping management operation is used to convert the real identifier into a desensitized identifier.
[0086] Optionally, the session leakage risk determination module 33 is specifically used to: determine whether each original encoding request hits any multi-round session leakage pattern based on the session trajectory risk feature set; wherein, the multi-round session leakage pattern includes implicit probing pattern, split puzzle pattern, reverse restoration pattern, bypass strategy pattern and multi-tool linkage pattern; if each original encoding request hits any multi-round session leakage pattern, it is determined that each original encoding request has a multi-round session leakage risk; if each original encoding request does not hit any multi-round session leakage pattern, it is determined that each original encoding request does not have a multi-round session leakage risk.
[0087] The data leakage prevention device for code generation tools provided in this embodiment of the invention can execute the data leakage prevention method for code generation tools provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution. Content not described in detail in this embodiment can be referred to the description in any method embodiment of this application.
[0088] Example 5 Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement embodiments of the present invention is shown. For example... Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory 12 or a random access memory 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 12 or loaded from storage unit 18 into the random access memory 13. The random access memory 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, read-only memory 12, and random access memory 13 are interconnected via a bus 14. An input / output interface 15 is also connected to the bus 14.
[0089] Multiple components in electronic device 10 are connected to input / output interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0090] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as data leakage prevention methods for code generation tools.
[0091] In some embodiments, the data leakage prevention method for code generation tools can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via read-only memory 12 and / or communication unit 19. When the computer program is loaded into random access memory 13 and executed by processor 11, one or more steps of the data leakage prevention method for code generation tools described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the data leakage prevention method for code generation tools by any other suitable means (e.g., by means of firmware).
[0092] Various embodiments 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-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0093] Computer programs used to implement 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, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0094] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0095] To provide interaction with a user, the systems and techniques described herein can 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 pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0096] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0097] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0098] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0099] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A data leakage prevention method for code generation tools, characterized in that, The data leakage prevention method for code generation tools includes: In each session round of code generation using the code generation tool, the original encoding request to be transmitted to the code generation tool is obtained; Generate a minimum context set corresponding to each of the original encoding requests, and determine a session trajectory risk feature set corresponding to each of the original encoding requests based on each minimum context set; Based on the session trajectory risk feature set, determine whether each of the original encoded requests has the risk of multi-round session leakage; When it is determined that each of the original encoding requests has a risk of multi-round session leakage, leakage prevention processing is performed on each of the minimum context sets.
2. The data leakage prevention method for code generation tools according to claim 1, characterized in that, Generating a minimum set of contexts corresponding to each of the original encoding requests, including: Based on the actual development environment associated with each of the original encoding requests, an original context set corresponding to each of the original encoding requests is generated; Based on each of the original encoding requests, each of the original context sets is trimmed to obtain multiple trimmed context sets corresponding to each of the original context sets. Determine the validity score and outbound risk score for each of the aforementioned trimmed context sets; Based on the validity score and outbound risk score of each of the trimmed context sets, a minimum context set corresponding to each of the original context sets is determined from among the multiple trimmed context sets corresponding to each of the original context sets.
3. The data leakage prevention method for code generation tools according to claim 1, characterized in that, Based on each of the minimum context sets, a session trajectory risk feature set corresponding to each of the original encoding requests is determined, including: Based on each of the minimum context sets, determine the deduction risk value corresponding to each of the original encoding requests; Based on the aforementioned deducted risk values, the remaining risk amount is determined for multiple session rounds; When the remaining risk limit is greater than the preset limit threshold, the session trajectory risk feature set corresponding to each original encoding request is determined based on each of the minimum context sets. When the remaining risk limit is less than or equal to the preset limit threshold, the minimum context set is de-identified to obtain the de-identified minimum context set, and the session trajectory risk feature set corresponding to each original encoding request is determined based on the de-identified minimum context set.
4. The data leakage prevention method for code generation tools according to claim 3, characterized in that, Based on each of the minimum context sets, determine the deduction risk value corresponding to each of the original encoding requests, including: Obtain the encoding request initiator corresponding to each of the original encoding requests, and the asset fingerprint database corresponding to the encoding request initiator; Based on the asset fingerprint database and each of the minimum context sets, determine the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each of the original encoding requests; Based on the structural sensitivity, semantic sensitivity, intent sensitivity, historical sensitivity, and permission sensitivity corresponding to each of the original encoding requests, a comprehensive sensitivity corresponding to each of the original encoding requests is determined. Based on the comprehensive sensitivity corresponding to each of the original encoding requests, a deduction risk value corresponding to each of the original encoding requests is determined.
5. The data leakage prevention method for code generation tools according to claim 4, characterized in that, Before obtaining the asset fingerprint database corresponding to the initiator of the encoding request, the process also includes: Obtain the sensitive assets of the party initiating the encoding request; Determine the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint, and behavioral fingerprint corresponding to each of the aforementioned sensitive assets; Based on each of the aforementioned sensitive assets, and the text fingerprint, structural fingerprint, semantic fingerprint, relational fingerprint, and behavioral fingerprint corresponding to each of the aforementioned sensitive assets, an asset fingerprint database corresponding to the initiator of the encoding request is constructed.
6. The data leakage prevention method for code generation tools according to claim 3, characterized in that, The minimum context sets are anonymized to obtain the anonymized minimum context sets, including: Perform semantic conformal desensitization, semantic substitution desensitization, and mapping management operations on each of the minimum context sets to obtain the desensitized minimum context sets. The semantic conformal desensitization operation is used to replace each sensitive configuration identifier while keeping the code structure elements unchanged; the semantic substitute desensitization operation is used to encapsulate the sensitive algorithm implementation program into a sandbox; and the mapping management operation is used to convert the real identifier into a desensitized identifier.
7. The data leakage prevention method for code generation tools according to claim 1, characterized in that, Based on each of the minimum context sets, a session trajectory risk feature set corresponding to each of the original encoding requests is determined, including: Based on the minimum context set corresponding to each of the original encoding requests, a sensitivity vector corresponding to each of the original encoding requests is determined, and based on each sensitivity vector, the semantic trajectory curvature corresponding to each of the original encoding requests is determined. Based on the minimum context set corresponding to each of the original encoding requests, the asset coverage vector corresponding to each of the original encoding requests is determined. Based on each of the asset coverage vectors and the sensitive asset cluster center vector corresponding to the encoding request initiator, the asset co-direction between each of the original encoding requests and the sensitive asset cluster center is determined. Based on the minimum context set corresponding to each of the original encoding requests, the exposed asset set corresponding to each of the original encoding requests is determined, and based on each of the exposed asset sets, the cross-wheel puzzle risk value corresponding to each of the original encoding requests is determined; The semantic trajectory curvature, the asset homogeneity, and the cross-wheel puzzle risk value are collectively used as the session trajectory risk feature set corresponding to each of the original encoding requests.
8. The data leakage prevention method for code generation tools according to claim 1, characterized in that, Based on the session trajectory risk feature set, determine whether each of the original encoded requests has a risk of multi-round session leakage, including: Based on the session trajectory risk feature set, determine whether each of the original encoded requests hits any multi-round session leakage pattern; The multi-round session leakage modes include implicit probing mode, split puzzle mode, reverse reconstruction mode, bypass strategy mode, and multi-tool linkage mode; If each of the original encoding requests hits any multi-round session leakage pattern, then it is determined that each of the original encoding requests has a multi-round session leakage risk; If none of the original encoding requests match any multi-round session leakage pattern, then it is determined that none of the original encoding requests have a multi-round session leakage risk.
9. A data leakage prevention device for code generation tools, characterized in that, The data leakage prevention device for code generation tools includes: The encoding request acquisition module is used to acquire the original encoding request to be transmitted to the code generation tool in each session round when the code is generated by the code generation tool; The feature set determination module is used to generate a minimum context set corresponding to each of the original encoding requests, and to determine a session trajectory risk feature set corresponding to each of the original encoding requests based on each of the minimum context sets. The session leakage risk determination module is used to determine whether each of the original encoded requests has a multi-round session leakage risk based on the session trajectory risk feature set; The anti-leakage processing module is used to perform anti-leakage processing on each of the minimum context sets when it is determined that each of the original encoded requests has a risk of multi-round session leakage.
10. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to perform the data leakage prevention method for code generation tools according to any one of claims 1-8.