764e1dff7737828ea9d3395804db520628e91a69
braney
Tue Aug 18 10:59:46 2026 -0700
hgTracks: encode assembly and group header text consistently, refs #38123
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 442d61d3c3f..71f2ae89df5 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -9712,57 +9712,61 @@
* narrow */
hPrintf("
\n");
printMenuBar();
//menuBarAppendExtTools();
/* Show title */
freezeName = hFreezeFromDb(database);
if(freezeName == NULL)
freezeName = "Unknown";
hPrintf("");
// for these assemblies, we do not display the year, to save space and reduce clutter
// Their names must include a "(" character
char* noYearDbs[] = { "hg19", "hg38", "mm39", "mm10" };
+ // on an assembly hub the organism, the freezeName (the hub's genome description) and the
+ // db name are all supplied by the hub, so escape them before they go in the page
if ( stringArrayIx(database, noYearDbs, ArraySize(noYearDbs)) != -1 )
{
// freezeName is e.g. "Feb. 2009 (GRCh37/hg19)"
char *afterParen = skipBeyondDelimit(freezeName, '(');
afterParen--; // move back one char
- hPrintf("%s %s on %s %s", organization, browserName, organism, afterParen);
+ hPrintf("%s %s on %s %s", organization, browserName, htmlEncode(organism),
+ htmlEncode(afterParen));
}
else if (startsWith("zoo",database) )
{
hPrintf("%s %s on %s June 2002 Assembly %s target1",
- organization, browserName, organism, freezeName);
+ organization, browserName, htmlEncode(organism), htmlEncode(freezeName));
}
else
{
if (sameString(organism, "Archaea"))
{
hPrintf("%s %s on Archaeon %s Assembly",
- organization, browserName, freezeName);
+ organization, browserName, htmlEncode(freezeName));
}
else
{
if (stringIn(database, freezeName))
hPrintf("%s %s on %s %s",
- organization, browserName, organism, freezeName);
+ organization, browserName, htmlEncode(organism), htmlEncode(freezeName));
else
hPrintf("%s %s on %s %s (%s)",
- organization, browserName, trackHubSkipHubName(organism), freezeName, trackHubSkipHubName(database));
+ organization, browserName, htmlEncode(trackHubSkipHubName(organism)),
+ htmlEncode(freezeName), htmlEncode(trackHubSkipHubName(database)));
}
}
hPrintf("");
//hPrintf(""
//"Assembly Info", cartSessionId(cart));
printDatabaseInfoHtml(database);
// Disable recommended track set panel when changing tracks, session, database
char *sessionLabel = cartOptionalString(cart, hgsOtherUserSessionLabel);
char *oldDb = hashFindVal(oldVars, "db");
if (sessionLabel)
{
if (defaultTracks || hideAll || hideTracks ||
@@ -10175,84 +10179,93 @@
jsOnEventByIdF("click", idText, "return vis.toggleForGroup(this, '%s');", group->name);
if (isHubTrack(group->name))
{
if (strstr(group->label, "Collections"))
{
safef(idText, sizeof idText, "%s_edit", group->name);
hPrintf("\n", idText);
jsOnEventByIdF("click", idText,
"document.editHubForm.submit();return true;");
}
}
- hPrintf("
\n%s", group->label);
+ // group->label for a hub group is built from the hub shortLabel and the hub's
+ // groups.txt label, both supplied by the hub, so escape it
+ hPrintf("
\n%s", htmlEncode(group->label));
char *hubName = hubNameFromGroupName(group->name);
struct trackHub *hub = grabHashedHub(hubName);
if (hub && hub->url)
{
puts(" ");
char infoText[10000];
if (startsWith("QuickLift", group->label))
safef(infoText, sizeof infoText, "This is a QuickLift track group that contains \
tracks that are annotations on %s that have been lifted to this \
assembly, along with a track (Alignment Differences) that shows \
mismatches and indels between %s and this assembly."\
, hub->defaultDb, hub->defaultDb);
else
safef(infoText, sizeof infoText, "A track hub is a list of tracks produced and hosted by external data providers. The UCSC browser group is not responsible for them. This hub is loaded from %s", hub->url);
printInfoIconColor(infoText, "white");
}
hPrintf("
\n");
if (hubName)
{
if (cfgOptionBooleanDefault("groupDropdown", FALSE) && hub && hub->genomeList && hub->genomeList->next)
{
puts("Genomes: ");
}
// visibility: hidden means that the element takes up space so the center alignment is not disturbed.
if ((hub != NULL) && !startsWith("QuickLift", group->label))
{
if (hub->descriptionUrl == NULL)
{
hPrintf("No Info");
}
else
{
hPrintf("Info", hub->descriptionUrl);
+ "style='color:#FFF; font-size: 13px;' target=_blank>Info",
+ htmlEncode(hub->descriptionUrl));
}
hPrintf(" ");
}
}
hPrintf(" ",
group->name);
// The BLAT Results group gets a "Delete all" button that removes every BLAT result track
// at once, so users are not stuck deleting accumulated results one by one.
if (sameString(group->name, "blat"))
{