Skip to content

Add missing parameters for generating signature#48

Open
jiangzm wants to merge 2 commits into
qnap-dev:masterfrom
jiangzm:master
Open

Add missing parameters for generating signature#48
jiangzm wants to merge 2 commits into
qnap-dev:masterfrom
jiangzm:master

Conversation

@jiangzm

@jiangzm jiangzm commented Apr 10, 2026

Copy link
Copy Markdown

There is an inconsistency in how qbuild uses the GPG keyring across different commands.

The following commands already use the configured GPG keyring file QDK_GPG_PUBKEYRING:
--import-key --list-keys --verify

However, the following signing commands were still using the default GPG keyring:
--sign --add-sign

This could cause signing and verification to use different keyrings, leading to unexpected signature issues.

Changes

  • Use the configured GPG public keyring when generating QPKG signatures for both --sign and --add-sign by adding:
    • --no-default-keyring
    • --keyring $QDK_GPG_PUBKEYRING
  • Make --add-sign fail fast if GPG fails to generate a valid ${qpkg}.sig, preventing the command from continuing into the QPKG rewrite path with a missing or empty signature.
  • Update qbuild help text and the Debian manpage to document that --sign and --add-sign depend on QDK_GPG_PUBKEYRING.
  • Update InstallToUbuntu.sh uninstall cleanup to remove /bin/qpkg_encrypt.

Result

  • Aligns the keyring behavior of import, list, verify, sign, and add-sign.
  • Avoids mismatches between signing and verification.
  • Remove command cleaned up all installed files.

@jiangzm

jiangzm commented Apr 12, 2026

Copy link
Copy Markdown
Author

+ fix: remove command missed deleting encryption program

@edhongcy

Copy link
Copy Markdown
Collaborator

I found one risk worth addressing before merge:

  • In shared/bin/qbuild, the new --no-default-keyring --keyring $QDK_GPG_PUBKEYRING flow can make gpg fail more often in --add-sign. Right now eval $gpg_cmd || warn_msg ... only prints a warning in non-strict mode, and the script still continues into add_qdk_area_signature and rewrites the QPKG. If the signer key is missing from the configured keyring, the keyring path is wrong, or the keyring file does not exist, this path can leave a broken package behind.

Suggested improvements:

  • Make --add-sign fail fast when gpg does not generate ${qpkg}.sig, instead of continuing the rewrite path.
  • Update the help text and manpage for --sign and --add-sign to mention that signing now depends on QDK_GPG_PUBKEYRING, because the current docs still say the default behavior is to use the first key from the secret keyring.
  • Optionally split the InstallToUbuntu.sh cleanup change into a separate PR or explain it in the PR description, since it looks unrelated to the GPG keyring change.

The direction of the fix makes sense overall. I mainly want to avoid a signing failure turning into a corrupted output file and make the new behavior easier for users to discover.

@jiangzm

jiangzm commented Jun 23, 2026

Copy link
Copy Markdown
Author

I found one risk worth addressing before merge:

  • In shared/bin/qbuild, the new --no-default-keyring --keyring $QDK_GPG_PUBKEYRING flow can make gpg fail more often in --add-sign. Right now eval $gpg_cmd || warn_msg ... only prints a warning in non-strict mode, and the script still continues into add_qdk_area_signature and rewrites the QPKG. If the signer key is missing from the configured keyring, the keyring path is wrong, or the keyring file does not exist, this path can leave a broken package behind.

Suggested improvements:

  • Make --add-sign fail fast when gpg does not generate ${qpkg}.sig, instead of continuing the rewrite path.
  • Update the help text and manpage for --sign and --add-sign to mention that signing now depends on QDK_GPG_PUBKEYRING, because the current docs still say the default behavior is to use the first key from the secret keyring.
  • Optionally split the InstallToUbuntu.sh cleanup change into a separate PR or explain it in the PR description, since it looks unrelated to the GPG keyring change.

The direction of the fix makes sense overall. I mainly want to avoid a signing failure turning into a corrupted output file and make the new behavior easier for users to discover.

@edhongcy Thank you for your suggestion.
Added a result check; if it fails, it will directly return an error and clean up the files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants