Visualize.Audit.Atoms (Visualize v0.8.1)

Copy Markdown View Source

No atom from untrusted input (spec/12 §3, #778, D-195).

Fails on a call that makes an atom from a string — String.to_atom, :erlang.binary_to_atom, List.to_atom, :erlang.list_to_atom — or an interpolated atom literal (:"…#{…}…") on any line of a .ex file under lib/, outside the allowlist audit/atoms_allowlist.exs. Each entry names a file, a fragment of the lines it allows, how many lines of the file hold that fragment, its class of D-195 and its reason; an entry whose count is not what the file holds fails too, so the list cannot go stale. A comment line makes no atom and is passed over. String.to_existing_atom is not matched: it makes none.

The classes are (a) a closed library vocabulary, (a-host) a vocabulary host code registers and (d) a set the library bounds. A name a document or a client declares — class (b) — and one derived from such names — class (c) — is a string (D-195), so an entry of either fails.

Summary

Functions

Every problem under root, one line each; [] when there is none.

Functions

run(root)

@spec run(Path.t()) :: [String.t()]

Every problem under root, one line each; [] when there is none.