Choreo.ThreatModel.Render.DOT (Choreo v0.7.1)

Copy Markdown View Source

DOT (Graphviz) rendering for Choreo.ThreatModel.

Produces security-oriented visualisation:

  • External entities — rectangles with thick border
  • Processes — circles
  • Data stores — cylinders
  • Trust boundaries — thick red dashed rectangles
  • Cross-boundary flows — highlighted edges
  • Unencrypted flows — red dashed edges

Further reading

Summary

Functions

Renders a threat model to a DOT string.

Functions

to_dot(model, opts \\ [])

@spec to_dot(
  Choreo.ThreatModel.t(),
  keyword()
) :: String.t()

Renders a threat model to a DOT string.

Options

Examples

iex> model = Choreo.ThreatModel.new()
iex> model = model
...>   |> Choreo.ThreatModel.add_external_entity(:user, label: "User")
...>   |> Choreo.ThreatModel.add_process(:api, label: "API")
...>   |> Choreo.ThreatModel.data_flow(:user, :api, label: "HTTPS")
iex> dot = Choreo.ThreatModel.Render.DOT.to_dot(model)
iex> String.contains?(dot, "digraph")
true
iex> String.contains?(dot, "User")
true
iex> String.contains?(dot, "API")
true