Ithibati.Credo.NoDirectTableAccess (Ithibati v0.1.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

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

Explanation

Reach Ithibati's tables through Ithibati, rather than querying them directly.

This is not a matter of taste. A session row is only a sign-in for as long as its validity allows, which Ithibati.Identity checks on every lookup, so a hand-written query against the sessions table signs somebody in months after they stopped. A recovery code is single-use, and the code that spends it enforces that, not the row: a query that reads one directly can spend it twice. The same applies to the keys table, where a credential is only valid for the account it was enrolled against.

Read the tables through Ithibati.Identity instead. If something you need is not reachable from there, report it rather than working around it, because the gap is in Ithibati.

Matching on a struct Ithibati handed you, such as %Ithibati.UserKey{} = key, is not this, and neither is an alias. Only using one as the thing being read is.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.