7a185fecc55ea44b360f04d250e64bcbaaf4d53e
hiram
  Wed Sep 2 13:45:33 2026 -0700
remove references and functions related to the "debug" argument, becomes a harmless no-operation and eliminated potential security loop-holes no redmine

diff --git src/hg/hubApi/getData.c src/hg/hubApi/getData.c
index c212ac12540..fe23164e89b 100644
--- src/hg/hubApi/getData.c
+++ src/hg/hubApi/getData.c
@@ -119,57 +119,47 @@
 char *tableName = trackDbSetting(tdb, "table");
 if (isNotEmpty(tableName))
     {
     freeMem(sqlTable);
     sqlTable = cloneString(tableName);
     jsonWriteString(jw, "sqlTable", sqlTable);
     }
 
 /* to be determined if this name is used or changes */
 char *splitSqlTable = cloneString(sqlTable);
 
 /* this function knows how to deal with split chromosomes, the NULL
  * here for the chrom name means to use the first chrom name in chromInfo
  */
 struct hTableInfo *hti = hFindTableInfoWithConn(conn, NULL, sqlTable);
-if (debug && hti)
-    {
-    jsonWriteBoolean(jw, "isPos", hti->isPos);
-    jsonWriteBoolean(jw, "isSplit", hti->isSplit);
-    jsonWriteBoolean(jw, "hasBin", hti->hasBin);
-    }
 /* check if table name needs to be modified */
 if (hti && hti->isSplit)
     {
     if (isNotEmpty(chrom))
 	{
 	char fullTableName[256];
 	safef(fullTableName, sizeof(fullTableName), "%s_%s", chrom, hti->rootName);
 	freeMem(splitSqlTable);
 	splitSqlTable = cloneString(fullTableName);
-	if (debug)
-	    jsonWriteString(jw, "splitSqlTable", splitSqlTable);
 	}
     else
 	{
 	char *defaultChrom = hDefaultChrom(db);
 	char fullTableName[256];
 	safef(fullTableName, sizeof(fullTableName), "%s_%s", defaultChrom, hti->rootName);
 	freeMem(splitSqlTable);
 	splitSqlTable = cloneString(fullTableName);
-	if (debug)
-	    jsonWriteString(jw, "splitSqlTable", splitSqlTable);
 	}
     }
 
 /* determine name for 'chrom' in table select */
 if (! sqlColumnExists(conn, splitSqlTable, "chrom"))
     {
     if (sqlColumnExists(conn, splitSqlTable, "tName"))	// track type psl
 	{
 	safef(chromName, sizeof(chromName), "tName");
 	safef(startName, sizeof(startName), "tStart");
 	safef(endName, sizeof(endName), "tEnd");
 	}
     else if (sqlColumnExists(conn, splitSqlTable, "genoName"))// track type rmsk
 	{
 	safef(chromName, sizeof(chromName), "genoName");
@@ -193,88 +183,85 @@
      * determine if split, and then will go through each chrom
      */
     sqlDyStringPrintf(query, "select * from %s", splitSqlTable);
     }
 else if (0 == (start + end))	/* have chrom, no start,end == full chr */
     {
     if (! sqlColumnExists(conn, splitSqlTable, chromName))
 	apiErrAbort(err400, err400Msg, "track '%s' is not a position track, request track without chrom specification, genome: '%s'", track, db);
 
     jsonWriteString(jw, "chrom", chrom);
     struct chromInfo *ci = hGetChromInfo(db, chrom);
     jsonWriteNumber(jw, "start", (long long)0);
     jsonWriteNumber(jw, "end", (long long)ci->size);
     if (tdb && isWiggleDataTable(tdb->type))
 	{
-	if (jsonOutputArrays || debug)
+	if (jsonOutputArrays)
 	    wigColumnTypes(columnTypesJw, track);
 	jsonWriteListStart(jw, track);
         itemsReturned += wigTableDataOutput(jw, db, splitSqlTable, chrom, 0, ci->size, 0);
 	jsonWriteListEnd(jw);
         return;	/* DONE */
 	}
     else
 	{
 	if (sqlColumnExists(conn, splitSqlTable, startName))
 	    sqlDyStringPrintf(query, "select * from %s where %s='%s' order by %s", splitSqlTable, chromName, chrom, startName);
         else
 	    sqlDyStringPrintf(query, "select * from %s where %s='%s'", splitSqlTable, chromName, chrom);
 	}
     }
 else	/* fully specified chrom:start-end */
     {
     if (! sqlColumnExists(conn, splitSqlTable, chromName))
 	apiErrAbort(err400, err400Msg, "track '%s' is not a position track, request track without chrom and start,end specifications, genome: '%s'", track, db);
 
     jsonWriteString(jw, "chrom", chrom);
     if (tdb && isWiggleDataTable(tdb->type))
 	{
-	if (jsonOutputArrays || debug)
+	if (jsonOutputArrays)
 	    wigColumnTypes(columnTypesJw, track);
 	jsonWriteListStart(jw, track);
         itemsReturned += wigTableDataOutput(jw, db, splitSqlTable, chrom, start, end, 0);
 	jsonWriteListEnd(jw);
         return;	/* DONE */
 	}
     else
 	{
 	sqlDyStringPrintf(query, "select * from %s where ", splitSqlTable);
 	if (sqlColumnExists(conn, splitSqlTable, startName))
 	    {
 	    if (hti->hasBin)
 		hAddBinToQuery(start, end, query);
 	    sqlDyStringPrintf(query, "%s='%s' AND %s > %u AND %s < %u ORDER BY %s", chromName, chrom, endName, start, startName, end, startName);
 	    }
 	else
 	    apiErrAbort(err400, err400Msg, "track '%s' is not a position track, request track without start,end specification, genome: '%s'", track, db);
 	}
     }
 
-if (debug)
-    jsonWriteString(jw, "select", query->string);
-
 /* continuing, could be wiggle output with no chrom specified */
 char **columnNames = NULL;
 char **columnTypes = NULL;
 int *jsonTypes = NULL;
 struct asObject *as = asForTable(conn, splitSqlTable, tdb);
 if (! as)
     apiErrAbort(err500, err500Msg, "can not find schema definition for table '%s', genome: '%s'", splitSqlTable, db);
 struct asColumn *columnEl = as->columnList;
 int asColumnCount = slCount(columnEl);
 int columnCount = tableColumns(conn, splitSqlTable, &columnNames, &columnTypes, &jsonTypes);
-if (jsonOutputArrays || debug)
+if (jsonOutputArrays)
     {
     outputSchema(tdb, columnTypesJw, columnNames, columnTypes, jsonTypes, hti,
 	columnCount, asColumnCount, columnEl, track);
     }
 
 unsigned itemsDone = 0;
 
 /* empty chrom, needs to run through all chrom names */
 if (isEmpty(chrom))
     {
     jsonWriteObjectStart(jw, track);	/* begin track data output */
     char fullTableName[256];
     struct chromInfo *ciList = createChromInfoList(NULL, db);
     slSort(ciList, chromInfoCmp);
     struct chromInfo *ci = ciList;
@@ -461,31 +448,31 @@
 
 hubAliasSetup(hubGenome);
 
 char *chrom = chrOrAlias(genome, hubUrl);
 
 struct trackDb *tdb = obtainTdb(hubGenome, NULL);
 
 if (NULL == tdb)
     apiErrAbort(err400, err400Msg, "failed to find a track hub definition in genome=%s for endpoint '/getData/track'  given hubUrl='%s'", genome, hubUrl);
 
 struct jsonWrite *jw = apiStartOutput();
 jsonWriteString(jw, "hubUrl", hubUrl);
 jsonWriteString(jw, "genome", genome);
 
 struct jsonWrite *columnTypesJw = NULL;
-if (jsonOutputArrays || debug)
+if (jsonOutputArrays)
     {
     columnTypesJw = jsonWriteNew();
     jsonWriteObjectStart(columnTypesJw, "columnTypes");
     }
 
 // allow optional comma sep list of tracks
 char *tracks[MAX_NUM_TRACKS + 1];
 int numTracks = chopByChar(trackArg, ',', tracks, MAX_NUM_TRACKS+1);
 if (numTracks > MAX_NUM_TRACKS)
     apiErrAbort(err400, err400Msg, "too many tracks requested, limit to 100 tracks or less for endpoint '/getData/track'");
 int i = 0;
 for (i = 0; i < numTracks; i++)
     {
     char *track = cloneString(tracks[i]);
     struct trackDb *thisTrack = findTrackDb(track, tdb);
@@ -523,63 +510,63 @@
         uStart = sqlUnsigned(start);
         uEnd = sqlUnsigned(end);
         jsonWriteNumber(jw, "start", uStart);
         jsonWriteNumber(jw, "end", uEnd);
         }
 
     jsonWriteString(jw, "bigDataUrl", bigDataUrl);
     jsonWriteString(jw, "trackType", thisTrack->type);
 
     if (allowedBigBedType(thisTrack->type))
         {
         struct asObject *as = bigBedAsOrDefault(bbi);
         if (! as)
         apiErrAbort(err500, err500Msg, "can not find schema definition for bigDataUrl '%s', track=%s genome: '%s' for endpoint '/getData/track' given hubUrl='%s'", bigDataUrl, track, genome, hubUrl);
         struct sqlFieldType *fiList = sqlFieldTypesFromAs(as);
-        if (jsonOutputArrays || debug)
+        if (jsonOutputArrays)
             bigColumnTypes(columnTypesJw, fiList, as, track);
 
         jsonWriteListStart(jw, track);
         unsigned itemsDone = 0;
         if (isEmpty(chrom))
         {
         struct bbiChromInfo *bci;
         for (bci = chromList; bci && (itemsDone < maxItemsOutput); bci = bci->next)
             {
             itemsDone += bbiDataOutput(jw, bbi, bci->name, 0, bci->size,
             fiList, thisTrack, itemsDone);
             }
             if (itemsDone >= maxItemsOutput)
             reachedMaxItems = TRUE;
         }
         else
         itemsDone += bbiDataOutput(jw, bbi, chrom, uStart, uEnd, fiList,
             thisTrack, itemsDone);
         itemsReturned += itemsDone;
         jsonWriteListEnd(jw);
         }
     else if (startsWith("bigWig", thisTrack->type))
         {
-        if (jsonOutputArrays || debug)
+        if (jsonOutputArrays)
         wigColumnTypes(columnTypesJw, track);
         jsonWriteListStart(jw, track);
         bigWigData(jw, bbi, chrom, uStart, uEnd);
         jsonWriteListEnd(jw);
         }
     bbiFileClose(&bbi);
     }
-if (jsonOutputArrays || debug)
+if (jsonOutputArrays)
     {
     jsonWriteObjectEnd(columnTypesJw);
     jsonWriteAppend(jw, NULL, columnTypesJw);
     jsonWriteFree(&columnTypesJw);
     }
 apiFinishOutput(0, NULL, jw);
 }	/*	static void getHubTrackData(char *hubUrl)	*/
 
 static void getTrackData()
 /* return data from a track, optionally just one chrom data,
  *  optionally just one section of that chrom data
  */
 {
 char *db = cgiOptionalString("genome");
 char *chrom = chrOrAlias(db, NULL);
@@ -616,31 +603,31 @@
 struct jsonWrite *jw = apiStartOutput();
 jsonWriteString(jw, "genome", db);
 
 // load the tracks
 struct trackDb *tdbList = NULL;
 cartTrackDbInitForApi(NULL, db, &tdbList, NULL, TRUE);
 
 // allow optional comma sep list of tracks
 char *tracks[MAX_NUM_TRACKS+1];
 int numTracks = chopByChar(trackArg, ',', tracks, MAX_NUM_TRACKS+1);
 if (numTracks > MAX_NUM_TRACKS)
     apiErrAbort(err400, err400Msg, "too many tracks requested, limit to 100 tracks or less for endpoint '/getData/track'");
 int i = 0;
 struct hash *trackHash = hashNew(0); // let hub tracks work
 struct jsonWrite *columnTypesJw = NULL;
-if (jsonOutputArrays || debug)
+if (jsonOutputArrays)
     {
     columnTypesJw = jsonWriteNew();
     jsonWriteObjectStart(columnTypesJw, "columnTypes");
     }
 for (i = 0; i < numTracks; i++)
     {
     char *track = cloneString(tracks[i]);
     char *sqlTable = cloneString(track);
 
     if (cartTrackDbIsAccessDenied(db, sqlTable) ||
             (cartTrackDbIsNoGenome(db, sqlTable) && !(chrom && start && end)))
         apiErrAbort(err403, err403Msg, "this data request: 'db=%s;track=%s' is protected data, see also: https://genome.ucsc.edu/FAQ/FAQdownloads.html#download40", db, track);
     struct trackDb *thisTrack = tdbForTrack(db, track, &tdbList);
     if (NULL == thisTrack)
         {
@@ -714,32 +701,30 @@
         if (hti && hti->isSplit)
             dataTime = sqlTableUpdate(conn, splitSqlTable);
         else
             dataTime = sqlTableUpdate(conn, sqlTable);
         time_t dataTimeStamp = sqlDateToUnixTime(dataTime);
         replaceChar(dataTime, ' ', 'T');	/*	ISO 8601	*/
         jsonWriteString(jw, "dataTime", dataTime);
         jsonWriteNumber(jw, "dataTimeStamp", (long long)dataTimeStamp);
         if (differentStringNullOk(sqlTable,track))
             jsonWriteString(jw, "sqlTable", sqlTable);
         }
     if (thisTrack)
         jsonWriteString(jw, "trackType", thisTrack->type);
 
     jsonWriteString(jw, "track", track);
-    if (debug)
-        jsonWriteBoolean(jw, "jsonOutputArrays", jsonOutputArrays);
 
     char query[4096];
     struct bbiFile *bbi = NULL;
     struct bbiChromInfo *chromList = NULL;
 
     if (thisTrack && startsWith("big", thisTrack->type))
         {
         if (bigDataUrl)
             bbi = bigFileOpen(thisTrack->type, bigDataUrl);
         else
             {
             char quickReturn[2048];
             sqlSafef(query, sizeof(query), "select fileName from %s", sqlTable);
             if (sqlQuickQuery(conn, query, quickReturn, sizeof(quickReturn)))
                 {
@@ -768,66 +753,66 @@
         }
 
     /* when start, end given, show them */
     if ( uEnd > uStart )
         {
         jsonWriteNumber(jw, "start", uStart);
         jsonWriteNumber(jw, "end", uEnd);
         }
 
     if (thisTrack && allowedBigBedType(thisTrack->type))
         {
         struct asObject *as = bigBedAsOrDefault(bbi);
         if (! as)
             apiErrAbort(err500, err500Msg, "can not find schema definition for bigDataUrl '%s', track=%s genome='%s' for endpoint '/getData/track'", bigDataUrl, track, db);
         struct sqlFieldType *fiList = sqlFieldTypesFromAs(as);
-        if (jsonOutputArrays || debug)
+        if (jsonOutputArrays)
             bigColumnTypes(columnTypesJw, fiList, as, track);
 
         jsonWriteListStart(jw, track);
         unsigned itemsDone = 0;
         if (isEmpty(chrom))
             {
             struct bbiChromInfo *bci;
             for (bci = chromList; bci && (itemsDone < maxItemsOutput); bci = bci->next)
                 {
                 itemsDone += bbiDataOutput(jw, bbi, bci->name, 0, bci->size,
                     fiList, thisTrack, itemsDone);
                 }
                 if (itemsDone >= maxItemsOutput)
                     reachedMaxItems = TRUE;
             }
         else
             itemsDone += bbiDataOutput(jw, bbi, chrom, uStart, uEnd, fiList,
                     thisTrack, itemsDone);
         itemsReturned += itemsDone;
         jsonWriteListEnd(jw);
         }
     else if (thisTrack && startsWith("bigWig", thisTrack->type))
         {
-        if (jsonOutputArrays || debug)
+        if (jsonOutputArrays)
             wigColumnTypes(columnTypesJw, track);
 
         jsonWriteListStart(jw, track);
         bigWigData(jw, bbi, chrom, uStart, uEnd);
         jsonWriteListEnd(jw);
         bbiFileClose(&bbi);
         }
     else
         tableDataOutput(db, thisTrack, conn, jw, track, chrom, uStart, uEnd, columnTypesJw);
     }
-if (jsonOutputArrays || debug)
+if (jsonOutputArrays)
     {
     jsonWriteObjectEnd(columnTypesJw);
     jsonWriteAppend(jw, NULL, columnTypesJw);
     jsonWriteFree(&columnTypesJw);  
     }
 
 apiFinishOutput(0, NULL, jw);
 hFreeConn(&conn);
 }	/*	static void getTrackData()	*/
 
 static void getSequenceData(char *db, char *hubUrl)
 /* return DNA sequence, given at least a genome=name and chrom=chr,
    optionally start and end, might be a track hub for UCSC database  */
 {
 char *chrom = chrOrAlias(db, hubUrl);