Uploaded image for project: 'Maven GPG Plugin'
  1. Maven GPG Plugin
  2. MGPG-99

Passcode byte array provided to gpg executable on stdin is not terminated

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.0
    • 3.2.0
    • None

    Description

      We ran into a strange issue using the maven-gpg-plugin with gnu gpg 2.3.7.

      The 2.x versions of gpg prefer to take the passcode for the signing key via stdin and the maven-gpg-plugin does setup the signing process accordingly with the `--passphrase-fd 0` argument provided to the command process.

      On Line 106 the passcode is written to as bytes to the input stream that is then provided in Line 173 to the gpg process.

      Unfortunately it appears that gpg requires a `CR` or `LF` to recognise that the passcode is provided as arg 0 on stdin. In our case it does not and the process fails with following error: `gpg: signing failed: No pinentry` .

      The use of the loopback pinentry device is properly configured by the plugin but the hint for us was that the gpg executable did not know there was any input on stdin.

      After some experimentation, we found that appending a `CR` character to the passcode will trigger the stdin to provide the passcode to the program.

      This "fix" looks like this in the `settings.xml` file.

      Attachments

        1. image-2023-08-15-10-40-10-637.png
          11 kB
          Niels Bertram

        Issue Links

          Activity

            People

              cstamas Tamas Cservenak
              niels.bertram Niels Bertram
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: