The invention provides a secret leakage early warning method and device in a writing process, and belongs to the technical field of
data security. The method comprises the following steps: modeling sensitive information to be protected, generating encrypted sensitive features by using a
homomorphic encryption technology, and constructing a sensitive feature
fingerprint database; capturing a
text stream in real time in a writing process of a user, and performing semantic analysis on the
text stream by using a large
language model to extract text features; in the
encryption domain, the text features and
encryption sensitive features in a sensitive feature
fingerprint database are compared and calculated, so that the leakage
risk level is evaluated; and when the
risk level exceeds a preset threshold value, sending a real-time risk prompt. The invention also provides a device for realizing the method. According to the method, the risk analysis is carried out in the
encryption domain, so that the risk of secondary leakage is fundamentally eliminated, and the data privacy security is enhanced; meanwhile, the
text stream is analyzed in real time, so that active intervention can be performed at the moment when a secret divulging behavior occurs, and pre-defense is realized; and the semantic comprehension capability of the large
language model is combined, so that the detection accuracy is improved.