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/makeDb/hgCutters/hgCutters.c src/hg/makeDb/hgCutters/hgCutters.c
index c05b10f..82b2a3d 100644
--- src/hg/makeDb/hgCutters/hgCutters.c
+++ src/hg/makeDb/hgCutters/hgCutters.c
@@ -50,31 +50,31 @@
     "    name varchar(255) not null,	# Name of Enzyme\n"
     "    size int unsigned not null,	# Size of recognition sequence\n"
     "    matchSize int unsigned not null,	# size without Ns\n"
     "    seq varchar(255) not null,	# Recognition sequence\n"
     "    cut int unsigned not null,	# Cut site on the plus strand\n"
     "    overhang int not null,	# Overhang\n"
     "    palindromic tinyint unsigned not null,	# 1 if it's panlidromic, 0 if not.\n"
     "    semicolon tinyint unsigned not null,	# 1 if it's from a REBASE record that has a semicolon in front, 0 if not.\n"
     "    numSciz int unsigned not null,	# Number of isoscizomers\n"
     "    scizs longblob not null,	# Names of isosizomers\n"
     "    numCompanies int unsigned not null,	# Number of companies selling this enzyme\n"
     "    companies longblob not null,	# Company letters\n"
     "    numRefs int unsigned not null,	# Number of references\n"
     "    refs longblob not null	# Reference numbers\n"
     ")\n";
-struct dyString *dy = newDyString(1024);
+struct dyString *dy = dyStringNew(1024);
 sqlDyStringPrintf(dy, createString, tableName);
 sqlRemakeTable(conn, tableName, dy->string);
 dyStringFree(&dy);
 }
 
 void loadOverrides(char *overrides)
 /* Load overrides from file into the two global slName lists. */
 {
 struct lineFile *lf = lineFileOpen(overrides,TRUE);
 char *words[2];
 
 while (lineFileChop(lf,words))
     {
     if (sameWord(words[0],"include"))
 	slNameStore(&includes, words[1]);