Harpocrates: A Statically Typed Privacy Conscious Programming Framework

Sinan Pehlivanoglu,Malte Schwarzkopf
2024-11-21
Abstract:In this paper, we introduce Harpocrates, a compiler plugin and a framework pair for Scala that binds the privacy policies to the data during data creation in form of oblivious membranes. Harpocrates eliminates raw data for a policy protected type from the application, ensuring it can only exist in protected form and centralizes the policy checking to the policy declaration site, making the privacy logic easy to maintain and verify. Instead of approaching privacy from an information flow verification perspective, Harpocrates allow the data to flow freely throughout the application, inside the policy membranes but enforces the policies when the data is tried to be accessed, mutated, declassified or passed through the application boundary. The centralization of the policies allow the maintainers to change the enforced logic simply by updating a single function while keeping the rest of the application oblivious to the change. Especially in a setting where the data definition is shared by multiple applications, the publisher can update the policies without requiring the dependent applications to make any changes beyond updating the dependency version.
Cryptography and Security,Systems and Control
What problem does this paper attempt to address?
### What problem does this paper attempt to solve? This paper aims to solve the complexity and error - proneness of user data privacy protection in modern web applications. With the popularization of the Internet in daily life, a large amount of sensitive user data is transmitted through servers. This data may involve personal privacy, such as medical records, financial information, etc. In recent years, laws and regulations (such as GDPR) require users to be able to control how their data is used and shared, which makes privacy logic more complex, especially in large - scale applications. Specifically, this paper proposes a new framework named Harpocrates to address the following challenges: 1. **Complexity of dynamic privacy logic**: - In large - scale applications, the privacy logic surrounding user data can be very complex, making it difficult to understand and maintain. - Privacy regulations (such as GDPR) are constantly changing and require frequent updates to privacy logic. 2. **Risk of privacy leakage in distributed data processing**: - User data flows among multiple applications, increasing the risk of unintentional data leakage. - Data licensing agreements (such as advertising partnerships) make user data pass between different applications, increasing the management difficulty. 3. **Limitations of existing solutions**: - When using traditional methods such as monad, developers still need to manually promote data into the privacy monad, which is error - prone. - Static information flow control (IFC) methods require developers to provide precise annotations at compile time, increasing the development burden and being unable to handle dynamic policies. - Although dynamic IFC methods reduce the need for compile - time labels, they still lack support for concurrent operations of external systems. - Contract mechanisms (such as Racket's chaperones and imposters) provide flexible privacy protection but require a large amount of code refactoring, increasing the development workload. ### Main contributions of Harpocrates To solve the above problems, Harpocrates proposes the following innovations: - **Static - type privacy - aware programming framework**: Harpocrates is a Scala compiler plugin and framework. It ensures that data is always in a protected state by binding privacy policies when data is created. - **Centralized policy checking**: Harpocrates centralizes privacy policy checking to the policy declaration location, simplifying the maintenance and verification process. Policy changes only require updating a single function without modifying the entire application. - **Oblivious Membranes**: Developers can write familiar Scala code in the existing ecosystem and use their favorite libraries without changing external code. Through a special Policy mix - in, the constructor only allows creating instances under policy - protected status, thus eliminating the possibility of the original unprotected form. - **Automatic policy injection**: The compiler inserts flexible and context - related policy checks when data leaves the application and needs to be de - classified. In conclusion, Harpocrates provides a more reliable and easy - to - maintain privacy protection mechanism through the static - type system and compiler plugin, especially suitable for the complex and constantly changing privacy regulation environment.