# `FeoxDB.CredoChecks.NoUnsafeAtomConversion`
[🔗](https://github.com/ziinc/feoxdb-ex/blob/v0.2.0/credo_checks/no_unsafe_atom_conversion.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

This check has a base priority of `high` and works with any version of Elixir.

## Explanation

Flags calls that convert arbitrary external input into atoms or terms
without a safety net.

FeOxDB is a key-value store that regularly handles keys and values coming
straight from client input (over the wire, from disk, etc). Converting such
input directly into atoms or Erlang terms is dangerous:

  * `String.to_atom/1` creates a *new* atom for every distinct input it
    sees. Since atoms are never garbage collected, an attacker who
    controls the input can exhaust the atom table and crash the whole
    VM. `String.to_existing_atom/1` should be used instead, which raises
    instead of creating new atoms.
  * `:erlang.binary_to_term/1` (without the `[:safe]` option) can
    construct arbitrary terms, including atoms (same atom-table risk as
    above) and function/pid/reference values crafted by a malicious
    payload. `:erlang.binary_to_term/2` with the `:safe` option should be
    used instead.

This check exists purely as a regression guard: this codebase currently
avoids both patterns, but nothing previously stopped a future change from
reintroducing them.

## Check-Specific Parameters

*There are no specific parameters for this check.*

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

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