# sys-lib v0.5.0 - Detection and Identity
**What this machine is, what it runs inside, and an id that belongs to one application.** v0.5.0 ships virtualization and container detection with the evidence behind each answer, form factor, CPU topology and caches, power, DNS, the time zone, firmware, how the program was started, a `summary()` for log lines, and an application-scoped device id.
## What is sys-lib?
<strong>sys-lib</strong> answers the questions a program asks about the machine it runs on, with one plain function call each, on Linux, macOS, and Windows: the operating system and distribution, the CPU, memory, disks, network interfaces and traffic, the host, this process, virtualization and containers, power, and an application-scoped device id. It also carries the boot kit a long-running service needs in its first milliseconds: build info, instance info, and a process guard. It is container-aware, reports unknown facts as unknown, never runs another program, never starts a thread, and has no third-party runtime dependencies (the opt-in `device-id` feature brings crypt-io).
## What's in 0.5.0
```toml
[dependencies]
sys = { package = "sys-lib", version = "0.5" }
# With device identity:
# sys = { package = "sys-lib", version = "0.5", features = ["device-id"] }
```
- **`virt`**: `detect()` with `is_vm()`, `is_container()`, `is_wsl()`, `is_kubernetes()`, `hypervisor()`, `container()`, and `cloud()`. Every check that fired is named in `evidence`, as a constant, with its strength: an environment variable is weak evidence. No metadata service is ever contacted. Detection is advisory.
- **`os`**: `form_factor()` and `detect_form_factor()` with source and confidence, `edition()`, `codename()`, `is_server_edition()`, and `is_64bit()`.
- **`cpu`**: `topology()`, `caches()`, `cache_line()`, `numa_nodes()`, `is_hybrid()`, `native_arch()`, and `is_translated()`.
- **`host`**: `timezone()`, `locale()`, `model()`, `firmware()`, `board()`, `clock_sync()`, and `sessions()`. Serial numbers are never part of these answers.
- **`power`**: `has_battery()`, `battery()`, `batteries()`, and `on_ac()`. Wireless mice and headsets are left out, and packs are combined by energy, not by averaging percentages.
- **`net::primary()`**, **`net::dns()`** (configuration only: no DNS query is ever sent), **`disk::of()`**, SSD and HDD in `DiskKind`, and **`mem::modules()`**.
- **`process::launch()`**: systemd, launchd, a Windows service, container init, a terminal, SSH, or cron, with evidence, plus `is_service()` and `is_interactive()`.
- **`summary()`**: every fact for a log line or a support bundle, as `Display`, key-value pairs, or JSON. It deliberately carries no host name, user name, MAC address, or device id.
- **`device`** (feature `device-id`): `id()`, `fingerprint()`, `report()`, and `builder()`. An id is a keyed BLAKE3 hash of one identifier the OS keeps, so two applications on one machine get unrelated ids and nobody can recover the identifier behind them. **It is not authentication.** The derivation is frozen for all of 1.x. See [`docs/DEVICE-ID.md`](https://github.com/jamesgober/sys-lib/blob/main/docs/DEVICE-ID.md).
## How it was tested
- **New fuzz targets** for SMBIOS tables, `uevent`, `resolv.conf`, utmp, time zone names and locales, and stored fingerprints, on every push and nightly.
- **Attack tests**: raw identifiers never appear in any output (T1); over 2 000 pairs, two applications' ids differ in about half their bits (T2); the warning is in the documentation (T3); identifying values stay out of `summary()` (T13); environment variables are weak evidence (T14); malformed firmware tables stop cleanly (T15).
- **Hostile trees**: every new reading runs over files holding overflow values, NUL bytes, and oversized content.
- **Live comparison** with the OS's own tools on every runner: `date`, `getconf`, and `ip` on Linux, `sysctl`, `route`, and `scutil` on macOS, CIM and .NET on Windows.
- **Nano Server**: a new CI job runs a real binary there, because a DLL missing from the import table stops a program before `main`.
- The fixtures found one real bug: WSL 2 with systemd was reported as a container.
## What changed
- `host::clock_sync()` answers only when it can be believed. Windows gives `Ok(None)`, and macOS answers only when the kernel says synchronised: a false "unsynchronised" would take a healthy node out of a cluster (D-054).
- `Verdict::Same` needs more than the CPU signature to match, since identical CPUs share it (D-057).
- `wtsapi32` is loaded at run time, so a Windows without it runs and answers `Unsupported` for sessions (D-055).
- macOS: `mem::modules()` is `Unsupported`, and the Intel firmware version is `None`; no source could be confirmed (D-059).
- Windows: `power::batteries()` is one combined entry, and `net::primary()` is IPv4 only (D-058).
- The `ubuntu-24.04-desktop-amd` fixture and iOS `os_proc_available_memory()` move to 0.6 (D-062).
## What's next
`0.6.0`, environment and reports: the server readiness, benchmark environment, and security posture reports, temperatures, GPU adapters, and the FreeBSD and 32-bit Linux backends.