-
Notifications
You must be signed in to change notification settings - Fork 87
Description
git support
Hello, i wanted to ask about support for git for multiaddress.
Something like this:
/git/5a179104a6f9e9a2c95562496c88bf514871a1d3
multiaddr would point to a commit at this repository: 5a17910 .
a client would receive the fetched data as a git repository, and even can verify the sha-1 or sha-256 of the repository.
A server implementation would require either one of those solutions
- brute force through all his stored repositories to find this hash.
- hold mapping information between commit hashes and repositories for faster lookups.
- store all git repositories within one merkle tree (?? i don't know enough details about this if this is possible and benefits the most - especially de-duplication ?!)
The Server would then either respond with the verifiable content, or with Not Found.
A P2P extension would be possible.
Security: Sha-256 vs Sha1
Since Sha1 (20 byte) is considered vulnerable and sha-256 (32 byte) is considered to be much more secure, Sha-256 seems the way to go.
Further Informations
- https://git-scm.com/docs/hash-function-transition/
- https://devclass.com/2023/08/22/git-2-42-released-sha-256-repositories-no-longer-an-experimental-curiosity/
But the reality is, that sha-1 is used in most repositories, therefore sha-1 would be required for compatibility support.
Every concern about backward compatibility would be gone, if Github and Co. would manage either go into the direction of dual hashing, or SHA-1 fades out as deprecated - but we know from other tech: this will take years...
sha-1 backward compatibility with sha-256 security extension.
the address scheme could get extended so sacrifice additional 32 bytes for delivering the sha-256 hash
i don't know exactly about the chaining rules of multiaddr, but it could look something like this:
/git/5a179104a6f9e9a2c95562496c88bf514871a1d3/123456789012345678901234567890123456789012345678901234567890abcd
(the provided hash in this example is incorrect, grateful if someone can provide the correct hash)
If you have a trusted platform that knows about the repository you want to secure,
it is possible to provide mappings for this in a multiaddr way.
Compatibility mapping for git: /git-sha1-sha256/5a179104a6f9e9a2c95562496c88bf514871a1d3 would result into a hash that could also be used for the /git/ addressing.
this concept could also support other secure hash functions, but with sha-256 it's a step towards the general adoption of sha-256.
Also it is flexible extendable for other ciphers. example; sha3 with 512 bit security: /git-sha1-sha3_512/5a179104a6f9e9a2c95562496c88bf514871a1d3
Mapping for IPFS Content Address that provides this repository: /git-ipfs/5a179104a6f9e9a2c95562496c88bf514871a1d3