@@ -11,6 +11,27 @@ import * as sharedEnv from './shared-environment';
1111import * as upload_lib from './upload-lib' ;
1212import * as util from './util' ;
1313
14+ /**
15+ * A list of queries from https://github.com/github/codeql that
16+ * we don't want to run. Disabling them here is a quicker alternative to
17+ * disabling them in the code scanning query suites. Queries should also
18+ * be disabled in the suites, and removed from this list here once the
19+ * bundle is updated to make those suite changes live.
20+ *
21+ * Format is a map from language to an array of path suffixes of .ql files.
22+ */
23+ const DISABLED_BUILTIN_QUERIES : { [ language : string ] : string [ ] } = {
24+ 'csharp' : [
25+ 'ql/src/Security Features/CWE-937/VulnerablePackage.ql' ,
26+ 'ql/src/Security Features/CWE-451/MissingXFrameOptions.ql' ,
27+ ]
28+ } ;
29+
30+ function queryIsDisabled ( language , query ) : boolean {
31+ return ( DISABLED_BUILTIN_QUERIES [ language ] || [ ] )
32+ . some ( disabledQuery => query . endsWith ( disabledQuery ) ) ;
33+ }
34+
1435function getMemoryFlag ( ) : string {
1536 let memoryToUseMegaBytes : number ;
1637 const memoryToUseString = core . getInput ( "ram" ) ;
@@ -125,7 +146,7 @@ async function resolveQueryLanguages(codeqlCmd: string, config: configUtils.Conf
125146 if ( res [ language ] === undefined ) {
126147 res [ language ] = [ ] ;
127148 }
128- res [ language ] . push ( ...Object . keys ( < any > queries ) ) ;
149+ res [ language ] . push ( ...Object . keys ( queries ) . filter ( q => ! queryIsDisabled ( language , q ) ) ) ;
129150 }
130151 }
131152
@@ -136,7 +157,7 @@ async function resolveQueryLanguages(codeqlCmd: string, config: configUtils.Conf
136157 if ( res [ language ] === undefined ) {
137158 res [ language ] = [ ] ;
138159 }
139- res [ language ] . push ( ...Object . keys ( < any > queries ) ) ;
160+ res [ language ] . push ( ...Object . keys ( queries ) ) ;
140161 }
141162
142163 const noDeclaredLanguage = resolveQueriesOutputObject . noDeclaredLanguage ;
0 commit comments