Почему требуется Git подписывать нажатие? - программирование

Почему требуется Git подписывать нажатие?

В примечаниях к выпуску Git 2.2.0 описывается новая опция git push, --signed:

"git push" learned "--signed" push, that allows a push (i.e.
request to update the refs on the other side to point at a new
history, together with the transmission of necessary objects) to be
signed, so that it can be verified and audited, using the GPG
signature of the person who pushed, that the tips of branches at a
public repository really point the commits the pusher wanted to,
without having to "trust" the server.

Таким образом, похоже, что данные, отправляемые на сервер во время нажатия, подписываются так, что сервер может проверить и зарегистрировать, кто нажал кнопку. На страницах man вы можете подтвердить это:

--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 logged. See 
   git-receive-pack[1] for the details on the receiving end.

Вы просматриваете страницы man для git-receive-pack под pre-receive и post-recieve крючками, чтобы точно увидеть, как проверить подписанный push.

Кажется, что все это помогает серверу проверить, кто именно делает то, что они говорят.

Как git push --signed помогает вам (толкателю) не "доверять" серверу? Все, что я видел до сих пор, похоже, указывает, что оно помогает серверу доверять вам. Что еще более важно, Почему подписываются коммиты и подписанные теги, которые недостаточно для того, чтобы нажать на ненадежный сервер? Почему нам даже нужны подписанные нажатия?

4b9b3361

Ответ 1

Вот отрывок из сообщения commit, в котором введены подписанные нажатия:

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', so
the signature on the object alone is insufficient.

The only assurance to you that 'maint' points at what I wanted to
place there comes from your trust on the hosting site and my
authentication with it, which cannot easily audited later.

Итак, несмотря на то, что фиксация подписана, вы не можете быть уверены, что автор предполагал, что фиксация будет перенесена в ветвь master или в ветвь super-experimental-feature. Подписанные нажатия позволяют серверу хранить запись каждого события push и его подписи. Затем этот журнал можно проверить, чтобы убедиться, что каждая фиксация действительно предназначена для конкретной ветки.