Skip to main content

Cadvisor

@magistr/cadvisorv2026.08.01.1· 1d agoMODELS
01README

cAdvisor container metrics for swamp — deploy a cAdvisor container over SSH, wire it in as a VictoriaMetrics scrape target, and query live and historical container resource stats (memory, CPU, network).

Model:

  • @magistr/cadvisordeploy (idempotent: run the cAdvisor container and append a scrape job to the VictoriaMetrics prometheus config), status (report container + scrape-config state), current-metrics (per-container memory/CPU/network straight from the cAdvisor /api/v1.3/docker API), top-memory (top memory consumers over a lookback window via the VictoriaMetrics range-query API), and remove (tear down the container and scrape config).
02Release Notes

2026.08.01.1

Closes the HIGH remote-shell command-injection finding (bug #1) tracked in the local cadvisor-latent-bugs @magistr/issue-lifecycle model — not filed to the swamp.club Lab, per CLAUDE.md's Anti-Bypass rule; Lab is @swamp/* product only.

  • Remote-shell command injection (HIGH), closedrunSsh() hands its built command string to the REMOTE shell verbatim, and vmComposeDir, vmScrapeConfig, and vmComposeFile (admin-configured globalArguments) were interpolated unescaped into that string at every cat/heredoc-append/ cd && docker compose/sed -i site in deploy, status, and remove. A canonical shellEsc helper (copied verbatim from firecracker/ fc-task-server: single-quote-wrap, ' -> '\'') is now applied to all three values at every remote-command interpolation site. Defense-in-depth, not an externally-exploitable hole: these three values are read only from context.globalArgs (GlobalArgsSchema) and every method that uses them takes no per-invocation caller arguments, so this closes a hostile-admin or misconfiguration vector, not an external attack surface. The ${username}@${host} ssh-destination argv element was already safe (one local Deno.Command argv slot, never remote-shell-interpreted) and is unchanged. The deploy heredoc BODY (file data, not a shell token) is deliberately left unescaped — only the heredoc TARGET path is wrapped. Behavior-preserving for legitimate metacharacter-free paths.
  • The four adversarial Site-2 characterization tests, the methods-suite deploy/remove exact-command assertions, and every cat-equality stub matcher are re-baselined to the single-quote-wrapped expected strings. Coverage, property-invariant-flow, and contract-fixture suites use startsWith/includes matchers on metacharacter-free arguments and stay green unchanged, demonstrating behavior preservation.
  • Model version and manifest.yaml bumped 2026.07.16.2 -> 2026.08.01.1 (in sync). The six remaining sibling latent bugs (fragile sed range-delete, unnormalized cpuPercent, empty-aliases name collapse, unclamped counter-reset deltas, README typeVersion drift, hardcoded VM port) remain deferred and pinned in cadvisor-latent-bugs, unchanged.

This release also carries the wave-2c five-suite test backfill (ext-quality-test-backfill) that established the characterization suites the hardening above re-baselines:

  • Added extensions/models/cadvisor_test.ts (contract-fixture), cadvisor_methods_test.ts (methods), cadvisor_adversarial_test.ts (adversarial), cadvisor_coverage_test.ts (coverage), cadvisor_property_test.ts (property-invariant-flow) — 0 tests before this change, 64 after. cadvisor.ts is a DUAL-boundary model (SSH via Deno.Command("ssh") and HTTP via fetch), so every suite stubs both: the talos-node Deno as unknown as Record<string, unknown> FakeCommand bridge for the SSH side, and the porkbun fetch-stub pattern for the HTTP side. deploy's 5-second verify setTimeout is neutralized (withSyncSetTimeout, the talos-node pattern) so the suite runs synchronously.
  • Test-review round 1 (autonomous, 0 CRIT + 1 HIGH) added: a remove() error-path test — none of its three SSH calls are guarded by try/catch, so a mid-teardown failure throws and leaves NO status resource written at all (the HIGH finding, since the methods suite otherwise only covered remove()'s happy path); two status() mixed-success/failure tests (its two SSH calls are independently try/caught); and the deploy idempotency property now also asserts on the written status resource's running/scrapeConfigured fields, not just internal SSH call counts (the MEDIUM finding).
  • Added fixtures/ — pure doc-derived, synthetic cAdvisor /api/v1.3/docker and VictoriaMetrics /api/v1/query_range wire-shape fixtures (cadvisor-docker.json, vm-query-range.json) plus a prometheus scrape-config before/after text pair (scrape-config-before.txt, scrape-config-after.txt) and PROVENANCE.md. No live call was made against any real cAdvisor/VictoriaMetrics instance over either boundary (HTTP metrics or SSH config/docker-inspect); every value is synthetic (RFC 2606 host.example.com, synthetic 64-hex-char container paths, the real published cAdvisor "no memory limit" sentinel constant used only as a documented value, never a live measurement).
  • The contract-fixture suite pins the RAW cAdvisor/VictoriaMetrics INPUT wire keyset + types (not a written-resource-equals-fixture passthrough, unlike porkbuncadvisor.ts transforms bytes to MB/percent/rates, so the transform itself is pinned in the methods and coverage suites instead).
  • The adversarial suite separates cadvisor.ts's TWO SSH interpolation sites: the ${username}@${host} s
03Models1
@magistr/cadvisorv2026.08.01.1extensions/models/cadvisor.ts

Global Arguments

ArgumentTypeDescription
hoststringDocker host (IP or hostname)
usernamestringSSH username
cadvisorPortnumbercAdvisor exposed port
vmComposeDirstringPath to VictoriaMetrics docker-compose directory on the host
vmComposeFilestringVM compose file name
vmScrapeConfigstringVM prometheus scrape config file name

Resources

status(infinite)— cAdvisor deployment status
current(infinite)— Current container metrics from cAdvisor
topMemory(infinite)— Top memory consumers over time from VictoriaMetrics
04Previous Versions2
2026.07.16.2

Release 2026.07.16.2 — align model versions with manifests

Maintenance release across the @magistr extensions. For most packages this carries no functional change: the only edit is the model's version: field, brought back in line with its manifest version so the published model type version and the package version no longer drift.

Functional changes in this release are limited to:

  • anime-cron: normalizeTitle now strips a ": subtitle" suffix and a trailing parenthesized year before comparison, fixing dedup false-misses where the torrent title carries a subtitle or year that the AniList romaji does not.

  • arckit: first publish. Standalone ArcKit port — a 12-phase architecture governance state machine with 65 bundled templates, driven by a bundled skill.

Also tracks three extensions (kaiten, observability-agent, music-library) that previously existed only as untracked working-tree directories, recovered from stashes.

Added 1 models

2026.05.25.1

Merge pull request #5 from umag/extensions/jscad-stl-pair

extensions: add 15 more @magistr extensions + auto-discover CI

05Stats
A
100 / 100
Downloads
1
Archive size
8.7 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms
07Labels