Storage internals: UUID

Daniel Carrera dcarrera at hush.com
Tue Jun 12 11:06:48 UTC 2012



On Tuesday, June 12, 2012 at 2:39 AM, Mark Grandi <markgrandi at gmail.com> wrote:
>
> Does each revision store the parent revision's sha1 value? Cause it seems
> looking at bzr testament --long, it only stores the sha1 values of each file at that
> revision, the parent's revision id, and then all of that is used to compute that
> revision's sha1 value. But say, a malicious attacker (like the attack on
> kernel.org's servers not too long ago) tries to maliciously edit a file in a bazaar
> repo. If they edit a file, then that won't necessarily be caught , because it seems
> the testament is computed every time (not saved anywhere),  and it doesn't look
> like its saved in the child revision either, so there is no guarantee that the sha1 value
> of any revision is the correct value. Am i right in thinking this? I'm kinda interested
> in the security of a repo too, and seeing if you can verify that each revision is indeed intact by
> tracing back  the testaments from the head to the null revision. 
> ~mark

The issue is not so much whether you store the SHA1 values or whether you include the parents revision too. This can be hacked too. If an attacker has access to the server he could rewrite the file with the stored SHA1 values (in the proposed case for Bzr) or it could replace a revision and re-apply all the subsequent hashes (in the case of Hg / Git) or it could just add a new patch on top (again, Hg / Git). The only thing that makes these methods secure is one of the following:

1. You could obtain the correct SHA1 from a third party... a trusted source, physically separate from the main server. For example, you could verify the copy on the server against the one on your computer (and the SHA1 makes this very easy and reliable).

2. Alternatively, you could sign all your revisions with GPG, or maybe just the releases and publish the signatures on the same server. An attacker will not be able to replicate the signatures. If people check the signatures you are fine... A slight variation of this is Monotone, which makes you always sign your revisions but they don't use GPG as an external dependency. Monotone has implemented signatures on its own.

Cheers,
Daniel.




More information about the bazaar mailing list