mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 18:45:53 +00:00
aae8aef4ab
restoreProviderMSPArchiveFile copied each tar entry with an unbounded io.Copy, so the only limit on what a restore wrote to disk was the size the archive declared for itself. A gzip bomb, a PAX sparse entry claiming a huge logical size, or a corrupt stream could fill the target volume. Bound extraction the way readProviderMSPBackupManifestBytes already bounds the manifest: a per-entry cap and a cumulative cap across the whole restore, both enforced against the bytes actually copied rather than the declared header size. That size comes from the archive, so it is only good for an early reject, never as the bound. An entry that overruns fails the restore and its partial file is removed, rather than being silently truncated into a file that looks complete. A restore that failed partway had already deleted whatever it replaced, leaving a half-populated control plane that looks bootable and forcing the retry to use replace. Roll the partial restore back to an empty target instead, and say so in the error. Follows the zip-slip fix in the same function (CodeQL alert 314).