Privacy-Preserving Redaction of Diagnosis Data through Source Code Analysis

Lixi Zhou, Lei Yu, Jia Zou, Hong Min

Abstract

Protecting sensitive information in diagnostic data, such as logs, is a critical concern in industrial software diagnosis and debugging. While automated tools exist to identify and remove sensitive information, they often suffer from over-redaction (loss of critical diagnostic data) or disclosure (failure to redact sensitive data). This paper proposes a source-code analysis approach for log redaction. By locating log statements in the source code via logger augmentation and tracing data flow through a Data Flow Graph (DFG), the system identifies sensitive data sources and applies appropriate redaction rules. Experimental results show significant improvements in precision and a reduction in both false positives and negatives compared to industry baselines.

Introduction: The Context Gap in Log Redaction

Diagnostic logs are indispensable for debugging complex systems but frequently leak Personally Identifiable Information (PII) or Protected Health Information (PHI). Existing redaction methods typically rely on rule-based regex or machine learning. Rule-based systems are rigid and easily bypassed, while ML models often lack the context to distinguish between sensitive and non-sensitive data.

This "context gap" is the primary hurdle. For instance, a rule-based system might redact every email address, even if an administrator's email is vital for an audit log. Conversely, it might miss a customer's email if it doesn't match a standard pattern. Existing tools fail because they analyze log text in isolation, ignoring the logic that generated it.

Methodology: Source-Code-Based Redaction Framework

The proposed framework bridges the gap between log files and application logic by treating the source code as the ground truth for data provenance.

System architecture for source-code-based log redaction.

The framework consists of three primary components:

  1. Scanner and Parser: This module utilizes tree-sitter to parse the application and its dependencies into an Abstract Syntax Tree (AST). It then constructs function-level Data Flow Graphs (DFGs) that map the movement of data from input arguments to logging statements.
  2. DFG Repository: To maintain scalability, DFGs are stored as indexed key-value pairs. This modular approach allows the system to query specific function flows on-demand rather than traversing a monolithic graph of the entire codebase.
  3. Log Analyzer and Redactor: Using logger code augmentation, the system configures the logger to output the file and line number for every log entry. The redactor uses this metadata to locate the corresponding code, back-trace the DFG to the data's origin, and determine if the source is "sensitive" based on expert-defined labels.

Experimental Evaluation

The framework was evaluated against three open-source machine learning applications: Telco Churn Prediction, Customer Segmentation, and Fraud Detection. Performance was compared against industry standards: Google Cloud Data Loss Prevention (DLP), Amazon Macie, and Microsoft Presidio.

Comparison of precision and recall across different redaction methods.

The results demonstrate that the source-code analysis approach significantly outperforms existing cloud-provider tools. Notably, the proposed method achieved 100% precision across all datasets. In contrast, Microsoft Presidio's precision dropped as low as 6.3% in the Fraud Detection task, indicating massive over-redaction of non-sensitive information. The method also maintained near-perfect recall, ensuring sensitive data was consistently identified.

Insights and Limitations

The core strength of this approach is Precision via Provenance. By tracing a variable back to its source (e.g., a database column labeled SSN), the system avoids false positives, such as redacting a 9-digit serial number that merely resembles a social security number.

However, the method has limitations:

  • Source Code Access: It requires access to the application's source code, making it unsuitable for "black-box" third-party binaries.
  • Static Analysis Challenges: Dynamic code features like reflection or complex dynamic dispatch can obscure data flow paths.
  • Manual Labeling: While tracing is automated, domain experts must still initially label sensitive data sources (e.g., specific API endpoints).

Conclusion

By leveraging source code as the definitive source of data provenance, this framework provides a highly precise solution for log redaction. It effectively eliminates the trade-off between privacy and diagnostic utility, ensuring that sensitive information is protected without stripping away the context necessary for debugging.

Summary updated

Abstract

Protecting sensitive information in diagnostic data such as logs, is a critical concern in the industrial software diagnosis and debugging process. While there are many tools developed to automatically redact the logs for identifying and removing sensitive information, they have severe limitations which can cause either over redaction and loss of critical diagnostic information (false positives), or disclosure of sensitive information (false negatives), or both. To address the problem, in this paper, we argue for a source code analysis approach for log redaction. To identify a log message containing sensitive information, our method locates the corresponding log statement in the source code with logger code augmentation, and checks if the log statement outputs data from sensitive sources by using the data flow graph built from the source code. Appropriate redaction rules are further applied depending on the sensitiveness of the data sources to preserve the privacy information in the logs. We conducted experimental evaluation and comparison with other popular baselines. The results demonstrate that our approach can significantly improve the detection precision of the sensitive information and reduce both false positives and negatives.
BibTeX
@inproceedings{zhou2023privacy,
  author = {Lixi Zhou and Lei Yu and Jia Zou and Hong Min},
  title = {{Privacy-Preserving Redaction of Diagnosis Data through Source Code Analysis}},
  booktitle = {Ssdbm},
  year = {2023},
  doi = {10.1145/3603719.3603734},
}
Figure