这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rzane
Copy link
Contributor

@rzane rzane commented Jan 17, 2018

Resolves #2.

@rzane rzane force-pushed the put-encrypted-password branch from 70ec68a to e17e6ad Compare January 17, 2018 15:22
@danielberkompas danielberkompas self-requested a review January 17, 2018 21:59
Copy link
Contributor

@danielberkompas danielberkompas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are some conflicts to resolve now that I merged #8. I had one other comment, but overall this looks good!

"""
def put_encrypted_password(changeset, source, destination, algorithm \\ :bcrypt) do
password = get_change(changeset, source)
confirmation = String.to_atom(Atom.to_string(source) <> "_confirmation")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more secure version of this would be:

confirmation = String.to_existing_atom("#{source}_confirmation")

String.to_atom is less safe than String.to_existing_atom, because it creates new atoms. If user input ever gets passed into String.to_atom, the code will have a denial-of-service vulnerability. Atoms aren't garbage collected, so if a user can create atoms, they can crash the server.

For this reason, it's probably safer to just never use String.to_atom.

@rzane rzane force-pushed the put-encrypted-password branch from e17e6ad to 92cdc25 Compare January 17, 2018 23:05
@danielberkompas danielberkompas merged commit b24d98d into infinitered:master Jan 18, 2018
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

Successfully merging this pull request may close these issues.

2 participants