Skip to content

ci: avoid passing GPG passphrase on command line in Java publish workflow#3313

Merged
wjones127 merged 1 commit into
lancedb:mainfrom
octo-patch:fix/issue-3299-gpg-passphrase-env
May 7, 2026
Merged

ci: avoid passing GPG passphrase on command line in Java publish workflow#3313
wjones127 merged 1 commit into
lancedb:mainfrom
octo-patch:fix/issue-3299-gpg-passphrase-env

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Fixes #3299

Problem

Two security issues exist in .github/workflows/java-publish.yml:

  1. gpg-passphrase input is misused: actions/setup-java's gpg-passphrase input expects the name of an environment variable (default: GPG_PASSPHRASE), not the secret value itself. The previous value ${{ secrets.GPG_PASSPHRASE }} was setting the env var name to the actual secret, which is incorrect.

  2. Passphrase visible on the command line: -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} passes the GPG passphrase as a Maven system property argument, making it visible in process listings and potentially echoed in debug logs — a supply-chain security risk for release workflows.

Solution

  • Fix gpg-passphrase: MAVEN_GPG_PASSPHRASE — use the correct env var name so actions/setup-java generates a proper Maven settings.xml entry that reads from MAVEN_GPG_PASSPHRASE.
  • Remove -Dgpg.passphrase=... from the Maven CLI invocation.
  • Add MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} to the env: block of the Publish step, so the passphrase is available as an environment variable rather than a CLI argument.

Testing

The Java publish workflow only runs on tag pushes, so this cannot be exercised in a PR build. The logic change is straightforward: actions/setup-java is documented to write a settings.xml that reads <gpg.passphrase> from the named env var, and maven-gpg-plugin picks it up from there without any CLI argument.

…h workflow

Two issues are fixed:

1. `actions/setup-java` `gpg-passphrase` input expects an environment variable
   NAME, not the secret value itself. The previous `${{ secrets.GPG_PASSPHRASE }}`
   was incorrectly using the passphrase value as the env var name. Fixed to use
   `MAVEN_GPG_PASSPHRASE` (the env var name), which is what setup-java uses to
   generate the Maven settings.xml entry.

2. Removed `-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}` from the Maven
   command line. Passing secrets as CLI arguments makes them visible in process
   listings and can be echoed in debug logs. The passphrase is now provided
   via the `MAVEN_GPG_PASSPHRASE` environment variable, which `actions/setup-java`
   has already wired into Maven's settings.xml.

Fixes lancedb#3299

Co-Authored-By: Octopus <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

ACTION NEEDED

Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@wjones127 wjones127 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right to me.

@wjones127 wjones127 changed the title security: avoid passing GPG passphrase on command line in Java publish workflow ci: avoid passing GPG passphrase on command line in Java publish workflow May 7, 2026
@github-actions github-actions Bot added the ci label May 7, 2026
@wjones127
wjones127 merged commit 5338aeb into lancedb:main May 7, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: avoid passing GPG passphrase on command line in Java publish workflow

2 participants