# `VulnCheck.Beam.AbstractWalker`
[🔗](https://github.com/Voskan/vulncheck/blob/v1.0.1/lib/vulncheck/beam/abstract_walker.ex#L1)

Walks the Erlang Abstract Format (`:raw_abstract_v1`) of one module and
produces a `VulnCheck.Types.ModuleSummary`.

Extracted facts:

  * local and remote calls with exact `file:line` (`:static_call`),
  * function captures (`&Mod.fun/2`, `fun mod:f/1`),
  * `apply/3` and `mod.fun(...)` sites; literal modules and functions,
    including variables bound to a literal in the same clause, are
    resolved to `:dynamic_apply` edges, everything else is recorded as a
    `VulnCheck.Types.DynamicCall`,
  * `{Mod, :fun, args}` triples (spawn, timers, child specs) as `mfa_refs`,
  * literal atoms used as values (`module_refs`) so supervision trees and
    plugs can be linked later,
  * literal arguments of selected framework calls (`init_literals`).

The output contains only strings, integers, lists, tuples and maps, so it
can be cached and decoded with `:erlang.binary_to_term(bin, [:safe])`.

# `encode_term`

```elixir
@spec encode_term(term()) :: VulnCheck.Types.ModuleSummary.literal()
```

Encodes an Erlang term (for example an attribute value) in the string-based
literal format used by summaries.

    iex> VulnCheck.Beam.AbstractWalker.encode_term([protocol: Enumerable, for: List])
    [{:tuple, [{:atom, "protocol"}, {:atom, "Elixir.Enumerable"}]}, {:tuple, [{:atom, "for"}, {:atom, "Elixir.List"}]}]

# `summarize`

```elixir
@spec summarize(module() | String.t(), [tuple()], keyword()) ::
  VulnCheck.Types.ModuleSummary.t()
```

Builds a summary from abstract forms.

Options:

  * `:root_dir` — project root used to make absolute source paths relative
  * `:attributes` — the `:attributes` chunk (used when forms carry none)
  * `:exports` — the `:exports` chunk

# `summarize_stripped`

```elixir
@spec summarize_stripped(module() | String.t(), keyword()) ::
  VulnCheck.Types.ModuleSummary.t()
```

Builds the summary of a module without debug info from its `:exports`,
`:imports` and `:attributes` chunks.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
