Skip to content

fix(hosts): rate-limit heartbeats and close enrollment and audit gaps #87

Closed

Description

@wstein

Three control-plane gaps:

  1. Heartbeats have no minimum interval (apps/control_plane/lib/workharbor/host_connections.ex, around lines 215-247). Each one writes a transaction plus an undeletable audit row, so a buggy or compromised agent can grow the audit table without bound and starve owner writes (persistence_busy).
  2. Issuing a new enrollment code for a host leaves earlier unexpired codes valid (hosts.ex, around lines 15-52). Redeeming the stale code retires the identity the agent just enrolled with.
  3. authorize! inside a transaction calls Repo.rollback(:forbidden), which also rolls back the authorization_denied audit (hosts.ex around 18/242/374, config_trust.ex around 29/111). Denial audits are security evidence under authentication.md §4.

Acceptance criteria

  • Heartbeats faster than a fixed floor (for example 5 s against the 10 s cadence) are refused or close the connection, with a test.
  • Issuing a code revokes the host's outstanding unconsumed codes, with a test.
  • A denial inside a transaction keeps its audit row, with a test.
  • make check is green.

Found by the independent pilot review on 2026-10-16. Builds on the pilot branch pilot/installable-pilot-pr (split from #83); start from its current head.

🤖 Generated with Claude Code

Activity

  1. added 20 commits that reference this issue on Oct 16, 2026
  2. wstein commented on Oct 16, 2026

    @wstein
    OwnerAuthor

    Done in #100. Final make check on main 1cb22c2: GREEN (850 harness, 654 Go, 200 ExUnit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions