Authorship Policy rejecting push

Issue #5 resolved
Marijn van Zon created an issue

Hi,

Really like the level of control the new Control Freak plugin gives. Amazing job!

I did run into an issue though with the Authorship Policy. I enabled both Author must be a valid Bitbucket User and Committer must be a valid Bitbucket User and got the error:

remote: 
remote: Control Freak
remote: -----
remote: Commit *** rejected: bad committer metadata.
remote: Committer "Marijn van Zon <***email***>" does not exactly match
remote: a Bitbucket user record. The closest match is:
remote: 
remote:     "*** <>"
remote: 

It looks like Control Freak tries to match the git user.name against the Bitbucket username instead of the real name.

This happens both when trying to use Bit-booster's Squash in the Bitbucket UI (even when squashing commits of which both committer and author was someone else) and when trying to push to the repository.

Currently I'm using "Yet Another Commit Checker" to validate that both the user.name matches the Bitbucket user's (real) name and the user.email matches the Bitbucket user's email. If Control Freak can handle this it would be nice because then we can get rid of YACC :).

Regards,

Marijn van Zon.

Comments (7)

  1. Julius Musseau

    Thanks for the bug report!

    I think part of the problem here is that bit-booster's "closest match" logic could probably be improved. The "closest match" routine's sole purpose is to help generate a useful error message, so it's not on the critical path, but it could be better.

    The other part of the problem, based on the snippet you pasted, is that it appears that your Bitbucket account is missing an email address. Is that true? If you click on your own user in Bitbucket (admin --> users --> Marijn van Zon), is there an email address?

    I've seen the situation where the email address is missing in the Bitbucket user database because the associated LDAP record is also missing an email address.

  2. Marijn van Zon reporter

    Hi Julius,

    Thank you for the reply. My user does have an email address and Bitbucket sends me emails on it. It's actually the same as my username, which is also weird why in the error message it's lacking the domain part (my full username is nu just marijn.vanzon, but marijn.vanzon@.....com). Also if it wasn't the case the YACC hook we have now would reject the push. So it's very strange.

    We use Atlassian Crowd (with SSO) as the user directory, and in Crowd the users are in the Crowd internal directory. We don't have a sync via an external directory like LDAP.

    Regards,

    Marijn van Zon.

  3. Julius Musseau

    Just realized you are probably only using option 2. below from YACC (this is a copy/paste from YACC's config screen):

    --
    1. Require Matching Committer Email [ ] Enabled
    
    2. Require Matching Committer Name [x] Enabled
    --
    

    Can you confirm you only have 2. enabled from YACC?

  4. Marijn van Zon reporter

    Hi Julias,

    We have both options enabled (I double-checked to be sure, it's a global setting and I also verified it wasn't being overruled in the repository hook settings). We use SSH keys to push to Bitbucket, so the user is already known during a push.

    If just did a quick test to verify, and if I do "git config user.name 'foo'" or "git config user.email 'foo@bar.com'", YACC will reject the push either with "expected committer name X but found Y" or "expected committer email X but found Y".

    Another test I did with Control Freak is with "Committer must be current logged-in User". I think I was confused a bit about the functionality, but enabling that works. If I try to push something with a wrong user.name/user.email it gets rejected by Control Freak but if I set them properly I can push no problem. So the error is specifically when enabling the Author/Committer "must be a valid Bitbucket User", not with checking if you are pushing your own commits.

    Regards,

    Marijn van Zon.

  5. Julius Musseau

    We just published version v2018.07.26 which we believe fixes this issue.

    Our "lookup user" routine had some problems, especially if 2-or-more users had the same email address. Which obviously is not the problem you are seeing! But nonetheless we firmed up the "lookup user" routine substantially so we think there's a good chance your problem is also fixed.

  6. Marijn van Zon reporter

    Hi Julius,

    Yes, the issue is gone now! The suggestion on failure now shows my full user details and if everything is correct I can push with the "must be a valid Bitbucket User" enabled :). Thank you!

    Regards,

    Marijn van Zon.

  7. Log in to comment