Skip to content

Node revoke leaves pending enrollment tokens valid #159

Description

@Andreas-Froyland

Problem

NodeService::revoke (crates/fleet-application/src/node.rs) revokes the node identity and its credentials but leaves the machine's pending enrollment tokens usable. enroll refuses only when the machine already has an active identity. Once revoked, a token issued before the revoke can enroll a new key as that machine until the token expires (up to one day).

An operator who revokes a node to cut off a compromised host expects no existing secret to bring it back.

Found in review of #157 (FM-911 machine page). The page now warns when pending tokens exist, but the fix belongs in the application layer.

Acceptance criteria

  • Revoking a node also expires (or consumes) every pending enrollment token for that machine, in the same transaction as the identity revoke.
  • The audit event for node_identity_revoked records how many tokens were invalidated (count only; never token material).
  • A test covers: issue token → revoke → enroll with that token fails as unauthorized.

Non-goals

  • UI changes. Once this lands, FM-911's pending-token warning can be dropped.

Activity

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

    agent:codexAssign to Codex: logic, API, storage, backend

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions