Sobelow.DOS.BinToAtom (Sobelow v0.18.1)

View Source

Denial of Service via Unsafe Atom Interpolation

In Elixir, atoms are not garbage collected. As such, if user input is used to create atoms (as in :"foo#{bar}", or in :erlang.binary_to_atom), it may result in memory exhaustion. Prefer the String.to_existing_atom function for untrusted user input.

This also reports interpolated atom word sigils such as ~w(foo#{bar})a. Qualified Kernel.sigil_w calls and aliases have the same atom semantics. Literal word lists, uppercase ~W sigils, and string/charlist word sigils are omitted. Interpolated values are not evaluated or resolved.

Atom interpolation checks can be ignored with the following command:

$ mix sobelow -i DOS.BinToAtom

Summary

Functions

details()

id()

parse_def(fun)

rule()

run(fun, meta_file)