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

to_atom #1

Open
note89 opened this issue Apr 16, 2016 · 1 comment
Open

to_atom #1

note89 opened this issue Apr 16, 2016 · 1 comment

Comments

@note89
Copy link
Member

note89 commented Apr 16, 2016

in database.ex
for {key, val} <- doc, into: %{}, do: {String.to_atom(key), val}

https://elixir-lang.slack.com/team/hamiltop explained that this was not a very good idea in elixir and could lead to a malicious attacker crashing ones servers.
instead to_existing_atom should be used

@AdamBrodzinski
Copy link
Member

@note89 I agree but in this case wouldn't it be possible that those keys were never defined beforehand, making it crash because they're not existing yet? (example being that the DB data doesn't match the schema exactly) Or perhaps they would from the schema definition?

I think the bigger issue is that it's needed in the first place to go from String -> Symbol -> String for the response.

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

2 participants