Last year the Open Data Center Alliance published an excellent whitepaper that defined the concept of “cloud-aware” applications. The ODCA paper sets forth the following recommendations:
- Everything is a Service
- Use RESTful APIs
- Separate Compute and Persistence
- Design for Failure
- Architect for Resilience
- Operationalize Everything
- Security at Every Layer
I will likely revisit these concepts in future posts, but in this post I want to highlight how our multi-datacenter tokenization function can help to build PCI-compliant applications that are cloud-aware, hitting points 4, 5, and 7 above.
What is Tokenization?
For the uninitiated, tokenization is the process that removes personally-identifiable information (PII) or any PAN (primary account number) from a record, replacing it with an encrypted, randomized, or hashed object (or “token”) that represents the PII. The token-to-PII mapping is stored in a separate, highly-secured database, which has the added benefit of simplifying the audit process for the custodian of the data. The token itself is meaningless, requiring a detokenization function to extract the original, cleartext data.
A token is therefore only usable in limited contexts, compartmentalizing risk if it is compromised. In layman’s terms, if someone steals my credit card number they can use it to make purchases anywhere until the card is canceled, but if they get the token that represents my credit card then the data is useless. Tokenization is a best practice used to protect credit card numbers, social security numbers, and even names and addresses (for example in Personal Health Records). It provides added security at the data layer, ensuring that customer data remains secure even if a transaction database is compromised. Tokenization also has unique applications for PCI compliance. Aside from security, tokenized credit card numbers enjoy reduced PCI scope in most cases, driving down business costs.
There are many reasons for an application to span data centers. The most common reasons are to improve availability and performance (I touched on elastic scaling of APIs in an earlier blog). Also, multiple datacenters are often an outgrowth of business expansion as traditional organizations grow into new business models utilizing public, private or hybrid clouds.
To improve availability, many applications are deployed to different availability zones within a region. This allows multiple instances of an application (or API) to run in parallel, with the ability to route around failures all the way up to the data center level (design for failure; architect for resilience). Performance can be improved by adding additional regions (for example, east coast and west coast) to reduce latency between the user and the application.
There may also be business process drivers for multiple data centers. Consider, for example, a retailer with a both online and brick-and-mortar businesses. These two channels may be run from different data centers, headquartered in different cities. However, customer satisfaction depends on being able to buy an item online and return or exchange it in store, and may even support in-store purchases being returned via the online channel. This requires transaction information to be visible to both channels. While this could be handled by calling out to the other channel’s API, the best customer experience will be delivered by recognizing a customer as a single entity across both channels, regardless of where that customer originated. To do this, the retailer may have a single customer database that spans its brick & mortar and online data centers.
Since tokens uniquely identify data, it is critical that there is a one-to-one mapping between the tokens and the data they represent. This effectively requires all participating data centers to agree upon roles for the tokenization process. This would seem to be at odds with the eventual consistency model I described earlier in this post. However, the importance of avoiding collisions or duplications in the tokenization process dictates that this state be shared and carefully coordinated across all sites with adequate performance and resiliency in the face of datacenter downtime.
Our approach relies on a combination of PAN partitioning and a distributed secure vault.
When a new request comes in, we route the request to the appropriate data center based on the PAN range. The authoritative DC computes the token, returns it (via API), and stores the result in our distributed secure vault. Subsequent references of the token can then be performed at any data center, once the secure vault synchronizes state, which happens nearly instantly (modulo network latency). On the off chance that the application attempts a read-after-write (i.e. detokenization request a few milliseconds after the tokenization request), it is possible that the secure vault will not yet be in sync – anticipating that, we will retry a failed request at the authoritative DC for the token.
By managing this shared token state independently of the application, the developer can treat the tokenization process as a black box. Data can be tokenized from nearly any source over any protocol and PAN data is extracted using common regular expressions or XPath at the application level. No SDKs or application changes are needed. The persistence state is effectively decoupled from compute, and the application’s business logic can be written as if it were a stateless app. This reduces overhead that goes along with planning and testing for collisions, race conditions, and other corner cases, allowing the developer to spend more time focusing on their core business logic.
Multi-DC tokenization is a good use of the facade proxy pattern for API security. Like our touchless Hadoop security, it allows an application to be secured without being modified. APIs run in the cloud (for that matter, APIs run the cloud) — and thus they need to be cloud-aware. Building all of that support into each application requires significant effort. The proxy façade pattern allows developers to focus on their core business – the differentiating features – rather than investing time creating and maintaining non-differentiating capabilities.