KatInterview

Host Snapshot Threat Scoring and Automated Containment Pipeline

System DesignModel answer
HardModel answerSystem Designml-system-designanomaly-detectionmulti-tenancy

Last updated

Design a cloud pipeline that scores host snapshots as normal or abnormal, applies safe automated containment or alerts, and exposes warning history to tenants.

Problem

You are building a managed security service for cloud customers. Software agents on customer machines periodically upload a snapshot of the operating system state (running processes, network connections, listening ports, loaded kernel modules, file hashes, resource usage, recent logins). An ML model classifies each snapshot as Normal or Abnormal.

When a snapshot is Abnormal, the platform may:

  • send a warning email,
  • quarantine the machine (isolate it from the network), or
  • shut the machine down.

Customers must be able to look up the history of warnings and actions for their own machines.

Task

Design the end-to-end service. Your answer should cover:

  1. Requirements and your assumed scale (fleet size, snapshot frequency, payload size, expected abnormal rate).
  2. Data collection and ingestion.
  3. Model serving and how you keep cost under control.
  4. The decision layer that turns a model score into a response.
  5. Action orchestration, including what happens when an action fails and how a customer or operator reverts it.
  6. Storage for raw data, detections, actions and the audit trail, plus the query API for history.
  7. Access control and tenant isolation.
  8. Latency, throughput and availability targets.
  9. How you handle false positives, and which safeguards make automated destructive actions acceptable.
  10. How you roll out and roll back new models.

State your assumptions explicitly and call out the trade-offs you are making.

Hints

Hint 1

Do the capacity math first: machines times snapshot frequency gives requests per second, and payload size gives bandwidth and daily storage. Then use the expected abnormal rate to work out how many alerts per second the response path must handle.

Hint 2

Even a detector with high specificity produces mostly false alerts when true anomalies are rare. Let that drive the design: graduated responses based on confidence and reversibility, corroboration across snapshots, and human approval for irreversible steps.

Hint 3

Treat every automated action as a durable, idempotent workflow with a saved pre-action state, plus fleet-wide limits (a circuit breaker), protected-machine lists, a kill switch and shadow mode, so one bad model release cannot harm a whole fleet.