clan: swallowed unmarshals in render can write a machine back with an empty deploy target #283

Closed
opened 2026-08-05 23:10:01 +00:00 by ben · 1 comment
Owner

internal/clan/render.go:137, 141, 154 — _ = json.Unmarshal(raw, &r) for role, vars and targetHost, while every sibling unmarshal in the same function returns a typed &Failure{Kind: FailConfigEval}. Line 157's delete(dfields, "targetHost") also drops the unparsed original from the carry-through map, so the next editInventory writes the machine back with an empty deploy target in a clean-looking OurCloud-authored commit — the corruption is laundered into config history.

Acceptance

  • All three unmarshals fail loud with the same typed FailConfigEval failure their siblings use.
  • A malformed targetHost/role/vars field can never survive a render as silently-emptied output; test with corrupt JSON in each field.

Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code).

`internal/clan/render.go:137, 141, 154` — `_ = json.Unmarshal(raw, &r)` for `role`, `vars` and `targetHost`, while every sibling unmarshal in the same function returns a typed `&Failure{Kind: FailConfigEval}`. Line 157's `delete(dfields, "targetHost")` also drops the unparsed original from the carry-through map, so the next `editInventory` writes the machine back with an **empty deploy target** in a clean-looking OurCloud-authored commit — the corruption is laundered into config history. **Acceptance** - All three unmarshals fail loud with the same typed `FailConfigEval` failure their siblings use. - A malformed `targetHost`/`role`/`vars` field can never survive a render as silently-emptied output; test with corrupt JSON in each field. --- _Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code)._
Author
Owner

Fixed in e679ab3 (on origin/main).

parseClanMachine (internal/clan/render.go) swallowed the unmarshal error on a machine role, vars, deploy.targetHost and the legacy deploy.target_host — _ = json.Unmarshal(...). A corrupt targetHost parsed to an empty string, and the fallthrough delete(dfields, "targetHost") dropped the unparsed original from the carry map, so the next editInventory wrote the machine back with an empty deploy target — the corruption laundered into config history.

All four unmarshals now return the same typed &Failure{Kind: FailConfigEval} their siblings use. Red-first test TestRender_MalformedMachineFieldsFailLoud (internal/clan/render_test.go) feeds corrupt JSON into each of role/vars/targetHost/target_host and asserts loadInventory errors with an errors.As-matchable *Failure{Kind: FailConfigEval}. go test / go vet green (clan).

Fixed in e679ab3 (on origin/main). `parseClanMachine` (internal/clan/render.go) swallowed the unmarshal error on a machine `role`, `vars`, `deploy.targetHost` and the legacy `deploy.target_host` — `_ = json.Unmarshal(...)`. A corrupt `targetHost` parsed to an empty string, and the fallthrough `delete(dfields, "targetHost")` dropped the unparsed original from the carry map, so the next `editInventory` wrote the machine back with an empty deploy target — the corruption laundered into config history. All four unmarshals now return the same typed `&Failure{Kind: FailConfigEval}` their siblings use. Red-first test `TestRender_MalformedMachineFieldsFailLoud` (internal/clan/render_test.go) feeds corrupt JSON into each of role/vars/targetHost/target_host and asserts `loadInventory` errors with an `errors.As`-matchable `*Failure{Kind: FailConfigEval}`. go test / go vet green (clan).
ben closed this issue 2026-08-06 02:35:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#283
No description provided.