Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions extensions/ql-vscode/src/remote-queries/remote-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 12 additions & 2 deletions extensions/ql-vscode/src/remote-queries/run-remote-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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);
Expand All @@ -453,6 +462,7 @@ async function buildRemoteQueryEntity(
queryName,
queryFilePath,
queryText,
language,
controllerRepository: {
owner: controllerRepoOwner,
name: controllerRepoName,
Expand Down
1 change: 1 addition & 0 deletions extensions/ql-vscode/src/remote-queries/sample-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface RemoteQueryResult {
queryFileName: string;
queryFilePath: string;
queryText: string;
language: string;
workflowRunUrl: string;
totalRepositoryCount: number;
affectedRepositoryCount: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const emptyQueryResult: RemoteQueryResult = {
queryFileName: '',
queryFilePath: '',
queryText: '',
language: '',
workflowRunUrl: '',
totalRepositoryCount: 0,
affectedRepositoryCount: 0,
Expand Down