Re: [PATCH 15/18] the beginning of the signed push

2014-08-20 Thread Bert Wesarg
On Wed, Aug 20, 2014 at 12:06 AM, Junio C Hamano gits...@pobox.com wrote:
 The basic flow based on this mechanism goes like this:

  1. You push out your work with git push -s.

  2. The sending side learns where the remote refs are as usual,
 together with what protocol extension the receiving end
 supports.  If the receiving end does not advertise the protocol
 extension push-cert, the sending side falls back to the normal
 push that is not signed.


Is this fallback silently? If so I think it would be better to abort
the push, if the receiver does not support this but the user requested
it.

Bert
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 15/18] the beginning of the signed push

2014-08-20 Thread Junio C Hamano
Bert Wesarg bert.wes...@googlemail.com writes:

 On Wed, Aug 20, 2014 at 12:06 AM, Junio C Hamano gits...@pobox.com wrote:
 The basic flow based on this mechanism goes like this:

  1. You push out your work with git push -s.

  2. The sending side learns where the remote refs are as usual,
 together with what protocol extension the receiving end
 supports.  If the receiving end does not advertise the protocol
 extension push-cert, the sending side falls back to the normal
 push that is not signed.


 Is this fallback silently? If so I think it would be better to abort
 the push, if the receiver does not support this but the user requested
 it.

Let me change it in the reroll.  I however am not quite sure if
warning is insufficient, because there is nothing, other than
rerunning the command without --signed, that the user could do
when it happens.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/18] the beginning of the signed push

2014-08-19 Thread Junio C Hamano
While signed tags and commits assert that the objects thusly signed
came from you, who signed these objects, there is not a good way to
assert that you wanted to have a particular object at the tip of a
particular branch.  My signing v2.0.1 tag only means I want to call
the version v2.0.1, and it does not mean I want to push it out to my
'master' branch---it is likely that I only want it in 'maint'.

Introduce a mechanism that allows you to sign a push certificate
(for the lack of better name) every time you push, asserting that
what object you are pushing to update which ref that used to point
at what other object.  Think of it as a cryptographic protection for
ref updates, similar to signed tags/commits but working on an
orthogonal axis.

The basic flow based on this mechanism goes like this:

 1. You push out your work with git push -s.

 2. The sending side learns where the remote refs are as usual,
together with what protocol extension the receiving end
supports.  If the receiving end does not advertise the protocol
extension push-cert, the sending side falls back to the normal
push that is not signed.

Otherwise, a text file, that looks like the following, is
prepared in core:

certificate version 0.1
pusher Junio C Hamano gits...@pobox.com 1315427886 -0700

7339ca65... 21580ecb... refs/heads/master
3793ac56... 12850bec... refs/heads/next

Each line shows the old and the new object name at the tip of
the ref this push tries to update, in the way identical to how
the underlying git push protocol exchange tells the ref
updates to the receiving end (by recording the old object
name, the push certificate also protects against replaying).  It
is expected that new command packet types other than the
old-new-refname kind will be included in push certificate in the
same way as would appear in the plain vanilla command packets in
unsigned pushes.

The user then is asked to sign this push certificate using GPG,
formatted in a way similar to how signed tag objects are signed,
and the result is sent to the other side (i.e. receive-pack).

In the protocol exchange, this step comes immediately before the
sender tells what the result of the push should be, which in
turn comes before it sends the pack data.

 3. When the receiving end sees a push certificate, the certificate
is written out as a blob.  The pre-receive hook can learn about
the certificate by checking GIT_PUSH_CERT environment variable,
which, if present, tells the object name of this blob, and make
the decision to allow or reject this push.  Additionally, the
post-receive hook can also look at the certificate, which may be
a good place to log all the received certificates for later
audits.

Because a push certificate carry the same information as the usual
command packets in the protocol exchange, we can omit the latter
when a push certificate is in use and reduce the protocol overhead.
This however is not included in this patch to make it easier to
review (in other words, the series at this step should never be
released without the remainder of the series, as it implements an
interim protocol that will be incompatible with the final one,
merely for reviewing purposes).  As such, the documentation update
for the protocol is left out of this step.

Signed-off-by: Junio C Hamano gits...@pobox.com
---
 Documentation/git-push.txt |  9 +-
 Documentation/git-receive-pack.txt | 16 -
 builtin/push.c |  1 +
 builtin/receive-pack.c | 43 -
 send-pack.c| 66 ++
 send-pack.h|  1 +
 t/t5534-push-signed.sh | 63 
 transport.c|  4 +++
 transport.h|  5 +++
 9 files changed, 205 insertions(+), 3 deletions(-)
 create mode 100755 t/t5534-push-signed.sh

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 21cd455..21b3f29 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -10,7 +10,8 @@ SYNOPSIS
 
 [verse]
 'git push' [--all | --mirror | --tags] [--follow-tags] [-n | --dry-run] 
[--receive-pack=git-receive-pack]
-  [--repo=repository] [-f | --force] [--prune] [-v | --verbose] [-u 
| --set-upstream]
+  [--repo=repository] [-f | --force] [--prune] [-v | --verbose]
+  [-u | --set-upstream] [--signed]
   [--force-with-lease[=refname[:expect]]]
   [--no-verify] [repository [refspec...]]
 
@@ -129,6 +130,12 @@ already exists on the remote side.
from the remote but are pointing at commit-ish that are
reachable from the refs being pushed.
 
+--signed::
+   GPG-sign the push request to update refs on the receiving
+   side, to allow it to be checked by the hooks and/or be

Re: [PATCH 15/18] the beginning of the signed push

2014-08-19 Thread brian m. carlson
On Tue, Aug 19, 2014 at 03:06:24PM -0700, Junio C Hamano wrote:
 While signed tags and commits assert that the objects thusly signed
 came from you, who signed these objects, there is not a good way to
 assert that you wanted to have a particular object at the tip of a
 particular branch.  My signing v2.0.1 tag only means I want to call
 the version v2.0.1, and it does not mean I want to push it out to my
 'master' branch---it is likely that I only want it in 'maint'.
 
 Introduce a mechanism that allows you to sign a push certificate
 (for the lack of better name) every time you push, asserting that
 what object you are pushing to update which ref that used to point
 at what other object.  Think of it as a cryptographic protection for
 ref updates, similar to signed tags/commits but working on an
 orthogonal axis.
 
 The basic flow based on this mechanism goes like this:
 
  1. You push out your work with git push -s.

You wrote git push -s, but the command below only seems to understand
--signed, not -s.  It should probably be consistent.

 diff --git a/builtin/push.c b/builtin/push.c
 index f50e3d5..ae56f73 100644
 --- a/builtin/push.c
 +++ b/builtin/push.c
 @@ -506,6 +506,7 @@ int cmd_push(int argc, const char **argv, const char 
 *prefix)
   OPT_BIT(0, no-verify, flags, N_(bypass pre-push hook), 
 TRANSPORT_PUSH_NO_HOOK),
   OPT_BIT(0, follow-tags, flags, N_(push missing but relevant 
 tags),
   TRANSPORT_PUSH_FOLLOW_TAGS),
 + OPT_BIT(0, signed, flags, N_(GPG sign the push), 
 TRANSPORT_PUSH_CERT),
   OPT_END()
   };
  
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187


signature.asc
Description: Digital signature