# gpg verify git sub modules useful?

4 messages from 2017-02-28 to 2017-03-01. Participants: Patrick Schleizer, Junio C Hamano, Stefan Beller.
Thread: https://gitlist.dev/t/45252

## Patrick Schleizer, 2017-02-28 15:50

Subject: gpg verify git sub modules useful?
Message-ID: <a9da4416-6437-a491-f461-c5e61d805b2d@riseup.net>
URL: https://gitlist.dev/e/a9da4416-6437-a491-f461-c5e61d805b2d%40riseup.net

```
When using git submodules, is there value in iterating about the git
submodules running "git verfiy-commit HEAD" or would that be already
covered by the git submodule verification?

Cheers,
Patrick

```

## Junio C Hamano, 2017-02-28 17:36

Subject: Re: gpg verify git sub modules useful?
Message-ID: <xmqqmvd6kykc.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqmvd6kykc.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <a9da4416-6437-a491-f461-c5e61d805b2d@riseup.net>

```
Patrick Schleizer <patrick-mailinglists@whonix.org> writes:

> When using git submodules, is there value in iterating about the git
> submodules running "git verfiy-commit HEAD" or would that be already
> covered by the git submodule verification?

That depends on what you are referring to with the "git submodule
verification" and more importantly what threat you are guarding
against.  "git -C <submodule-dir> verify-commit HEAD" may make sure
that the contents of that commit object is GPG signed by whoever you
trust--is that what you want to make sure?  Or do you want all
commits in the submodule history to be similarly signed because the
tree of the superproject can switch to some other commit there?

```

## Patrick Schleizer, 2017-03-01 18:28

Subject: Re: gpg verify git sub modules useful?
Message-ID: <8cdd9f2d-415c-1b60-0017-bf973e8cf914@riseup.net>
URL: https://gitlist.dev/e/8cdd9f2d-415c-1b60-0017-bf973e8cf914%40riseup.net
In-Reply-To: <xmqqmvd6kykc.fsf@gitster.mtv.corp.google.com>

```
Good questions, thank you for trying to figure out what I am asking. :)

Junio C Hamano:
> Patrick Schleizer <patrick-mailinglists@whonix.org> writes:
> 
>> When using git submodules, is there value in iterating about the git
>> submodules running "git verfiy-commit HEAD" or would that be already
>> covered by the git submodule verification?
> 
> That depends on what you are referring to with the "git submodule
> verification"

cd submodule
if ! git verfiy-commit HEAD ; then
   error
fi

> and more importantly what threat you are guarding
> against. 

All main (non-submodule) (merge) commits and submodule (merge) commits
are signed by me.

1) git --recursive clone main (non-submodule) git repository
2) cd git main repository
3) git verify-commit HEAD or git verify-tag tag-name
4) git submodule update

What if the main (non-submodule) git repository gpg signature was okay
but then after git fetched the submodules these compromised (MITM'ed) ones?

Does the having gpg verified the root (main git repository) ensure that
submodule commits are also quasi verified?

> "git -C <submodule-dir> verify-commit HEAD" may make sure
> that the contents of that commit object is GPG signed by whoever you
> trust--is that what you want to make sure?

> Or do you want all
> commits in the submodule history to be similarly signed because the
> tree of the superproject can switch to some other commit there?

I guess so.


```

## Stefan Beller, 2017-03-01 19:08

Subject: Re: gpg verify git sub modules useful?
Message-ID: <CAGZ79kav0yB=g5kwB68oHRxbd0mDJ5-gGTJSidSKkZ75gmT44Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kav0yB%3Dg5kwB68oHRxbd0mDJ5-gGTJSidSKkZ75gmT44Q%40mail.gmail.com
In-Reply-To: <8cdd9f2d-415c-1b60-0017-bf973e8cf914@riseup.net>

```
On Wed, Mar 1, 2017 at 10:28 AM, Patrick Schleizer
<patrick-mailinglists@whonix.org> wrote:
> Good questions, thank you for trying to figure out what I am asking. :)
>
> Junio C Hamano:
>> Patrick Schleizer <patrick-mailinglists@whonix.org> writes:
>>
>>> When using git submodules, is there value in iterating about the git
>>> submodules running "git verfiy-commit HEAD" or would that be already
>>> covered by the git submodule verification?
>>
>> That depends on what you are referring to with the "git submodule
>> verification"
>
> cd submodule
> if ! git verfiy-commit HEAD ; then
>    error
> fi
>
>> and more importantly what threat you are guarding
>> against.
>
> All main (non-submodule) (merge) commits and submodule (merge) commits
> are signed by me.
>
> 1) git --recursive clone main (non-submodule) git repository
> 2) cd git main repository
> 3) git verify-commit HEAD or git verify-tag tag-name
> 4) git submodule update
>
> What if the main (non-submodule) git repository gpg signature was okay
> but then after git fetched the submodules these compromised (MITM'ed) ones?

The signing in Git is just signing the commit hash essentially.

> Does the having gpg verified the root (main git repository) ensure that
> submodule commits are also quasi verified?

That is my understanding. There is no difference between the security of
a file or a submodule, just the way of obtaining and its reporting is different.
Both a file and a submodule are referred to via a hash (currently sha1).
Obtaining a file is implicit whereas obtaining the submodule is explicit.
The reporting (in e.g. git-status) ... depends on a lot of options to be set.

When signing the superproject, you acknowledge the submodules
being in the state as recorded. (Same with s/submodules/files/)

So I am not sure what kind of additional signing you're looking
for in the submodules.

Thanks,
Stefan

```
