feat(xo-server-audit/_uploadLastHash): check integrity sequentially (#5250)
- implementation is simpler - stop on first error
This commit is contained in:
parent
14ab694804
commit
8a98b6b012
@ -35,5 +35,6 @@
|
||||
>
|
||||
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
||||
|
||||
- xo-server-audit patch
|
||||
- xo-vmdk-to-vhd patch
|
||||
- xo-web minor
|
||||
|
@ -335,16 +335,18 @@ class AuditXoPlugin {
|
||||
}
|
||||
|
||||
// check the integrity of all stored hashes
|
||||
integrityCheckSuccess = await Promise.all(
|
||||
hashes.map((oldest, key) =>
|
||||
oldest !== lastHash
|
||||
? this._checkIntegrity({ oldest, newest: hashes[key + 1] })
|
||||
: true
|
||||
)
|
||||
).then(
|
||||
() => true,
|
||||
() => false
|
||||
)
|
||||
try {
|
||||
for (let i = 0; i < hashes.length - 1; ++i) {
|
||||
await this._checkIntegrity({
|
||||
oldest: hashes[i],
|
||||
newest: hashes[i + 1],
|
||||
})
|
||||
}
|
||||
|
||||
integrityCheckSuccess = true
|
||||
} catch (_) {
|
||||
integrityCheckSuccess = false
|
||||
}
|
||||
}
|
||||
|
||||
// generate a valid fingerprint of all stored records in case of a failure integrity check
|
||||
|
Loading…
Reference in New Issue
Block a user