[8.x] [Fleet] Improve package verification memory usage (#208475) (#208535)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Improve package verification memory usage
(#208475)](https://github.com/elastic/kibana/pull/208475)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nicolas
Chaulet","email":"nicolas.chaulet@elastic.co"},"sourceCommit":{"committedDate":"2025-01-28T13:46:28Z","message":"[Fleet]
Improve package verification memory usage
(#208475)","sha":"2887aa698573427756d302648a2ed53f568b8c38","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor","backport:8.17"],"title":"[Fleet]
Improve package verification memory
usage","number":208475,"url":"https://github.com/elastic/kibana/pull/208475","mergeCommit":{"message":"[Fleet]
Improve package verification memory usage
(#208475)","sha":"2887aa698573427756d302648a2ed53f568b8c38"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208475","number":208475,"mergeCommit":{"message":"[Fleet]
Improve package verification memory usage
(#208475)","sha":"2887aa698573427756d302648a2ed53f568b8c38"}}]}]
BACKPORT-->

Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
This commit is contained in:
Kibana Machine 2025-01-29 02:32:43 +11:00 committed by GitHub
parent 580bb5a41d
commit d5bcef977d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -124,12 +124,14 @@ async function _verifyPackageSignature({
const message = await openpgp.createMessage({
binary: pkgArchiveBuffer,
format: 'binary',
});
const verificationResult = await openpgp.verify({
verificationKeys: verificationKey,
signature,
message,
format: 'binary',
config: {
// See https://github.com/openpgpjs/openpgpjs/blob/d6145ac73eebcf66bdeb0873aa60fc49361e1aeb/src/message.js#L800-L809
// Essentially, since the sha1 key was reformmated to sha256 as part of https://github.com/elastic/elasticsearch/issues/85876,