44ccfacbe3a3d4b300f80d48651c77837a4b571e galt Tue Apr 26 11:12:02 2022 -0700 SQL INJECTION Prevention Version 2 - this improves our methods by making subclauses of SQL that get passed around be both easy and correct to use. The way that was achieved was by getting rid of the obscure and not well used functions sqlSafefFrag and sqlDyStringPrintfFrag and replacing them with the plain versions of those functions, since these are not needed anymore. The new version checks for NOSQLINJ in unquoted %-s which is used to include SQL clauses, and will give an error the NOSQLINJ clause is not present, and this will automatically require the correct behavior by developers. sqlDyStringPrint is a very useful function, however because it was not enforced, users could use various other dyString functions and they operated without any awareness or checking for SQL correct use. Now those dyString functions are prohibited and it will produce an error if you try to use a dyString function on a SQL string, which is simply detected by the presence of the NOSQLINJ prefix. diff --git src/hg/altSplice/affySplice/altHtmlPages.c src/hg/altSplice/affySplice/altHtmlPages.c index c832b9d..f20231c 100644 --- src/hg/altSplice/affySplice/altHtmlPages.c +++ src/hg/altSplice/affySplice/altHtmlPages.c @@ -1033,31 +1033,31 @@ int offSet = 100; int i = 0; dyStringClear(buff); dyStringPrintf(buff, "<a target=\"plots\" href=\"http://mdb1-sugnet.gi.ucsc.edu/cgi-bin/mdbSpliceGraph?mdbsg.calledSelf=on&coordString=%s:%c:%s:%d-%d&mdbsg.cs=%d&mdbsg.ce=%d&mdbsg.expName=%s&mdbsg.probeSummary=on&mdbsg.toScale=on%s\">", "mm2", js->strand[0], js->chrom, js->chromStart, js->chromEnd, js->chromStart - offSet, js->chromEnd + offSet, "AffyMouseSplice1-02-2004", suffix); dyStringPrintf(buff, "%s", name); dyStringPrintf(buff, "</a> "); } void makeJunctExpressedTissues(struct junctSet *js, struct dyString *buff, int junctIx, struct resultM *probM) { int offSet = 100; int i = 0; -struct dyString *dy = newDyString(1048); +struct dyString *dy = dyStringNew(1048); char anchor[128]; dyStringClear(buff); for(i = 0; i < probM->colCount; i++) { if(js->junctProbs[junctIx][i] >= presThresh && geneExpressed(js, i)) { safef(anchor, sizeof(anchor), "#%s", probM->colNames[i]); makeJunctMdbGenericLink(js, dy, probM->colNames[i], probM, anchor); dyStringPrintf(buff, "%s, ", dy->string); } } dyStringFree(&dy); } @@ -1084,31 +1084,31 @@ js->chromStart - offSet, js->chromEnd + offSet, "AffyMouseSplice1-02-2004"); for(i = 0; i < probM->colCount; i++) { if(js->junctProbs[junctIx][i] >= presThresh && geneExpressed(js, i)) dyStringPrintf(buff, "%s,", probM->colNames[i]); } dyStringPrintf(buff, "</a> "); } void makeJunctNotExpressedTissues(struct junctSet *js, struct dyString *buff, int junctIx, struct resultM *probM) { int offSet = 100; int i = 0; -struct dyString *dy = newDyString(1048); +struct dyString *dy = dyStringNew(1048); char anchor[128]; dyStringClear(buff); for(i = 0; i < probM->colCount; i++) { if(js->junctProbs[junctIx][i] <= absThresh) { safef(anchor, sizeof(anchor), "#%s", probM->colNames[i]); makeJunctMdbGenericLink(js, dy, probM->colNames[i], probM, anchor); dyStringPrintf(buff, "%s, ", dy->string); } } dyStringFree(&dy); } @@ -1185,31 +1185,31 @@ case alt3PrimeSoft: return "txEnd"; case alt5PrimeSoft: return "txStart"; default: return "unknown"; } return NULL; } void outputLinks(struct junctSet **jsList, struct hash *bedHash, struct resultM *probM, FILE *out) /* Output a report for each junction set. */ { struct junctSet *js = NULL; int colIx = 0, junctIx = 0; -struct dyString *dy = newDyString(2048); +struct dyString *dy = dyStringNew(2048); if(optionExists("sortByExonCorr")) slSort(jsList, junctSetExonCorrCmp); else if(optionExists("sortByExonPercent")) slSort(jsList, junctSetExonPercentCmp); else slSort(jsList, junctSetScoreCmp); fprintf(out, "<ol>\n"); for(js = *jsList; js != NULL; js = js->next) { if(js->score <= 1) { char affyName[256]; boolean gray = FALSE; char *tmp = NULL; char *col = NULL;