-
Notifications
You must be signed in to change notification settings - Fork 592
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
Fix XSS attack vector #1264
Fix XSS attack vector #1264
Conversation
Could you check these places? plug/lib/plug/templates/debugger.md.eex Lines 34 to 38 in 12b1acf
seems like query_string and headers may be vulnerable as well |
@fuelen nice catch, tnx :) |
I think the correct approach here is to just escape the whole textarea content: diff --git a/lib/plug/debugger.ex b/lib/plug/debugger.ex
index 1974db6..4f69d7b 100644
--- a/lib/plug/debugger.ex
+++ b/lib/plug/debugger.ex
@@ -234,7 +234,7 @@ defmodule Plug.Debugger do
Keyword.merge(assigns,
conn: conn,
message: maybe_autolink(message),
- markdown: markdown,
+ markdown: h(markdown),
style: style,
banner: banner,
actions: actions,
diff --git a/lib/plug/templates/debugger.html.eex b/lib/plug/templates/debugger.html.eex
index fdc8f20..94242a1 100644
--- a/lib/plug/templates/debugger.html.eex
+++ b/lib/plug/templates/debugger.html.eex
@@ -1057,7 +1057,7 @@
function copyToClipboard () {
if(navigator.clipboard) {
// For those working on localhost or HTTPS
- navigator.clipboard.writeText($copy.innerHTML).then(copiedClipboard).catch(() => {})
+ navigator.clipboard.writeText($copy.textContent).then(copiedClipboard).catch(() => {})
} else {
// For those working on HTTP
$copy.select() The copy button should use Not sure if escaping in the markdown template itself is necessary. I guess that depends on who is rendering the markdown, but that's typically not a browser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! @josevalim
💚 💙 💜 💛 ❤️ |
@see https://elixirforum.com/t/phoenix-debug-errors-vulnerable-to-xss/69936