File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -292,14 +292,13 @@ export function isCanary() {
292292 */
293293export const NO_CACHE_AST_VIEWER = new Setting ( 'disableCache' , AST_VIEWER_SETTING ) ;
294294
295- /*
295+ /**
296296 * Lists of GitHub repositories that you want to query remotely via the "Run Remote query" command.
297297 * Note: This command is only available for internal users.
298298 *
299299 * This setting should be a JSON object where each key is a user-specified name (string),
300300 * and the value is an array of GitHub repositories (of the form `<owner>/<repo>`).
301301 */
302-
303302const REMOTE_REPO_LISTS = new Setting ( 'remoteRepositoryLists' , ROOT_SETTING ) ;
304303
305304export function getRemoteRepositoryLists ( ) : Record < string , string [ ] > | undefined {
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ async function getRepositories(): Promise<string[] | undefined> {
6969 placeHolder : 'Select a repository list. You can define repository lists in the `codeQL.remoteRepositoryLists` setting.' ,
7070 ignoreFocusOut : true ,
7171 } ) ;
72- if ( quickpick && quickpick . repoList . length > 0 ) {
72+ if ( quickpick ? .repoList . length ) {
7373 void logger . log ( `Selected repositories: ${ quickpick . repoList } ` ) ;
7474 return quickpick . repoList ;
7575 } else {
@@ -78,6 +78,7 @@ async function getRepositories(): Promise<string[] | undefined> {
7878 }
7979 } else {
8080 void logger . log ( 'No repository lists defined. Displaying text input box.' ) ;
81+ const repoRegex = / ^ (?: [ a - z A - Z 0 - 9 ] + - ? ) * [ a - z A - Z 0 - 9 ] \/ [ a - z A - Z 0 - 9 - _ ] + $ / ;
8182 const remoteRepo = await window . showInputBox ( {
8283 title : 'Enter a GitHub repository in the format <owner>/<repo> (e.g. github/codeql)' ,
8384 placeHolder : '<owner>/<repo>' ,
@@ -87,6 +88,9 @@ async function getRepositories(): Promise<string[] | undefined> {
8788 if ( ! remoteRepo ) {
8889 void showAndLogErrorMessage ( 'No repositories entered.' ) ;
8990 return ;
91+ } else if ( ! repoRegex . test ( remoteRepo ) ) { // Check if user entered invalid input
92+ void showAndLogErrorMessage ( 'Invalid repository format. Must be in the format <owner>/<repo> (e.g. github/codeql)' ) ;
93+ return ;
9094 }
9195 void logger . log ( `Entered repository: ${ remoteRepo } ` ) ;
9296 return [ remoteRepo ] ;
You can’t perform that action at this time.
0 commit comments