Expose Remote Query language (#1173)
This commit is contained in:
Родитель
bf68d21830
Коммит
649d6d94a3
|
@ -77,6 +77,7 @@ export class RemoteQueriesInterfaceManager {
|
|||
queryFileName: queryFileName,
|
||||
queryFilePath: query.queryFilePath,
|
||||
queryText: query.queryText,
|
||||
language: query.language,
|
||||
workflowRunUrl: `https://github.com/${query.controllerRepository.owner}/${query.controllerRepository.name}/actions/runs/${query.actionsWorkflowRunId}`,
|
||||
totalRepositoryCount: query.repositories.length,
|
||||
affectedRepositoryCount: affectedRepositories.length,
|
||||
|
|
|
@ -4,6 +4,7 @@ export interface RemoteQuery {
|
|||
queryName: string;
|
||||
queryFilePath: string;
|
||||
queryText: string;
|
||||
language: string;
|
||||
controllerRepository: Repository;
|
||||
repositories: Repository[];
|
||||
executionStartTime: number; // Use number here since it needs to be serialized and desserialized.
|
||||
|
|
|
@ -314,7 +314,15 @@ export async function runRemoteQuery(
|
|||
return;
|
||||
}
|
||||
|
||||
const remoteQuery = await buildRemoteQueryEntity(repositories, queryFile, queryMetadata, owner, repo, queryStartTime, workflowRunId);
|
||||
const remoteQuery = await buildRemoteQueryEntity(
|
||||
repositories,
|
||||
queryFile,
|
||||
queryMetadata,
|
||||
owner,
|
||||
repo,
|
||||
queryStartTime,
|
||||
workflowRunId,
|
||||
language);
|
||||
|
||||
// don't return the path because it has been deleted
|
||||
return { query: remoteQuery };
|
||||
|
@ -437,7 +445,8 @@ async function buildRemoteQueryEntity(
|
|||
controllerRepoOwner: string,
|
||||
controllerRepoName: string,
|
||||
queryStartTime: number,
|
||||
workflowRunId: number
|
||||
workflowRunId: number,
|
||||
language: string
|
||||
): Promise<RemoteQuery> {
|
||||
// The query name is either the name as specified in the query metadata, or the file name.
|
||||
const queryName = queryMetadata?.name ?? path.basename(queryFilePath);
|
||||
|
@ -453,6 +462,7 @@ async function buildRemoteQueryEntity(
|
|||
queryName,
|
||||
queryFilePath,
|
||||
queryText,
|
||||
language,
|
||||
controllerRepository: {
|
||||
owner: controllerRepoOwner,
|
||||
name: controllerRepoName,
|
||||
|
|
|
@ -6,6 +6,7 @@ export const sampleRemoteQuery: RemoteQuery = {
|
|||
queryName: 'Inefficient regular expression',
|
||||
queryFilePath: '/Users/foo/dev/vscode-codeql-starter/ql/javascript/ql/src/Performance/ReDoS.ql',
|
||||
queryText: '/**\n * @name Inefficient regular expression\n * @description A regular expression that requires exponential time to match certain inputs\n * can be a performance bottleneck, and may be vulnerable to denial-of-service\n * attacks.\n * @kind problem\n * @problem.severity error\n * @security-severity 7.5\n * @precision high\n * @id js/redos\n * @tags security\n * external/cwe/cwe-1333\n * external/cwe/cwe-730\n * external/cwe/cwe-400\n */\n\nimport javascript\nimport semmle.javascript.security.performance.ReDoSUtil\nimport semmle.javascript.security.performance.ExponentialBackTracking\n\nfrom RegExpTerm t, string pump, State s, string prefixMsg\nwhere hasReDoSResult(t, pump, s, prefixMsg)\nselect t,\n "This part of the regular expression may cause exponential backtracking on strings " + prefixMsg +\n "containing many repetitions of \'" + pump + "\'."\n',
|
||||
language: 'javascript',
|
||||
controllerRepository: {
|
||||
owner: 'big-corp',
|
||||
name: 'controller-repo'
|
||||
|
|
|
@ -6,6 +6,7 @@ export interface RemoteQueryResult {
|
|||
queryFileName: string;
|
||||
queryFilePath: string;
|
||||
queryText: string;
|
||||
language: string;
|
||||
workflowRunUrl: string;
|
||||
totalRepositoryCount: number;
|
||||
affectedRepositoryCount: number;
|
||||
|
|
|
@ -25,6 +25,7 @@ const emptyQueryResult: RemoteQueryResult = {
|
|||
queryFileName: '',
|
||||
queryFilePath: '',
|
||||
queryText: '',
|
||||
language: '',
|
||||
workflowRunUrl: '',
|
||||
totalRepositoryCount: 0,
|
||||
affectedRepositoryCount: 0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче