New issue
Advanced search Search tips
Starred by 3 users

Issue metadata

Status: Released
Owner: ----
Closed: Sep 26

Sign in to add a comment

Issue 7750: signed pushes do not seem to be enforced

Reported by, Nov 13 2017

Issue description

I have gerrit 2.15-rc2.
I have receive.enableSignedPush set to true, and I have registered my public gpg key. In All-Projects I have both enable and receive signed push set to true.
I have created the test project, but when trying to push to it with --no-signed, push is allowed even though it probably should not be.
I tried to explicitly require signed pushes in the respective test project instead of All-Projects, same effect.

Comment 1 by, Nov 14 2017

Project Member
Components: -PolyGerrit Backend

Comment 2 by, Nov 24 2017

Project Member
Components: -Backend ReceiveCommits docs
You can configure requiring signed push on a per-project basis:

Would a link from to that setting have helped here? (Bonus points if you can suggest wording, or even better, a patch against Documentation/config-gerrit.txt. SUBMITTING_PATCHES has details on how that works.)

Comment 3 by, Nov 24 2017

Project Member
Components: -docs
Hm, you already mentioned that you're tried to require signed pushes there. Do you have a copy of the project.config or a screenshot illustrating what happened?

Comment 4 by, Nov 24 2017

Project Member
[receive] enableSignedPush gets set in etc/gerrit.config.
[receive] requireSignedPush gets set in project.config in refs/meta/config.

What is the output when you push with and without --signed?

Comment 5 by, Nov 24 2017

hmmm I checked a few times (unless I did it wrong). both enable and require signed push are enabled in All-Project actually, but I also tried doing it explicitly on the specific child project. gerrit.enableSignedPush is true. but it doesn't require and also rejects signed pushes. and yes, it gives me ability to upload gpg keys, does that signify signed pushes being globally enabled, or not?

Comment 6 by, Nov 24 2017

won't give you exact output because it would require testing it now. I did it once. When I tried to push without --signed, the push went through, and I don't have the push.gpgSign option set. When --signed was used, the server just rejected the push, as if signed pushes were disabled. It is still possible I made a mistake, but I still think that stopped working.

Comment 7 by, Sep 16

Project Member
Status: AwaitingInformation (was: New)
> both enable and require signed push are enabled in All-Project actually

You need to set

    enableSignedPush = true

in your etc/gerrit.config.

Comment 8 by, Sep 16

Project Member
Labels: Hotlist-SignedPush

Comment 9 by, Sep 17

From what I see it is set.

Comment 10 by, Sep 17

Project Member
Status: Accepted (was: AwaitingInformation)
It doesn't work on master either.

It seems, that even though the hooks are added in SignedPushModule:

  if ( {

e.g.: SignedPushPreReceiveHook instance is added to hooks, the hook
doesn't get called and that why a non-signed push is not checked
and rejected.

It seems that the hooks are added too late.
I the beginning only AsyncReceiveCommits preReceiveHook is set:


Then from the ReceivePack.service() line: 280
this single preReceiveHook gets called: [1]

  preReceive.onPreReceive(this, filterCommands(Result.NOT_ATTEMPTED));

in the same call stack Worker instance is created and initialized,
and only then the other hooks (with SignedPushPreReceiveHook) gets added
and the same receivePack instance is mutated and hook chain is
assigned, but they don't get invoked any more: [2].



Comment 11 by, Sep 17

Project Member
The reason it works on stable-2.14 branch:

The hooks are initialized before the first hook is invoked:[1]:

  preReceive.onPreReceive(this, filterCommands(Result.NOT_ATTEMPTED));


Comment 12 by, Sep 17

Project Member
I think that this change is related: [1]. I added a comment there.


Comment 13 by, Sep 17

Project Member
Status: Started (was: Accepted)

Comment 14 by, Sep 17

Project Member
Status: ChangeUnderReview (was: Started)

Comment 15 by, Sep 18

Project Member
Acceptance test is added to catch similar regression in future gerrit releases:

Comment 16 by, Sep 19

Project Member
Labels: Blocking-2.16

Comment 17 by, Sep 19

Project Member
Labels: Triaged-Yes Priority-1

Comment 18 by, Sep 26

Project Member
Status: Submitted (was: ChangeUnderReview)

Comment 19 by, Sep 28

Labels: FixedIn-2.15.4

Comment 20 by, Oct 1

Status: Released (was: Submitted)

Sign in to add a comment