> For the complete documentation index, see [llms.txt](https://docs.layeronecloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layeronecloud.com/pve-microvm/audit-2026-09-05.md).

# Code audit — 2026-09-05

Source project: `pve-microvm` (migrated from `docs/audit-2026-09-05.md`). Run commands from the code checkout and directory specified below, not from this documentation repository.

## Outcome <a href="#outcome" id="outcome"></a>

Local source audit and fixes completed in commits `1189cc8` and `1f9dbff`. These commits are not a release and have not been deployed to the fleet.

Reviewed template construction and cleanup, the ephemeral runner, OCI imports, PVE patch application/removal, storage command generation, kernel configuration checks, package hooks, and CI/test contracts. This is not a guarantee that every PVE feature or storage backend is supported or defect-free.

## Fixed findings <a href="#fixed-findings" id="fixed-findings"></a>

* Unsafe refresh of ordinary/running VMs, ignored destruction failures, and prerequisite checks performed after deletion.
* Recursive rootfs deletion through remaining host bind mounts, including failure to obtain a reliable mount inventory.
* Missing 9Front image download.
* Guest command exit codes swallowed by exception handling; malformed/missing exit codes treated as success.
* Ephemeral clone leakage after configuration errors.
* Unsupported Perl layouts accepted by patch application; both transforms now preflight before modifying upstream files.
* Machine.pm replacement missed by the stamped apply fast path.
* Stale rollback originals overwriting newer PVE files. New verified installs hash both originals and patched files; unverified legacy restores refuse.
* UI rollback restoring an obsolete whole template rather than removing the injected script.
* Required kernel options logged without enforcing failure.
* OCI import failures losing diagnostics and disk attachment errors ignored.
* Read-only disk configuration and optical media write protection ignored.

## Verification <a href="#verification" id="verification"></a>

* `make test`: 88 passed, 0 failed, including executable audit regressions.
* Shell syntax checks and `git diff --check`: passed.
* `dpkg-buildpackage -us -uc -b`: passed after installing debhelper.
* Debian archive listing inspected. The local artifact retains the existing 0.3.24-1 version and must not be confused with the published release.
* Read-only copies of borg's installed Machine.pm and QemuServer.pm passed preflight and repeated-application/idempotency checks locally.
* Borg's installed QEMU accepted the drive arguments in an isolated, paused TCG process using a temporary raw file. QMP query-block confirmed read-only true with readonly=on and false without it. Processes and disk were removed.
* No managed guest or installed PVE module was modified for these checks.

## Boundaries and follow-up <a href="#boundaries-and-follow-up" id="boundaries-and-follow-up"></a>

* No full kernel rebuild, package installation/removal on a PVE host, or new guest cold-boot test was performed for these commits.
* No fresh live coverage of every storage backend or supported guest family.
* Legacy rollback refusal intentionally prevents unsafe package removal; an operator must reconcile backups with the current qemu-server package first.
* Multi-file installation is not crash-atomic: preflight prevents unsupported layouts from partially applying, but power loss/I/O failure still requires recovery using preserved backups and the matching upstream package.
* z83ii's SSH identity conflicts with the saved key. Verification was not bypassed; borg's existing verified identity was used instead.
* Release/deployment remains a separate staged operation, not part of this source-audit completion claim.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.layeronecloud.com/pve-microvm/audit-2026-09-05.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
