This commit is contained in:
Charis Kyriakou 2022-02-28 13:12:01 +00:00 коммит произвёл GitHub
Родитель bf68d21830
Коммит 649d6d94a3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -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,