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

Safe HTML #21

Merged
merged 3 commits into from
May 24, 2016
Merged

Safe HTML #21

merged 3 commits into from
May 24, 2016

Conversation

iamvery
Copy link
Owner

@iamvery iamvery commented May 24, 2016

The HTML attributes are built dynamically, and therefore expose an opportunity for an XSS attack. Using the phoenix_html lib, we can sanitize markup just like Phoenix does to mitigate such an attack.

~s(#{safe attribute}="#{safe value}")
end

defp safe(value) do
Copy link
Owner Author

@iamvery iamvery May 24, 2016

Choose a reason for hiding this comment

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

Maybe rename this function to sanitize or escape?

It's more accurate to what the function does.
@iamvery iamvery merged commit 5db35b7 into master May 24, 2016
@iamvery iamvery deleted the safe branch May 24, 2016 20:57
@iamvery iamvery mentioned this pull request Sep 30, 2016
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.

1 participant