Sensitive information protection method and device, storage medium and electronic equipment

By using preset entity recognition priority rules and session salt values ​​to generate placeholders, the problem of easy misoperation in sensitive information desensitization is solved, achieving highly accurate and secure sensitive information processing, which is suitable for secure applications of large models.

CN121479838APending Publication Date: 2026-02-06BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511840365.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing methods for desensitizing sensitive information carry the risk of misoperation, are difficult to meet business needs for reconciliation, association, and personalized backfilling of generated results, and lack accuracy and verifiability in the desensitization process.

Method used

Sensitive data fragments are identified using preset entity recognition priority rules, and placeholders without type semantics are generated based on session salt value and server key. The mapping relationship between sensitive data and placeholders is stored through a mapping table to ensure the integrity and immutability of placeholders during the input and output of large models.

Benefits of technology

It enables secure and controllable input of sensitive information into large-scale models, improves the accuracy and security of desensitization, ensures the verifiability and reversibility of the generated results, and reduces the risk of data leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121479838A_ABST
    Figure CN121479838A_ABST
Patent Text Reader

Abstract

The invention relates to a sensitive information protection method and device, a storage medium and electronic equipment. The method comprises the following steps: executing structured field identification and general sensitive data identification processing on original input data to identify all sensitive data fragments; performing identification calculation and integrity signature processing on each sensitive data segment to generate a corresponding placeholder, and storing a mapping relationship between each sensitive data segment and the placeholder thereof in a mapping table; according to the mapping relation, replacing each sensitive data segment in the original input data with a corresponding placeholder to obtain replacement input data, and inputting the replacement input data and the output rule into the target large model to enable the target large model to output the original output data; and according to the mapping relationship, replacing each placeholder in the original output data with the corresponding sensitive data fragment to obtain final output data. The technical problem that sensitive data desensitization is prone to misoperation is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent processing technology, and in particular to a method, apparatus, storage medium, and electronic device for protecting sensitive information. Background Technology

[0002] With the widespread application of large-scale generative models in scenarios such as customer service, document processing, medical legal affairs, and operations and maintenance auditing, the raw business data often contains important data such as sensitive personal information, trade secrets, and operation and maintenance keys. Directly inputting this raw sensitive data into the model may lead to data leakage, compliance risks, and business security issues, including third-party services retaining and using the data for model optimization, the spread of logs or caches, the propagation of vector retrieval libraries, the model output restating confidential information, and compliance challenges in cross-border transmission. Existing anonymization or desensitization methods are mostly irreversible, making it difficult to meet business needs for reconciliation, correlation, and personalized backfilling of generated results; relying solely on natural language prompts to constrain the model to keep sensitive information unchanged lacks hard guarantees and verifiability. Furthermore, the accuracy of the desensitization process faces significant challenges: on the one hand, field values ​​and their sub-entities may overlap or be nested within the same text. Without conflict resolution, sensitive information may be repeatedly desensitized or destroyed, making it unrecoverable. For example, when a UID value overlaps with a phone number, desensitizing the phone number first will destroy the original UID value. On the other hand, if the desensitized field names and corresponding values ​​are not strictly checked for boundaries, it is easy to cause incorrect desensitization, such as incorrectly processing a UUID as a UID, or misjudging the numbers in the device ID as a phone number. Summary of the Invention

[0003] This application provides a method, apparatus, storage medium, and electronic device for protecting sensitive information, in order to solve the technical problem of easy misoperation in the desensitization of sensitive data.

[0004] In a first aspect, this application provides a method for protecting sensitive information, comprising: performing structured field recognition and general sensitive data recognition processing on the original input data according to a preset entity recognition priority rule to identify all sensitive data fragments; performing identifier calculation and integrity signature processing on each sensitive data fragment based on the session salt value and the server key to generate a corresponding placeholder that does not contain type semantics and conforms to fixed format requirements, and saving the mapping relationship between each sensitive data fragment and its placeholder in a mapping table; replacing each sensitive data fragment in the original input data with the corresponding placeholder according to the above mapping relationship to obtain replaced input data, and inputting the above replaced input data and output rules into a target large model so that the target large model outputs the original output data corresponding to the replaced input data that conforms to the above output rules, wherein the above output rules require the placeholders to maintain atomicity and immutability; replacing each placeholder in the original output data with the corresponding sensitive data fragment according to the above mapping relationship to obtain the final output data of the original input data.

[0005] Secondly, this application provides a sensitive information protection device, comprising: an identification module, configured to perform structured field identification and general sensitive data identification processing on the original input data according to a preset entity identification priority rule, so as to identify all sensitive data fragments; a generation module, configured to perform identifier calculation and integrity signature processing on each sensitive data fragment based on the session salt value and the server key, so as to generate a corresponding placeholder that does not contain type semantics and conforms to a fixed format requirement, and save the mapping relationship between each sensitive data fragment and its placeholder in a mapping table; a first replacement module, configured to replace each sensitive data fragment in the original input data with the corresponding placeholder according to the above mapping relationship, to obtain replaced input data, and input the above replaced input data and output rules into a target large model, so that the target large model outputs the original output data corresponding to the above replaced input data that conforms to the above output rules, wherein the above output rules require the placeholders to maintain atomicity and immutability; and a second replacement module, configured to replace each placeholder in the original output data with the corresponding sensitive data fragment according to the above mapping relationship, to obtain the final output data of the original input data.

[0006] As an optional example, the above-mentioned identification module includes: a first identification unit, used to perform structured field identification on the original input data first based on the above-mentioned entity identification priority rules, and determine the corresponding field value as a structured sensitive data fragment when the key name satisfies boundary matching and is strictly consistent with the preset field; a second identification unit, used to perform general sensitive data identification on the remaining uncovered text after completing the structured field identification, so as to identify general sensitive data fragments; and a resolution unit, used to retain only the sensitive data fragments with higher priority and larger coverage range according to the conflict resolution rules of priority priority and interval length priority when there is interval overlap or nesting between the identification results of structured field identification and the identification results of general sensitive data identification, so as to obtain a set of sensitive data fragments without duplication, overlap and ambiguity.

[0007] As an optional example, the resolution unit includes: a sorting subunit, used to sort all structured sensitive data fragments and all general sensitive data fragments according to the entity identification priority rules, to obtain a sorting result; and a processing subunit, used to determine each sensitive data fragment in the sorting result as the current sensitive data fragment in sequence, and to perform the following processing on the current sensitive data fragment: determine whether the current sensitive data fragment overlaps or is nested with the high-priority sensitive data fragments in the sorting result; if so, discard the low-priority or less covered sensitive data fragments.

[0008] As an optional example, the above-mentioned generation module includes: a first processing unit, configured to determine the unprocessed sensitive data fragment as the current sensitive data fragment, and perform the following processing on the current sensitive data fragment: using the above-mentioned session salt value and the above-mentioned server key as input, calculate the session identifier, random identifier and integrity signature of the current sensitive data fragment through a cryptographic hash algorithm; and generate a placeholder for the current sensitive data fragment by taking the above-mentioned session identifier, the above-mentioned random identifier and the above-mentioned integrity signature according to the above-mentioned fixed format requirements.

[0009] As an optional example, the above apparatus further includes: a verification module, configured to perform placeholder integrity verification on the original output data after inputting the replacement input data and output rules into the target large model so that the target large model outputs original output data corresponding to the replacement input data that conforms to the output rules; and a recording module, configured to, during the placeholder integrity verification process, if a target placeholder is detected to have failed the integrity verification, record the abnormal information of the target placeholder, and re-input the original input data, the target placeholder, and the abnormal information into the target large model so that the target large model outputs the corresponding output data again, until all placeholders in the output data pass the integrity verification, wherein the target placeholder is any one of the placeholders in the original output data.

[0010] As an optional example, the above verification module includes: a second processing unit, configured to extract all placeholders from the original output data using regular expressions, and determine the unprocessed placeholders among all placeholders in the original output data as the current placeholders, and perform the following processing on the current placeholders: if the current placeholders do not conform to the above fixed format requirements, determine that the current placeholders have failed the integrity verification; parse the current integrity signature of the current placeholders, and recalculate the verification value of the integrity signature of the current placeholders using the server key, and if the verification value is inconsistent with the current integrity signature, determine that the current placeholders have failed the integrity verification; parse the current session identifier of the current placeholders, and if the current session identifier does not belong to the allowed set of this session, determine that the current placeholders have failed the integrity verification; if the current placeholders do not exist in the above mapping table, determine that the current placeholders have failed the integrity verification.

[0011] As an optional example, the first replacement module includes a replacement unit, configured to scan the original input data item by item according to the mapping relationship between sensitive data fragments and placeholders in the above mapping table, replace each identified sensitive data fragment with its corresponding placeholder, obtain the above-mentioned replacement input data, and maintain the structure and non-sensitive data of the above-mentioned original input data unchanged during the replacement process, so that the position, order and boundary information of each placeholder in the above-mentioned replacement input data are consistent with those in the above-mentioned original input data.

[0012] Thirdly, this application provides a storage medium storing a computer program, wherein the computer program is executed by a processor to perform the aforementioned method for protecting sensitive information.

[0013] Fourthly, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the aforementioned method for protecting sensitive information through the computer program.

[0014] The technical solutions provided in this application have the following advantages compared with the prior art: This application employs a pre-defined entity recognition priority rule to perform structured field recognition and general sensitive data recognition processing on the original input data to identify all sensitive data fragments. Based on the session salt value and server key, each sensitive data fragment undergoes identifier calculation and integrity signature processing to generate a corresponding placeholder that does not contain type semantics and conforms to a fixed format requirement. The mapping relationship between each sensitive data fragment and its placeholder is saved in a mapping table. According to the above mapping relationship, each sensitive data fragment in the original input data is replaced with the corresponding placeholder to obtain replaced input data. The replaced input data and output rules are then input into the target large model so that the target large model outputs the original output data corresponding to the replaced input data that conforms to the above output rules. In this method, the output rules stipulate that placeholders must maintain atomicity and immutability. Based on the mapping relationship, each placeholder in the original output data is replaced with a corresponding sensitive data fragment to obtain the final output data of the original input data. This method accurately identifies all sensitive data fragments by performing priority-based structured field and general sensitive data identification on the original input data, combined with interval conflict resolution strategies. Subsequently, placeholders without type semantics and conforming to a fixed format are generated based on the session salt value and server key, and the sensitive data and placeholders are mapped and stored in a server-side mapping table. The original sensitive data is replaced with placeholders input into the large model, and the model output is ensured not to be tampered with through placeholder integrity verification. Finally, the placeholders are restored to the original data according to the mapping table. This achieves secure and controllable input model processing of sensitive information, improves the accuracy and security of desensitization, and solves the technical problem of easy misoperation during sensitive data desensitization. Attached Figure Description

[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0018] Figure 1 This is a flowchart of an optional method for protecting sensitive information according to an embodiment of this application; Figure 2 This is a schematic diagram of an optional sensitive information protection device according to an embodiment of this application; Figure 3 This is a schematic diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0021] According to a first aspect of the embodiments of this application, a method for protecting sensitive information is provided, optionally, such as Figure 1 As shown, the above method includes: S102, according to the preset entity recognition priority rules, perform structured field recognition and general sensitive data recognition processing on the original input data to identify all sensitive data fragments; S104, based on the session salt value and the server key, performs identification calculation and integrity signature processing on each sensitive data segment to generate a corresponding placeholder that does not contain type semantics and conforms to fixed format requirements, and saves the mapping relationship between each sensitive data segment and its placeholder in the mapping table; S106, based on the mapping relationship, replace each sensitive data segment in the original input data with the corresponding placeholder to obtain the replacement input data, and input the replacement input data and output rules into the target large model so that the target large model outputs the original output data corresponding to the replacement input data that conforms to the output rules. Among them, the output rules are placeholders and must maintain atomicity and immutability. S108, based on the mapping relationship, replace each placeholder in the original output data with the corresponding sensitive data segment to obtain the final output data of the original input data.

[0022] Optionally, in this embodiment, the aim is to effectively prevent the leakage of sensitive data such as personal sensitive information, trade secrets, and operation and maintenance keys when inputting raw business data into a large model for processing, while ensuring that the generated results are verifiable, recoverable, and traceable. Specifically, firstly, according to preset entity recognition priority rules, structured field recognition and general sensitive data recognition processing are performed on the raw input data to identify all sensitive data fragments. In this process, structured field recognition is performed first. Only when the key name strictly meets the boundary matching and is completely consistent with the preset field name is the corresponding field value determined as a structured sensitive data fragment, avoiding misidentification caused by substring matching. For example, avoiding incorrectly anonymizing UUIDs as UIDs; then, general sensitive data recognition is performed on the remaining uncovered text to detect general sensitive information such as mobile phone numbers, landline numbers, email addresses, ID card numbers, bank card numbers, addresses, device MAC addresses, and IP addresses. To address the issue of overlapping field values ​​and their sub-entities within the same text, a conflict resolution strategy based on priority and interval length is adopted. Only sensitive data fragments with higher priority and the largest coverage are retained, thereby obtaining a set of sensitive data fragments that are non-repeating, non-overlapping, and unambiguous, providing accurate input for subsequent placeholder generation.

[0023] Subsequently, based on the session salt value and the server key, each sensitive data segment undergoes identifier calculation and integrity signature processing to generate placeholders that do not contain type semantics and conform to fixed format requirements. During this process, each sensitive data segment generates a session identifier (SID), a random identifier (RID), and an integrity signature (SIG) through a cryptographic hash algorithm, and combines them according to a preset format to generate placeholders, such as a unified prefix plus a fixed-length encoded string (e.g., [[XV1+SID+RID+SIG]] or [[TKN.V1.SID.RID.SIG]]). The placeholders maintain consistency in the text and do not expose sensitive type information. The generated placeholders and their corresponding sensitive data segments, session identifiers, generation times, and other information are stored in a server-side mapping table for easy subsequent recovery and tamper detection.

[0024] After obtaining the complete placeholder mapping relationship, each sensitive data segment in the original input data is replaced with the corresponding placeholder according to the mapping table, generating replacement input data. This replacement data, along with the output rules, is then input into the target large model. The output rules explicitly require that the placeholders maintain atomicity and immutability. After the large model generates the output, a fast placeholder verification process is used for validation: First, all placeholders in the text are extracted using regular expressions, and false placeholders with non-matching formats are detected and marked as anomalies. Then, the SID, RID, and SIG of each placeholder are parsed, the signature is recalculated, and compared with the signature in the placeholder. If they do not match, they are marked as tampered with. Further verification is performed to check whether the SID conforms to the current session and allowed set, whether the placeholder exists in the mapping table, and whether the placeholder set is complete, including missing, duplicate, or newly added unknown placeholders. Once an anomaly is found, the original input data and anomaly information are resubmitted to the large model for regeneration until the placeholder integrity verification passes.

[0025] Finally, in the output results after integrity verification, all placeholders are replaced back to their corresponding original sensitive data fragments according to the mapping table, generating final output data containing real sensitive information. This ensures that the large model processing results meet business requirements without causing sensitive information leakage. This method balances the accuracy, reversibility, and security of de-identification, effectively avoiding data loss or errors caused by nested factor entities, mismatched fields, or placeholder tampering. It also supports business application scenarios such as result reconciliation, association, and personalized backfilling.

[0026] Optionally, this embodiment can enable the secure application of large models in various business scenarios while ensuring the security of sensitive information, reduce the risk of data leakage, meet compliance requirements, and improve the accuracy and verifiability of the desensitization process, providing reliable protection for enterprises and institutions in sensitive data processing and intelligent applications.

[0027] As an optional example, based on preset entity recognition priority rules, structured field recognition and general sensitive data recognition processing are performed on the original input data to identify all sensitive data fragments, including: Based on entity recognition priority rules, structured field recognition is performed on the original input data first, and the corresponding field value is determined as a structured sensitive data fragment when the key name meets the boundary matching and is strictly consistent with the preset field. After the structured field recognition is completed, general sensitive data recognition is performed on the remaining uncovered text to identify general sensitive data fragments; When there is overlap or nesting between the recognition results of structured field recognition and the recognition results of general sensitive data recognition, according to the conflict resolution rules of priority first and interval length first, only the sensitive data fragments with higher priority and larger coverage are retained to obtain a set of sensitive data fragments that are non-repeating, non-overlapping and unambiguous.

[0028] Optionally, in this embodiment, the core is to perform structured field recognition and general sensitive data recognition processing on the original input data according to a preset entity recognition priority rule, so as to accurately identify all sensitive data fragments. In specific implementation, firstly, according to the entity recognition priority rule, the structured fields in the original input data are recognized first. Only when the field key name strictly meets the boundary matching and is completely consistent with the preset sensitive field, its corresponding field value is determined as a structured sensitive data fragment. This step effectively avoids the problem of misidentification of substring matching, such as preventing the incorrect desensitization of UUID to UID, thereby ensuring the accurate identification of structured sensitive data. After completing the structured field recognition, general sensitive data recognition is performed on the remaining uncovered text to detect general sensitive information such as mobile phone number, landline number, email, ID card number, bank card number, address, device MAC address, and IP address. In actual text, there may be overlap or nesting between structured fields and general sensitive data. To prevent repeated desensitization or damage to the original data, a conflict resolution strategy of priority first and interval length first is adopted. Specifically, when the intervals of two or more candidate sensitive data segments overlap, only the segment with higher priority and larger coverage is retained, while the overlapping parts with lower priority or smaller coverage are discarded. This strategy yields a set of sensitive data segments that are non-repeating, non-overlapping, and unambiguous, providing accurate and reliable input for subsequent placeholder generation, de-identification processing, and reversible restoration. This not only improves the accuracy and controllability of sensitive information identification but also provides fundamental support for the secure use of sensitive data in large models or other data processing systems, ensuring the de-identification process is reversible and verifiable, while effectively reducing data corruption and business risks caused by misidentification or overlapping de-identification.

[0029] As an optional example, when the identification results of structured field recognition and general sensitive data recognition overlap or are nested, according to the conflict resolution rules of priority first and interval length first, only the sensitive data segments with higher priority and wider coverage are retained, including: Based on the entity recognition priority rules, all structured sensitive data fragments and all general sensitive data fragments are sorted to obtain the sorting results; Each sensitive data segment in the sorting results is identified as the current sensitive data segment in sequence, and the following processing is performed on the current sensitive data segment: Determine whether the current sensitive data segment overlaps with or is nested with higher-priority sensitive data segments in the sorting results; If it exists, discard low-priority or narrowly covered sensitive data segments.

[0030] Optionally, in this embodiment, when there is overlap or nesting between the structured field identification results and the general sensitive data identification results, the final set of sensitive data fragments is accurately determined. First, according to a preset entity identification priority rule, all identified structured sensitive data fragments and general sensitive data fragments are sorted, with higher priority fragments listed first. If priorities are the same, they are sorted in descending order by the length of the sensitive data fragment coverage interval, thus obtaining a sorted list of sensitive data. Then, each sensitive data fragment is processed sequentially according to the sorting order, identified as the current sensitive data fragment, and a conflict determination is performed on the current fragment.

[0031] Specifically, for the current sensitive data segment, it is determined whether it overlaps or is nested with previously processed sensitive data segments of higher priority or wider coverage. If overlap or nesting exists, the current segment or lower-priority, smaller-coverage sensitive data segments are discarded according to conflict resolution rules, retaining only higher-priority segments with wider coverage. This ensures that there are no duplicates, nesting, or overlapping instances in the sensitive data set. The final generated set of sensitive data segments is free of duplication, overlap, and ambiguity, providing an accurate and reliable input foundation for subsequent placeholder generation, desensitization processing, and reversible restoration.

[0032] As an optional example, based on the session salt and server key, each sensitive data fragment undergoes identifier calculation and integrity signing to generate corresponding placeholders that do not contain type semantics and conform to fixed format requirements, including: The unprocessed sensitive data segment is identified as the current sensitive data segment, and the following processing is performed on the current sensitive data segment: Using the session salt and server key as input, a cryptographic hash algorithm is used to calculate the session identifier, random identifier, and integrity signature of the current sensitive data segment. The session identifier, random identifier, and integrity signature are used to generate placeholders for the current sensitive data segment according to a fixed format requirement.

[0033] Optionally, in this embodiment, based on the session salt value and the server key, an identifier calculation and integrity signature processing are performed on each sensitive data segment to generate a placeholder that does not contain type semantics and conforms to a fixed format requirement. Specifically, for each sensitive data segment, firstly, based on the session salt value and the server key as input, a cryptographic hash algorithm (such as HMAC-SHA256) is used to calculate the session identifier (SID), random identifier (RID), and integrity signature (SIG) associated with the current sensitive data segment. The session identifier is used to distinguish different sessions, the random identifier is used to ensure the uniqueness of the placeholder, and the integrity signature is used to verify that the placeholder has not been tampered with during transmission or model processing, thereby ensuring the security and verifiability of the placeholder.

[0034] After the identifier calculation is complete, the session identifier, random identifier, and integrity signature are combined according to a unified fixed format to generate a placeholder for the current sensitive data segment. For example, a unified prefix plus fixed-length Base32 encoding can be used to concatenate the SID, RID, and SIG to form the final placeholder, making it compact and easy to read without exposing sensitive data type information. This placeholder can not only directly replace the original sensitive data input into the large model processing, but also supports reversible restoration through a server-side mapping table. The mapping table records the correspondence between each placeholder and the original sensitive data segment and session information, ensuring the accuracy and security of the subsequent recovery process. The generated placeholder has the characteristics of type blindness, verifiability, session differentiation, and tamper resistance, providing high security guarantees during sensitive information desensitization and large model processing.

[0035] As an optional example, after inputting the replacement input data and output rules into the target large model so that the target large model outputs the original output data corresponding to the replacement input data that conforms to the output rules, the above method further includes: Perform placeholder integrity verification on the original output data; During the placeholder integrity check, if the target placeholder fails the integrity check, the abnormal information of the target placeholder is recorded, and the original input data, the target placeholder and its abnormal information are re-inputted into the target large model so that the target large model outputs the corresponding output data again, until all placeholders in the output data pass the integrity check. The target placeholder is any one of the placeholders in the original output data.

[0036] Optionally, to ensure that placeholders in the model output data remain intact and untampered after the replaced input data is processed by the target large model, in this embodiment, sensitive data fragments in the original input data are first replaced with placeholders. The replaced input data and corresponding output rules are then input into the target large model to generate the original output data corresponding to the replaced input data. The output rules require that the placeholders remain atomic and unmodifiable. Subsequently, the original output data returned by the model undergoes placeholder integrity verification, including but not limited to regular expression matching of the placeholder format, parsing the session identifier (SID), random identifier (RID), and integrity signature (SIG) in the placeholders, and recalculating the signature and comparing it with the signature in the placeholders to verify whether the placeholders have been tampered with. Simultaneously, session consistency verification and mapping table consistency verification are performed to ensure that the placeholders belong to the current session and exist in the mapping table, further guaranteeing the legality and security of the output.

[0037] During placeholder integrity verification, if any target placeholder fails verification (e.g., inconsistent signatures, cross-session placeholders, or unknown placeholders), the abnormal information for that target placeholder is recorded, including the placeholder content, its corresponding position, and the reason for the verification failure. The original input data, the abnormal placeholder, and its abnormal information are then resubmitted to the target large model for further processing. This process continues in a loop until all placeholders in the output data pass integrity verification, ensuring that the replacement placeholders for sensitive information in the final generated output data are not corrupted or tampered with. This effectively guarantees that the placeholders for sensitive information remain intact throughout the large model's output process, preventing data leakage or tampering during model processing or transmission, while also supporting a traceable and verifiable security processing flow.

[0038] As an optional example, performing placeholder integrity checks on the raw output data includes: Use regular expressions to extract all placeholders from the original output data, and identify the unprocessed placeholders among all placeholders in the original output data as the current placeholders. Perform the following processing on the current placeholders: If the current placeholder does not meet the fixed format requirements, it is determined that the current placeholder has failed the integrity check. Parse the current integrity signature of the current placeholder, recalculate the check value of the integrity signature of the current placeholder using the server key, and determine that the current placeholder has failed the integrity check if the check value is inconsistent with the current integrity signature. Parse the current session identifier of the current placeholder, and if the current session identifier does not belong to the allowed set of this session, determine that the current placeholder has failed the integrity check; If the current placeholder does not exist in the mapping table, it is determined that the current placeholder has failed the integrity check.

[0039] Optionally, after the large model generates output data, to ensure that the placeholders in the output data have not been tampered with or destroyed, thereby guaranteeing the security and recoverability of sensitive information, in this embodiment, firstly, regular expressions are used to extract all placeholders in batches from the original output data, and each placeholder is determined as the current placeholder. For each current placeholder, integrity checks are performed, including format checks, signature verification, session consistency checks, and mapping table consistency checks. In the format check stage, if the current placeholder does not conform to the preset fixed format requirements, it is determined that the placeholder has failed the integrity check. Subsequently, the integrity signature contained in the current placeholder is parsed, and the verification value of the integrity signature is recalculated using the server key. If the recalculated verification value is inconsistent with the signature in the placeholder, it is also determined that the placeholder has failed the integrity check, to prevent the placeholder from being tampered with during transmission or model processing. Next, the session identifier of the current placeholder is parsed, and it is checked whether it belongs to the allowed set of this session. If it is not within the allowed range, it is determined that the placeholder has a risk of cross-session or forgery, and has failed the integrity check. Finally, the existence of the current placeholder is checked in the mapping table. If the placeholder does not exist in the mapping table, it is also determined that it has failed the integrity check, in order to prevent unknown placeholders from affecting data recovery. Through the above multi-layered verification mechanism, corrupted, tampered, or forged placeholders can be quickly identified, providing a basis for subsequent anomaly handling, such as recording placeholder anomaly information and triggering the process of regenerating output data.

[0040] As an optional example, based on the mapping relationship, each sensitive data segment in the original input data is replaced with the corresponding placeholder, resulting in the replaced input data including: Based on the mapping relationship between sensitive data fragments and placeholders in the mapping table, the original input data is scanned item by item, and each identified sensitive data fragment is replaced with its corresponding placeholder to obtain the replacement input data. During the replacement process, the structure of the original input data and non-sensitive data remain unchanged, so that the position, order and boundary information of each placeholder in the replacement input data are consistent with those in the original input data.

[0041] Optionally, in this embodiment, sensitive data in the original input data is securely replaced with placeholders before large-scale model processing, thereby ensuring data security and subsequent reversible restoration. Specifically, firstly, based on the mapping table maintained by the server, a mapping relationship is established between each sensitive data segment in the original input data and its corresponding placeholder. Subsequently, the original input data is scanned item by item, and during the scanning process, the marked sensitive data segments are identified one by one, and each sensitive data segment is replaced with its corresponding placeholder. During the replacement process, the overall structure, non-sensitive content, and text format of the original input data are maintained unchanged to ensure that the integrity of the data semantics and context is not compromised. To ensure the traceability and accuracy of the placeholders, the position, order, and boundary information of each placeholder in the replaced input data are consistent with the position of the original sensitive data in the original input data. This not only allows the large model to correctly understand the context information when processing the replaced input data, but also facilitates the accurate restoration of the placeholders to the original sensitive data with the support of the mapping table. The generation and use of placeholders follow a unified format specification to ensure that the placeholder types are blind, verifiable, and tamper-resistant, so that the replaced input data can be safely input into the large model for processing.

[0042] Optionally, this embodiment can enable large models to process input content without exposing the original sensitive data, while ensuring the security of sensitive information, and simultaneously ensuring the integrity and reversibility of the replaced placeholders in the output data. This not only reduces the risk of sensitive information leakage but also supports traceable and verifiable operations on the generated results.

[0043] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0044] According to another aspect of the embodiments of this application, a device for protecting sensitive information is also provided, such as... Figure 2 As shown, it includes: The recognition module 202 is used to perform structured field recognition and general sensitive data recognition processing on the original input data according to the preset entity recognition priority rules, so as to identify all sensitive data fragments; The generation module 204 is used to perform identification calculation and integrity signature processing on each sensitive data fragment based on the session salt value and the server key, so as to generate a corresponding placeholder that does not contain type semantics and conforms to the fixed format requirements, and save the mapping relationship between each sensitive data fragment and its placeholder to the mapping table. The first replacement module 206 is used to replace each sensitive data segment in the original input data with the corresponding placeholder according to the mapping relationship to obtain the replacement input data, and input the replacement input data and output rules into the target large model so that the target large model outputs the original output data corresponding to the replacement input data that conforms to the output rules. The output rules are placeholders and must maintain atomicity and immutability. The second replacement module 208 is used to replace each placeholder in the original output data with the corresponding sensitive data fragment according to the mapping relationship, so as to obtain the final output data of the original input data.

[0045] It should be noted that the identification module 202 in this embodiment can be used to execute step S102 in this application embodiment, the generation module 204 in this embodiment can be used to execute step S104 in this application embodiment, the first replacement module 206 in this embodiment can be used to execute step S106 in this application embodiment, and the second replacement module 208 in this embodiment can be used to execute step S108 in this application embodiment.

[0046] As an optional example, the recognition module includes: The first identification unit is used to perform structured field identification on the original input data first based on entity identification priority rules, and determine the corresponding field value as a structured sensitive data fragment when the key name meets the boundary matching and is strictly consistent with the preset field. The second identification unit is used to perform general sensitive data identification on the remaining uncovered text after the structured field identification is completed, so as to identify general sensitive data fragments. The resolution unit is used to resolve conflicts when there is overlap or nesting between the recognition results of structured field recognition and the recognition results of general sensitive data recognition. It retains only the sensitive data fragments with higher priority and larger coverage according to the conflict resolution rules of priority and interval length, so as to obtain a set of sensitive data fragments that are non-repeating, non-overlapping and unambiguous.

[0047] As an optional example, the digestion unit includes: The sorting subunit is used to sort all structured sensitive data fragments and all general sensitive data fragments according to the entity recognition priority rules, and obtain the sorting result; The processing subunit is used to determine each sensitive data segment in the sorting result as the current sensitive data segment in sequence, and perform the following processing on the current sensitive data segment: Determine whether the current sensitive data segment overlaps with or is nested with higher-priority sensitive data segments in the sorting results; If it exists, discard low-priority or narrowly covered sensitive data segments.

[0048] As an optional example, the generated modules include: The first processing unit is used to identify the unprocessed sensitive data segment as the current sensitive data segment, and perform the following processing on the current sensitive data segment: Using the session salt and server key as input, a cryptographic hash algorithm is used to calculate the session identifier, random identifier, and integrity signature of the current sensitive data segment. The session identifier, random identifier, and integrity signature are used to generate placeholders for the current sensitive data segment according to a fixed format requirement.

[0049] As an optional example, the above-described apparatus further includes: The verification module is used to verify the integrity of placeholders in the original output data after the replacement input data and output rules are input into the target large model so that the target large model outputs the original output data corresponding to the replacement input data that conforms to the output rules. The recording module is used to record the abnormal information of the target placeholder if it is detected that the target placeholder has failed the integrity check during the placeholder integrity check process. The original input data, the target placeholder and its abnormal information are then re-inputted into the target large model so that the target large model outputs the corresponding output data again, until all placeholders in the output data pass the integrity check. The target placeholder is any one of the placeholders in the original output data.

[0050] As an optional example, the verification module includes: The second processing unit is used to extract all placeholders from the original output data using regular expressions, and to determine the unprocessed placeholders among all placeholders in the original output data as the current placeholders, and to perform the following processing on the current placeholders: If the current placeholder does not meet the fixed format requirements, it is determined that the current placeholder has failed the integrity check. Parse the current integrity signature of the current placeholder, recalculate the check value of the integrity signature of the current placeholder using the server key, and determine that the current placeholder has failed the integrity check if the check value is inconsistent with the current integrity signature. Parse the current session identifier of the current placeholder, and if the current session identifier does not belong to the allowed set of this session, determine that the current placeholder has failed the integrity check; If the current placeholder does not exist in the mapping table, it is determined that the current placeholder has failed the integrity check.

[0051] As an optional example, the first replacement module includes: The replacement unit is used to scan the original input data item by item according to the mapping relationship between sensitive data fragments and placeholders in the mapping table, and replace each identified sensitive data fragment with its corresponding placeholder to obtain the replacement input data. During the replacement process, the structure of the original input data and non-sensitive data remain unchanged, so that the position, order and boundary information of each placeholder in the replacement input data are consistent with those in the original input data.

[0052] For other examples of this embodiment, please refer to the examples above, which will not be repeated here.

[0053] Figure 3 This is a schematic diagram of an optional electronic device according to an embodiment of this application, such as... Figure 3 As shown, it includes a processor 302, a communication interface 304, a memory 306, and a communication bus 308. The processor 302, communication interface 304, and memory 306 communicate with each other via the communication bus 308. Memory 306 is used to store computer programs; When processor 302 executes a computer program stored in memory 306, it performs the following steps: Based on the preset entity recognition priority rules, the original input data is processed by structured field recognition and general sensitive data recognition to identify all sensitive data fragments; Based on the session salt value and the server key, perform identifier calculation and integrity signature processing on each sensitive data fragment to generate a corresponding placeholder that does not contain type semantics and conforms to fixed format requirements, and save the mapping relationship between each sensitive data fragment and its placeholder in the mapping table; Based on the mapping relationship, each sensitive data segment in the original input data is replaced with the corresponding placeholder to obtain the replaced input data. The replaced input data and output rules are then input into the target large model so that the target large model outputs the original output data corresponding to the replaced input data that conforms to the output rules. The output rules are placeholders and must maintain atomicity and immutability. Based on the mapping relationship, each placeholder in the original output data is replaced with the corresponding sensitive data segment to obtain the final output data of the original input data.

[0054] Optionally, in this embodiment, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single thick line, but this does not indicate that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0055] The memory may include RAM, or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0056] As an example, the memory 306 described above may include, but is not limited to, the identification module 202, generation module 204, first replacement module 206, and second replacement module 208 from the aforementioned sensitive information protection device. Furthermore, it may include, but is not limited to, other module units from the aforementioned sensitive information protection device, which will not be elaborated upon in this example.

[0057] The processor mentioned above can be a general-purpose processor, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0058] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0059] Those skilled in the art will understand that Figure 3The structure shown is for illustrative purposes only. The device that implements the above-mentioned method for protecting sensitive information can be a terminal device, such as a smartphone (e.g., an Android phone, an iOS phone), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 3 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 3 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 3 The different configurations shown.

[0060] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, ROM, RAM, disk or optical disk, etc.

[0061] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, which, when executed by a processor, performs the steps in the above-described method for protecting sensitive information.

[0062] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0063] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0064] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0065] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0066] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0067] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0068] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0069] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for protecting sensitive information, characterized in that, include: Based on the preset entity recognition priority rules, the original input data is processed by structured field recognition and general sensitive data recognition to identify all sensitive data fragments; Based on the session salt value and the server key, an identifier calculation and integrity signature processing are performed on each sensitive data fragment to generate a corresponding placeholder that does not contain type semantics and conforms to fixed format requirements. The mapping relationship between each sensitive data fragment and its placeholder is then saved in a mapping table. According to the mapping relationship, each sensitive data segment in the original input data is replaced with a corresponding placeholder to obtain the replaced input data. The replaced input data and the output rules are then input into the target large model so that the target large model outputs the original output data corresponding to the replaced input data that conforms to the output rules. The output rules are placeholders that need to maintain atomicity and immutability. Based on the mapping relationship, each placeholder in the original output data is replaced with the corresponding sensitive data segment to obtain the final output data of the original input data.

2. The method according to claim 1, characterized in that, Based on preset entity recognition priority rules, structured field recognition and general sensitive data recognition processing are performed on the original input data to identify all sensitive data fragments, including: Based on the entity recognition priority rules, the original input data is preferentially subjected to structured field recognition, and if the key name satisfies the boundary matching and is strictly consistent with the preset field, the corresponding field value is determined as a structured sensitive data fragment. After the structured field recognition is completed, general sensitive data recognition is performed on the remaining uncovered text to identify general sensitive data fragments; When there is overlap or nesting between the recognition results of structured field recognition and the recognition results of general sensitive data recognition, according to the conflict resolution rules of priority first and interval length first, only the sensitive data fragments with higher priority and larger coverage are retained to obtain a set of sensitive data fragments that are non-repeating, non-overlapping and unambiguous.

3. The method according to claim 2, characterized in that, When the identification results of structured field recognition and general sensitive data recognition overlap or are nested, according to the conflict resolution rules of priority first and interval length first, only sensitive data segments with higher priority and wider coverage are retained, including: Based on the entity recognition priority rules, all structured sensitive data fragments and all general sensitive data fragments are sorted to obtain the sorting results; Each sensitive data segment in the sorting results is identified as the current sensitive data segment in sequence, and the following processing is performed on the current sensitive data segment: Determine whether the current sensitive data segment overlaps with or is nested with a high-priority sensitive data segment in the sorting result; If it exists, discard low-priority or narrowly covered sensitive data segments.

4. The method according to claim 1, characterized in that, Based on the session salt and server key, each sensitive data segment undergoes identifier calculation and integrity signature processing to generate corresponding placeholders that do not contain type semantics and conform to fixed format requirements, including: The unprocessed sensitive data segment is identified as the current sensitive data segment, and the following processing is performed on the current sensitive data segment: Using the session salt value and the server key as input, the session identifier, random identifier, and integrity signature of the current sensitive data fragment are calculated through a cryptographic hash algorithm; The session identifier, the random identifier, and the integrity signature are used to generate a placeholder for the current sensitive data segment according to the fixed format requirements.

5. The method according to claim 1, characterized in that, After inputting the replacement input data and output rules into the target large model so that the target large model outputs the original output data corresponding to the replacement input data that conforms to the output rules, the method further includes: Perform placeholder integrity verification on the original output data; During the placeholder integrity check, if a target placeholder fails the integrity check, the abnormal information of the target placeholder is recorded, and the original input data, the target placeholder, and its abnormal information are re-inputted into the target large model so that the target large model outputs the corresponding output data again, until all placeholders in the output data pass the integrity check, wherein the target placeholder is any one of the placeholders in the original output data.

6. The method according to claim 5, characterized in that, The placeholder integrity check for the original output data includes: All placeholders in the original output data are extracted using regular expressions. Unprocessed placeholders in the original output data are identified as the current placeholders, and the following processing is performed on these current placeholders: If the current placeholder does not conform to the fixed format requirements, it is determined that the current placeholder has failed the integrity check. The current integrity signature of the current placeholder is parsed, and the verification value of the integrity signature of the current placeholder is recalculated using the server key. If the verification value is inconsistent with the current integrity signature, it is determined that the current placeholder has failed the integrity check. The current session identifier of the current placeholder is parsed, and if the current session identifier does not belong to the allowed set of this session, it is determined that the current placeholder has failed the integrity check; If the current placeholder does not exist in the mapping table, it is determined that the current placeholder has failed the integrity check.

7. The method according to claim 1, characterized in that, Based on the mapping relationship, each sensitive data segment in the original input data is replaced with a corresponding placeholder to obtain the replaced input data, including: Based on the mapping relationship between sensitive data segments and placeholders in the mapping table, the original input data is scanned item by item, and each identified sensitive data segment is replaced with its corresponding placeholder to obtain the replacement input data. During the replacement process, the structure and non-sensitive data of the original input data are kept unchanged so that the position, order and boundary information of each placeholder in the replacement input data are consistent with those in the original input data.

8. A device for protecting sensitive information, characterized in that, include: The recognition module is used to perform structured field recognition and general sensitive data recognition processing on the original input data according to the preset entity recognition priority rules, so as to identify all sensitive data fragments; The generation module is used to perform identifier calculation and integrity signature processing on each sensitive data fragment based on the session salt value and the server key, so as to generate a corresponding placeholder that does not contain type semantics and conforms to fixed format requirements, and save the mapping relationship between each sensitive data fragment and its placeholder to the mapping table. The first replacement module is used to replace each sensitive data segment in the original input data with a corresponding placeholder according to the mapping relationship to obtain replacement input data, and input the replacement input data and output rules into the target large model so that the target large model outputs the original output data corresponding to the replacement input data that conforms to the output rules, wherein the output rules are placeholders that need to maintain atomicity and immutability; The second replacement module is used to replace each placeholder in the original output data with the corresponding sensitive data fragment according to the mapping relationship, so as to obtain the final output data of the original input data.

9. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to perform the method described in any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 7 through the computer program.

Citation Information

Cited By

  • Proxy-based endpoint trust monitoring and data protection method and system for large model compatible interface

    CN122293308A

  • Proxy-based endpoint trust monitoring and data protection method and system for large model compatible interface

    CN122293308B