Tamperproofing
Learn about Tamperproofing
Tamperproofing is a key feature of the Secure Audit Log Service. The goal of the tamperproofing feature is to provide proof of the following:
- Events sent to the Secure Audit Log service are intact and have not been modified, altered, or otherwise changed en route or at rest.
- The entire Audit Log is untampered - no historical events have been deleted, and no new events have been backdated or inserted into the log history.
The Tamperproofing feature uses Merkle Trees to track every event that is sent to the Pangea Secure Audit Log Service. Merkle Trees have been used for decades, more recently as the basis of many blockchain implementations. They provide an efficient method of verifying that data belongs to a specified data set.
Create tamperproof log events
To create a tamperproof log event:
- Canonicalize the event JSON.
- Sign the canonicalized event. [Optional]
- Add the event to the audit log.
- Publish a new root hash.
Event canonicalization
When a log event is sent to Secure Audit Log, the event JSON must first be canonicalized. By default, JSON does not guarantee order or consistent representation of the data it contains. This presents challenges to cryptographic operations like hashing to validate data consistency. Hashing non-canonicalized JSON could result in a different hash being generated each time a different ordering, spacing, and so on., is returned. This makes JSON's default behavior unsuitable for consistency validation via a calculated hash. To resolve this problem JSON Canonicalization Scheme (JCS) was developed. JCS defines a scheme for consistently storing and recalling JSON data, which is why all audit events are canonicalized before being hashed and added to the Merkle Tree.
When using the /log endpoint, the verbose mode can be used to see the canonicalized JSON that the Audit service uses to generate an event hash.
Additionally, the SDK includes a method to canonicalize the event data on the client side. This can be useful for validating that the canonicalized JSON that was hashed matches what was originally sent.
Sign the canonicalized event [Optional]
Event signing is a process that uses public key cryptography to sign an event envelope digitally. The event envelope contains all of the event's details supplied to the API - everything in the event
dictionary. When digitally signing an event, a public and private key pair must be generated. The private key is used to sign a hash of the canonicalized JSON event digitally. The public key is supplied with each signed event so that it can be retrieved and used to verify the integrity and authenticity of the event upon event retrieval.
Add the event to the Audit Log
When events are added to the Audit Log, a new root hash is not immediately published to the immutable ledger. During this interim period, the unpublished root hashes can be supplied to the /log
endpoint's prev_root
parameter so their tamperproof status may be verified (see validate the consistency proof). After an hour or 10,000 events (whichever comes first), a new root hash will be published to the immutable public ledger on ARweave.
Publish a new root hash
After one hour or 10,000 events (whichever comes first) a new root hash and consistency proof are published to Arweave. Arweave is an immutable public block weave that Pangea uses as a public repository of all historical root hashes.
The data published to Arweave is represented as follows:
{
"published_at: <timestamp>,
"root_hash": <root_hash>,
"size": 3,
"consistency_proof": [
"x: <node_hash>,r: <proof_hash>"
]
}
Pangea also keeps a local copy of all published root hashes and consistency proofs as backup.
Publish to Arweave
To guarantee that logs are tamperproof, root hashes must be published to an immutable third party with a verifiable history. This allows customers to have evidence that Pangea's root hash has not been recalculated to compensate for any modified or missing audit data.