9ad04e0a0b06ec3c4f09ef1b6c3ce6be79b61c68 braney Sun Aug 16 11:56:56 2026 -0700 cart: validate file names read back out of the cart Several cart variables hold the name of a file the server created for a user. Route them through one shared check, isServerUserFilePath(), which accepts the trash directory, the session-data directories and myVariantsDataDir, and apply it both where values enter the cart and where the file names are used. A few of these variables may instead hold a remote URL. Those get their own list and isServerUserFileOrUrl(), because the code that reads them chooses between a fetch and a local open by looking for a protocol. Consolidates two hand-rolled copies of the same test in blatShare.c and customFactory.c, and drops the weaker private copy in sessionData.c. Adds hg/utils/cartFileVarCatalog, a registry that scans the tree for a cart value reaching a file call and reconciles what it finds against the lists in cart.c, so a new one of these cannot be added without somebody noticing. Its --reconcile is quiet enough for the nightly cron the other catalogs use, and it is what turned up seven of the names now on those lists. refs #37623 diff --git src/hg/hgTracks/config.c src/hg/hgTracks/config.c index 2dacb531f32..03505c16f85 100644 --- src/hg/hgTracks/config.c +++ src/hg/hgTracks/config.c @@ -1,1187 +1,1190 @@ /* config - put up track and display configuration page. */ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "common.h" #include "dystring.h" #include "cheapcgi.h" #include "htmshell.h" #include "hdb.h" #include "hCommon.h" #include "cart.h" #include "web.h" #include "customTrack.h" #include "hgTracks.h" +#include "trashDir.h" #include "hgConfig.h" #include "jsHelper.h" #include "imageV2.h" #include "search.h" #include "hubConnect.h" #include "fileUi.h" #include "trackHub.h" #include "versionInfo.h" static void themeDropDown(struct cart* cart) /* Create drop down for UI themes. * specfied in hg.conf like this * browser.theme.modern=background.png,HGStyle * */ { struct slName* themes = cfgNamesWithPrefix("browser.theme."); if (themes==NULL) return; slNameSort(&themes); hPrintf("
| "); hPrintf(" | ||
|---|---|---|
| "); hPrintf("", hgTrackUiName(), cartSessionVarName(), cartSessionId(cart), database, chromName, RULER_TRACK_NAME); hPrintf("%s", RULER_TRACK_LABEL); hPrintf(" | "); hTvDropDownClassVisOnlyWithLabel("ruler", rulerMode, FALSE, rulerMode ? "normalText trackVis" : "hiddenText trackVis", NULL, RULER_TRACK_LABEL); hPrintf(" | "); hPrintf("Chromosome position in bases. (Clicks here zoom in 3x)"); hPrintf(" |
| "); if (tdbIsSuperTrackChild(tdb)) /* indent members of a supertrack */ hPrintf(" "); hPrintIcons(tdb); if (track->hasUi) hPrintf("", tdb->parent ? "Part of super track: " : "Configure ", tdb->parent ? tdb->parent->shortLabel : tdb->shortLabel, hTrackUiForTrack(tdb->track), cartSessionVarName(), cartSessionId(cart), database, track->track); hPrintf(" %s", tdb->shortLabel); if (track->hasUi) hPrintf(""); hPrintf(" | "); if (tdbIsSuperTrackChild(tdb)) /* indent members of a supertrack */ hPrintf(" "); /* If track is not on this chrom print an informational message for the user. */ if (tdbIsDownloadsOnly(tdb)) // No vis display for downloadsOnly hPrintf("Downloads", hgFileUiName(),cartSessionVarName(), cartSessionId(cart), tdb->track); else if (hTrackOnChrom(track->tdb, chromName)) { if (tdbIsSuper(track->tdb)) { /* supertrack dropdown is hide/show */ superTrackDropDown(cart, track->tdb, 1); } else { /* check for option of limiting visibility to one mode */ hTvDropDownClassVisOnlyWithLabel(track->track, track->visibility, rTdbTreeCanPack(track->tdb), (track->visibility == tvHide) ? "hiddenText trackVis" : "normalText trackVis", trackDbSetting(track->tdb, "onlyVisibility"), tdb->shortLabel); } } else hPrintf("[No data-%s]", chromName); hPrintf(" | "); hPrintf("%s", tdb->longLabel); hPrintf(" |
| "); cgiDown(0.9); hPrintf(" | ||