Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Check: preventing LIKE-injections in Ecto #88

Open
thbar opened this issue Jul 25, 2023 · 1 comment
Open

New Check: preventing LIKE-injections in Ecto #88

thbar opened this issue Jul 25, 2023 · 1 comment

Comments

@thbar
Copy link

thbar commented Jul 25, 2023

What do you want Credo to do?

See:

You should be very careful when allowing user sent data to be used as part of LIKE query, since they allow to perform LIKE-injections.

During a code review today, I thought it would have been nice to be warned about that, and that the infrastructure available in Credo could probably help detect cases like:

def search(%{"q" => q}) do
    ilike_search = "%#{q}%"
    # ...
    |> where([contact: c], ilike(c.organization, ^ilike_search))

I am not sure exactly how, and if this is "easy" to implement as a Credo check, but it would be quite nice to get such alerts. Maybe a security scanner is a better place?

@thbar
Copy link
Author

thbar commented Jul 25, 2023

Maybe https://github.com/nccgroup/sobelow/issues is a better place for this, just launching the discussion here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant