Skip to content

Commit

Permalink
Fix LWTrace leaking HTTP request string to HTML page (ydb-platform#7011
Browse files Browse the repository at this point in the history
  • Loading branch information
the-ancient-1 committed Jul 23, 2024
1 parent bf5f3d7 commit 0e8c9d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/cpp/lwtrace/mon/mon_lwtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ struct TLogQuery {
}
} catch (...) {
ythrow yexception()
<< CurrentExceptionMessage()
<< EncodeHtmlPcdata(CurrentExceptionMessage())
<< " while parsing track log query: "
<< Text;
}
Expand Down Expand Up @@ -1853,7 +1853,7 @@ class TTracesHtmlPrinter {
try {
Os << src->GetStartTime().ToStringUpToSeconds();
} catch (...) {
Os << "error: " << CurrentExceptionMessage();
Os << "error: " << EncodeHtmlPcdata(CurrentExceptionMessage());
}
Os << "</td>"
<< "<td><div class=\"dropdown\">"
Expand Down Expand Up @@ -3821,17 +3821,17 @@ class TLWTraceMonPage : public NMonitoring::IMonPage {
}
} catch (TPageGenBase& gen) {
out.Clear();
out << gen.what();
out << EncodeHtmlPcdata(gen.what());
} catch (...) {
out.Clear();
if (request.GetParams().Get("error") == "text") {
// Text error reply is helpful for ajax requests
out << NMonitoring::HTTPOKTEXT;
out << CurrentExceptionMessage();
out << EncodeHtmlPcdata(CurrentExceptionMessage());
} else {
WWW_HTML(out) {
out << "<h2>Error</h2><pre>"
<< CurrentExceptionMessage()
<< EncodeHtmlPcdata(CurrentExceptionMessage())
<< Endl;
}
}
Expand Down

0 comments on commit 0e8c9d1

Please sign in to comment.