credo fixes

This commit is contained in:
Graham McIntire 2026-06-14 08:56:02 -05:00
parent d0160f7d8a
commit 5e2a3c229e
3 changed files with 10 additions and 10 deletions

View file

@ -182,12 +182,12 @@
|> String.replace_trailing(".ex", "_test.exs")
end
]},
# {Jump.CredoChecks.ForbiddenFunction,
# [
# functions: [
# {:erlang, :binary_to_term, "Use Plug.Crypto.non_executable_binary_to_term/2 instead."}
# ]
# ]},
{Jump.CredoChecks.ForbiddenFunction,
[
functions: [
{:erlang, :binary_to_term, "Use Plug.Crypto.non_executable_binary_to_term/2 instead."}
]
]},
{Jump.CredoChecks.LiveViewFormCanBeRehydrated},
{Jump.CredoChecks.UndeclaredExternalResource},
{Jump.CredoChecks.PreferChangeOverUpDownMigrations, [start_after: "20250101000000"]},

View file

@ -584,10 +584,10 @@ defmodule SnmpKit.SnmpLib.Cache do
end
defp decompress_value(compressed_value) do
# Use safe: true to prevent arbitrary code execution via malicious cached terms
# Use safe deserialization to prevent arbitrary code execution via malicious cached terms
compressed_value
|> :zlib.uncompress()
|> :erlang.binary_to_term([:safe])
|> Plug.Crypto.non_executable_binary_to_term([:safe])
end
# Pattern matching and invalidation

View file

@ -215,8 +215,8 @@ defmodule SnmpKit.SnmpLib.MIB.Compiler do
def load_compiled(compiled_path) do
case File.read(compiled_path) do
{:ok, binary_data} ->
# Use safe: true to prevent arbitrary code execution via malicious terms
case :erlang.binary_to_term(binary_data, [:safe]) do
# Use safe deserialization to prevent arbitrary code execution via malicious terms
case Plug.Crypto.non_executable_binary_to_term(binary_data, [:safe]) do
%{__type__: :compiled_mib} = compiled ->
{:ok, compiled}