Skip to content

JAVA-6187 Upgrade libcrypt version to 1.18.1#1983

Open
strogiyotec wants to merge 6 commits into
mongodb:mainfrom
strogiyotec:JAVA-6187
Open

JAVA-6187 Upgrade libcrypt version to 1.18.1#1983
strogiyotec wants to merge 6 commits into
mongodb:mainfrom
strogiyotec:JAVA-6187

Conversation

@strogiyotec
Copy link
Copy Markdown
Contributor

@strogiyotec strogiyotec commented May 21, 2026

JAVA-6187
Upgrading libcrypt version to 1.18.1
Also the artifact location got changed from s3 to github

Risks

This PR assumes there is gpg installed that might not be a case in Windows

Resolution of risks

There is a new flag -PskipCryptVerify=true that will skip gpg verification

Warnings (not applicable, I passed --quite as suggested by Ross)

If you run ./gradlew :mongodb-crypt:downloadJnaLib locally it will give a few warnings

> Task :mongodb-crypt:downloadJava UP-TO-DATE
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-x86_64-glibc_2_7-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-s390x-glibc_2_7-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-x86_64-glibc_2_7-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-s390x-glibc_2_7-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-ppc64le-glibc_2_17-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-ppc64le-glibc_2_17-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-arm64-glibc_2_17-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-arm64-glibc_2_17-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-windows-x86_64-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-windows-x86_64-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-macos-universal-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-macos-universal-1.18.1.asc
Download https://pgp.mongodb.com/libmongocrypt.pub

> Task :mongodb-crypt:verifyJava
gpg: keybox '/home/almas/repos/mongo-java-driver/mongodb-crypt/build/jnaLibs/gnupg/pubring.kbx' created
gpg: /home/almas/repos/mongo-java-driver/mongodb-crypt/build/jnaLibs/gnupg/trustdb.gpg: trustdb created
gpg: key 81F1404DEBACA586: public key "Libmongocrypt Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Fri May  8 05:08:55 2026 PDT
gpg:                using RSA key F2F5BF4ABF517E039AFCADAA81F1404DEBACA586
gpg: Good signature from "Libmongocrypt Release Signing Key <packaging@mongodb.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.

The reason is because gpg doesn't know if the key is trusted as we arbitrary downloaded it

Running the same command using shell will give the same output
image

@strogiyotec strogiyotec requested a review from a team as a code owner May 21, 2026 15:51
@strogiyotec strogiyotec requested review from Copilot, rozza and vbabanin and removed request for rozza May 21, 2026 15:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the mongodb-crypt module’s bundled libmongocrypt native library download process to use libmongocrypt’s 1.18.1 GitHub release assets (instead of S3) and adds GPG signature verification of the downloaded tarballs.

Changes:

  • Bump libmongocrypt download revision to 1.18.1 and switch download base URL to GitHub releases.
  • Download per-platform tarballs (+ .asc signatures) and extract only the needed native library into the JNA resources directory.
  • Add a Gradle task that verifies tarball signatures via gpg, with an opt-out via -PskipCryptVerify=true.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mongodb-crypt/build.gradle.kts Outdated
Comment on lines +173 to +178
val tarballList = tarballs.files.toList()
val signatureList = signatures.files.toList()
check(tarballList.size == signatureList.size) {
"Expected each tarball to have a matching signature: ${tarballList.size} tarballs vs ${signatureList.size} signatures."
}
tarballList.zip(signatureList).forEach { (tarball, signature) ->
Comment thread mongodb-crypt/build.gradle.kts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread mongodb-crypt/build.gradle.kts Outdated
setExecutable(true, true)
}

execOps.exec { commandLine("gpg", "--homedir", home.path, "--batch", "--import", publicKey.get().asFile.path) }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let's skip it for now, as we know that we are downloading from a trusted source

Comment on lines +126 to +133
abstract class VerifyLibmongocryptTask : DefaultTask() {
@get:Inject abstract val execOps: ExecOperations

@get:InputFiles abstract val tarballs: ConfigurableFileCollection
@get:InputFiles abstract val signatures: ConfigurableFileCollection
@get:InputFile abstract val publicKey: RegularFileProperty
@get:Input abstract val skipVerify: Property<Boolean>

Comment thread mongodb-crypt/build.gradle.kts Outdated
Comment on lines +191 to +192
execOps.exec {
commandLine("gpg", "--homedir", home.path, "--batch", "--verify", signature.path, tarball.path)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
execOps.exec {
commandLine("gpg", "--homedir", home.path, "--batch", "--verify", signature.path, tarball.path)
execOps.exec {
commandLine("gpg", "--homedir", home.path, "--batch", "--trust-model", "always", "--quiet", "--verify", signature.path, tarball.path)
}

Will reduce the noise from gpg

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks, addressed it here

Comment thread mongodb-crypt/build.gradle.kts Outdated
setExecutable(true, true)
}

execOps.exec { commandLine("gpg", "--homedir", home.path, "--batch", "--import", publicKey.get().asFile.path) }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
execOps.exec { commandLine("gpg", "--homedir", home.path, "--batch", "--import", publicKey.get().asFile.path) }
execOps.exec { commandLine("gpg", "--homedir", home.path, "--batch", "--quiet", "--import", publicKey.get().asFile.path) }

Added the quiet flag to reduce noise

Copy link
Copy Markdown
Contributor Author

@strogiyotec strogiyotec May 21, 2026

Choose a reason for hiding this comment

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

thanks, addressed it here

Copy link
Copy Markdown
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

Like this. Couple of optional suggestions.

You may want to change the task names downloadJava no longer makes sense as it used to be the java tarball. For example: downloadCryptLibs, verifyCryptLibs and extractCryptLibs make more sense now than downloadJava, verifyJava and unzipJava.

One gripe from the existing implementation, you might want to make downloading optional eg:

 overwrite(false)
  onlyIf { !file("$jnaDownloadsDir/${platform.tarballName}.tar.gz").exists() }

That way it would work without having to check if modified and offline. Also we can bypass this all if jnaLibsPath is set.

@vbabanin vbabanin self-assigned this May 22, 2026
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.

4 participants