Avoid leaking technical information via console functions
defmodule Vulnerable do
def process(data) do
IO.inspect(data)
# Process data
end
end
The
IO.inspect
function is used to print the data to the console. This could expose sensitive information in a production environment.
defmodule Secure do
def process(data) do
# IO.inspect(data)
# Process data
end
end
In the secure example, the
IO.inspect
function has been commented out to prevent information leakage. Logging to files or using proper logging libraries would be a more secure approach.