a1d7c07c50f1d895337de121680ea672b261c058
max
  Mon Aug 17 02:26:36 2026 -0700
escape reflected/echoed user input across several CGIs (XSS), refs #38057

Route user-, DB- and hub-derived values through htmlEncode (HTML/attribute text),
cgiEncode (values composed into URLs), jsonStringEscape (values placed in a JS string
literal inside an inline script) or, for hgMirror, the existing mustBeClean sanitizer.
Covers hgHubConnect, hgUserSuggestion, hgLiftOver, hgBlat, hgc pubs, hgVisiGene,
hgSession, hgTrackUi, hgGenome, phyloPng, hgFileSearch, hgLinkIn, hgPal, hui,
hgPhyloPlace, hgMirror, hgCustom and hgSearch.

diff --git src/hg/hgGenome/mainPage.c src/hg/hgGenome/mainPage.c
index c7145456375..c10dc02cca7 100644
--- src/hg/hgGenome/mainPage.c
+++ src/hg/hgGenome/mainPage.c
@@ -359,31 +359,31 @@
     if (gg->isComposite == FALSE)
 	totalCount++;
     }
 
 AllocArray(menu, totalCount);
 AllocArray(values, totalCount);
 menu[0] = "-- nothing --";
 values[0] = "";
 
 for (ref = ggList; ref != NULL; ref = ref->next)
     {    
     struct genoGraph *gg = ref->val;
     if (gg->isComposite == FALSE)
 	{
 	++i;
-	menu[i] = gg->shortLabel;
+	menu[i] = htmlEncode(gg->shortLabel); // user graph label in dropdown text, escape (XSS)
 	values[i] = gg->name;
 	}
     }
 cgiMakeDropListFull(varName, menu, values, totalCount, curVal, event, js);
 freez(&menu);
 freez(&values);
 }
 
 void colorDropdown(int row, int col, char *event, char *js)
 /* Put up color drop down menu. */
 {
 char *varName = graphColorVarName(row, col);
 char *curVal = graphColorAt(row, col);
 cgiMakeDropListFull(varName, allColors, allColors, ArraySize(allColors), curVal, event, js);
 }