@@ -159,7 +159,7 @@ function parseQueryStatus(data) {
159159 icon = "fa-solid fa-cloud-download-alt" ;
160160 fieldtext =
161161 ( data . reply . type !== "UNKNOWN" ? "Forwarded, reply from " : "Forwarded to " ) +
162- data . upstream ;
162+ utils . escapeHtml ( data . upstream ) ;
163163 buttontext =
164164 '<button type="button" class="btn btn-default btn-sm text-red btn-blacklist"><i class="fa fa-ban"></i> Deny</button>' ;
165165 break ;
@@ -270,14 +270,14 @@ function parseQueryStatus(data) {
270270 case "SPECIAL_DOMAIN" :
271271 colorClass = "text-red" ;
272272 icon = "fa-solid fa-ban" ;
273- fieldtext = data . status ;
273+ fieldtext = utils . escapeHtml ( data . status ) ;
274274 buttontext = "" ;
275275 blocked = true ;
276276 break ;
277277 default :
278278 colorClass = "text-orange" ;
279279 icon = "fa-solid fa-question" ;
280- fieldtext = data . status ;
280+ fieldtext = utils . escapeHtml ( data . status ) ;
281281 buttontext = "" ;
282282 }
283283
@@ -374,7 +374,10 @@ function formatInfo(data) {
374374 let cnameInfo = "" ;
375375 if ( queryStatus . isCNAME ) {
376376 cnameInfo =
377- divStart + "Query was blocked during CNAME inspection of " + data . cname + "</div>" ;
377+ divStart +
378+ "Query was blocked during CNAME inspection of " +
379+ utils . escapeHtml ( data . cname ) +
380+ "</div>" ;
378381 }
379382
380383 // Show TTL if applicable
@@ -392,8 +395,8 @@ function formatInfo(data) {
392395 // Show client information, show hostname only if available
393396 const ipInfo =
394397 data . client . name !== null && data . client . name . length > 0
395- ? utils . escapeHtml ( data . client . name ) + " (" + data . client . ip + ")"
396- : data . client . ip ;
398+ ? utils . escapeHtml ( data . client . name ) + " (" + utils . escapeHtml ( data . client . ip ) + ")"
399+ : utils . escapeHtml ( data . client . ip ) ;
397400 const clientInfo = divStart + "Client: <strong>" + ipInfo + "</strong></div>" ;
398401
399402 // Show DNSSEC status if applicable
@@ -418,7 +421,7 @@ function formatInfo(data) {
418421 let replyInfo = "" ;
419422 replyInfo =
420423 data . reply . type !== "UNKNOWN"
421- ? divStart + " Reply: " + data . reply . type + " </div>"
424+ ? divStart + ` Reply: ${ utils . escapeHtml ( data . reply . type ) } </div>`
422425 : divStart + "Reply: No reply received</div>" ;
423426
424427 // Show extended DNS error if applicable
@@ -429,7 +432,7 @@ function formatInfo(data) {
429432 edeInfo += ' class="' + dnssec . color + '"' ;
430433 }
431434
432- edeInfo += ">" + data . ede . text + "</strong></div>" ;
435+ edeInfo += ">" + utils . escapeHtml ( data . ede . text ) + "</strong></div>" ;
433436 }
434437
435438 // Compile extra info for displaying
@@ -640,7 +643,7 @@ $(() => {
640643 " " +
641644 querystatus . colorClass +
642645 "' title='" +
643- utils . escapeHtml ( querystatus . fieldtext ) +
646+ querystatus . fieldtext +
644647 "'></i>"
645648 ) ;
646649 } else if ( querystatus . colorClass !== false ) {
0 commit comments