mobbdev 1.0.116 → 1.0.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +177 -44
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -392,6 +392,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
|
|
|
392
392
|
IssueType_Enum2["HeapInspection"] = "HEAP_INSPECTION";
|
|
393
393
|
IssueType_Enum2["HtmlCommentInJsp"] = "HTML_COMMENT_IN_JSP";
|
|
394
394
|
IssueType_Enum2["HttpOnlyCookie"] = "HTTP_ONLY_COOKIE";
|
|
395
|
+
IssueType_Enum2["HttpParameterPollution"] = "HTTP_PARAMETER_POLLUTION";
|
|
395
396
|
IssueType_Enum2["HttpResponseSplitting"] = "HTTP_RESPONSE_SPLITTING";
|
|
396
397
|
IssueType_Enum2["IframeWithoutSandbox"] = "IFRAME_WITHOUT_SANDBOX";
|
|
397
398
|
IssueType_Enum2["ImproperExceptionHandling"] = "IMPROPER_EXCEPTION_HANDLING";
|
|
@@ -1464,6 +1465,10 @@ var fixDetailsData = {
|
|
|
1464
1465
|
["STRING_TERMINATION_ERROR" /* StringTerminationError */]: {
|
|
1465
1466
|
issueDescription: "String Termination Error occurs when a string is not properly terminated, leading to unexpected behavior or security vulnerabilities.",
|
|
1466
1467
|
fixInstructions: "Implement proper input validation and bounds checking to prevent string termination errors. Use safe string manipulation functions and ensure that the buffer size is properly managed."
|
|
1468
|
+
},
|
|
1469
|
+
["HTTP_PARAMETER_POLLUTION" /* HttpParameterPollution */]: {
|
|
1470
|
+
issueDescription: "HTTP Parameter Pollution occurs when an attacker can manipulate the parameters of an HTTP request to change the behavior of the server.",
|
|
1471
|
+
fixInstructions: "Implement proper input validation and bounds checking to prevent HTTP parameter pollution. Use safe string manipulation functions and ensure that the buffer size is properly managed."
|
|
1467
1472
|
}
|
|
1468
1473
|
};
|
|
1469
1474
|
|
|
@@ -1580,7 +1585,8 @@ var issueTypeMap = {
|
|
|
1580
1585
|
["REDOS" /* Redos */]: "Regular Expression Denial of Service",
|
|
1581
1586
|
["DO_NOT_THROW_GENERIC_EXCEPTION" /* DoNotThrowGenericException */]: "Do Not Throw Generic Exception",
|
|
1582
1587
|
["BUFFER_OVERFLOW" /* BufferOverflow */]: "Buffer Overflow",
|
|
1583
|
-
["STRING_TERMINATION_ERROR" /* StringTerminationError */]: "String Termination Error"
|
|
1588
|
+
["STRING_TERMINATION_ERROR" /* StringTerminationError */]: "String Termination Error",
|
|
1589
|
+
["HTTP_PARAMETER_POLLUTION" /* HttpParameterPollution */]: "HTTP Parameter Pollution"
|
|
1584
1590
|
};
|
|
1585
1591
|
var issueTypeZ = z.nativeEnum(IssueType_Enum);
|
|
1586
1592
|
var getIssueTypeFriendlyString = (issueType) => {
|
|
@@ -5171,9 +5177,7 @@ var MCP_PERIODIC_CHECK_INTERVAL = 15 * 60 * 1e3;
|
|
|
5171
5177
|
var MCP_DEFAULT_MAX_FILES_TO_SCAN = 10;
|
|
5172
5178
|
var MCP_REPORT_ID_EXPIRATION_MS = 2 * 60 * 60 * 1e3;
|
|
5173
5179
|
var MCP_TOOLS_BROWSER_COOLDOWN_MS = 24 * 60 * 60 * 1e3;
|
|
5174
|
-
var
|
|
5175
|
-
var MCP_TOOL_FETCH_AVAILABLE_FIXES = "fetch_available_fixes";
|
|
5176
|
-
var MCP_TOOL_SCAN_AND_FIX_VULNERABILITIES = "scan_and_fix_vulnerabilities";
|
|
5180
|
+
var MCP_DEFAULT_LIMIT = 3;
|
|
5177
5181
|
|
|
5178
5182
|
// src/features/analysis/scm/FileUtils.ts
|
|
5179
5183
|
import fs2 from "fs";
|
|
@@ -5572,6 +5576,27 @@ var GitService = class {
|
|
|
5572
5576
|
throw new Error(errorMessage);
|
|
5573
5577
|
}
|
|
5574
5578
|
}
|
|
5579
|
+
/**
|
|
5580
|
+
* Gets both the current commit hash and current branch name
|
|
5581
|
+
*/
|
|
5582
|
+
async getCurrentCommitAndBranch() {
|
|
5583
|
+
this.log("Getting current commit hash and branch", "debug");
|
|
5584
|
+
try {
|
|
5585
|
+
const [hash, branch] = await Promise.all([
|
|
5586
|
+
this.git.revparse(["HEAD"]),
|
|
5587
|
+
this.git.revparse(["--abbrev-ref", "HEAD"])
|
|
5588
|
+
]);
|
|
5589
|
+
this.log("Current commit hash and branch retrieved", "debug", {
|
|
5590
|
+
hash,
|
|
5591
|
+
branch
|
|
5592
|
+
});
|
|
5593
|
+
return { hash, branch };
|
|
5594
|
+
} catch (error) {
|
|
5595
|
+
const errorMessage = `Failed to get current commit hash and branch: ${error.message}`;
|
|
5596
|
+
this.log(errorMessage, "error", { error });
|
|
5597
|
+
return { hash: "", branch: "" };
|
|
5598
|
+
}
|
|
5599
|
+
}
|
|
5575
5600
|
/**
|
|
5576
5601
|
* Gets the remote repository URL
|
|
5577
5602
|
*/
|
|
@@ -5601,24 +5626,37 @@ var GitService = class {
|
|
|
5601
5626
|
}
|
|
5602
5627
|
}
|
|
5603
5628
|
/**
|
|
5604
|
-
* Gets the maxFiles most recently changed files
|
|
5629
|
+
* Gets the maxFiles most recently changed files, starting with current changes and then from commit history
|
|
5605
5630
|
*/
|
|
5606
5631
|
async getRecentlyChangedFiles({
|
|
5607
5632
|
maxFiles = MCP_DEFAULT_MAX_FILES_TO_SCAN
|
|
5608
5633
|
}) {
|
|
5609
5634
|
this.log(
|
|
5610
|
-
`Getting the ${maxFiles} most recently changed files
|
|
5635
|
+
`Getting the ${maxFiles} most recently changed files, starting with current changes`,
|
|
5611
5636
|
"debug"
|
|
5612
5637
|
);
|
|
5613
5638
|
try {
|
|
5639
|
+
const currentChanges = await this.getChangedFiles();
|
|
5614
5640
|
const gitRoot = await this.git.revparse(["--show-toplevel"]);
|
|
5615
5641
|
const relativePathFromGitRoot = path2.relative(
|
|
5616
5642
|
gitRoot,
|
|
5617
5643
|
this.repositoryPath
|
|
5618
5644
|
);
|
|
5619
5645
|
const fileSet = /* @__PURE__ */ new Set();
|
|
5620
|
-
const files = [];
|
|
5621
5646
|
let commitsProcessed = 0;
|
|
5647
|
+
for (const file of currentChanges.files) {
|
|
5648
|
+
if (fileSet.size >= maxFiles) {
|
|
5649
|
+
break;
|
|
5650
|
+
}
|
|
5651
|
+
const fullPath = path2.join(this.repositoryPath, file);
|
|
5652
|
+
if (FileUtils.shouldPackFile(fullPath) && !file.startsWith("..")) {
|
|
5653
|
+
fileSet.add(file);
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
this.log(`Added ${fileSet.size} files from current changes`, "debug", {
|
|
5657
|
+
filesFromCurrentChanges: fileSet.size,
|
|
5658
|
+
currentChangesTotal: currentChanges.files.length
|
|
5659
|
+
});
|
|
5622
5660
|
const logResult = await this.git.log({
|
|
5623
5661
|
maxCount: maxFiles * 5,
|
|
5624
5662
|
// 5 times the max files to scan to ensure we find enough files
|
|
@@ -5631,7 +5669,7 @@ var GitService = class {
|
|
|
5631
5669
|
}
|
|
5632
5670
|
});
|
|
5633
5671
|
for (const commit of logResult.all) {
|
|
5634
|
-
if (
|
|
5672
|
+
if (fileSet.size >= maxFiles) {
|
|
5635
5673
|
break;
|
|
5636
5674
|
}
|
|
5637
5675
|
commitsProcessed++;
|
|
@@ -5643,7 +5681,7 @@ var GitService = class {
|
|
|
5643
5681
|
]);
|
|
5644
5682
|
const commitFiles = filesOutput.split("\n").filter((file) => file.trim() !== "");
|
|
5645
5683
|
for (const file of commitFiles) {
|
|
5646
|
-
if (
|
|
5684
|
+
if (fileSet.size >= maxFiles) {
|
|
5647
5685
|
break;
|
|
5648
5686
|
}
|
|
5649
5687
|
const gitRelativePath = file.trim();
|
|
@@ -5663,7 +5701,6 @@ var GitService = class {
|
|
|
5663
5701
|
this.log(`Considering file: ${adjustedPath}`, "debug");
|
|
5664
5702
|
if (!fileSet.has(adjustedPath) && FileUtils.shouldPackFile(path2.join(gitRoot, gitRelativePath)) && !adjustedPath.startsWith("..")) {
|
|
5665
5703
|
fileSet.add(adjustedPath);
|
|
5666
|
-
files.push(adjustedPath);
|
|
5667
5704
|
}
|
|
5668
5705
|
}
|
|
5669
5706
|
} catch (showError) {
|
|
@@ -5672,6 +5709,7 @@ var GitService = class {
|
|
|
5672
5709
|
});
|
|
5673
5710
|
}
|
|
5674
5711
|
}
|
|
5712
|
+
const files = Array.from(fileSet);
|
|
5675
5713
|
this.log("Recently changed files retrieved", "info", {
|
|
5676
5714
|
fileCount: files.length,
|
|
5677
5715
|
commitsProcessed,
|
|
@@ -11547,7 +11585,7 @@ var McpAuthService = class {
|
|
|
11547
11585
|
throw new CliLoginError("Error: createCliLogin failed");
|
|
11548
11586
|
}
|
|
11549
11587
|
logDebug(`cli login created ${loginId}`);
|
|
11550
|
-
const webLoginUrl2 = `${WEB_APP_URL}/
|
|
11588
|
+
const webLoginUrl2 = `${WEB_APP_URL}/mvs-login`;
|
|
11551
11589
|
const browserUrl = `${webLoginUrl2}/${loginId}?hostname=${os2.hostname()}`;
|
|
11552
11590
|
await this.openBrowser(browserUrl, isBackgoundCall);
|
|
11553
11591
|
logDebug(`waiting for login to complete`);
|
|
@@ -11871,7 +11909,7 @@ var McpGQLClient = class {
|
|
|
11871
11909
|
}
|
|
11872
11910
|
async getLatestReportByRepoUrl({
|
|
11873
11911
|
repoUrl,
|
|
11874
|
-
limit =
|
|
11912
|
+
limit = MCP_DEFAULT_LIMIT,
|
|
11875
11913
|
offset = 0
|
|
11876
11914
|
}) {
|
|
11877
11915
|
try {
|
|
@@ -11922,7 +11960,7 @@ var McpGQLClient = class {
|
|
|
11922
11960
|
}
|
|
11923
11961
|
async getReportFixesPaginated({
|
|
11924
11962
|
reportId,
|
|
11925
|
-
limit =
|
|
11963
|
+
limit = MCP_DEFAULT_LIMIT,
|
|
11926
11964
|
offset = 0,
|
|
11927
11965
|
issueType,
|
|
11928
11966
|
severity
|
|
@@ -12012,6 +12050,11 @@ async function createAuthenticatedMcpGQLClient({
|
|
|
12012
12050
|
return new McpGQLClient({ apiKey: newApiToken, type: "apiKey" });
|
|
12013
12051
|
}
|
|
12014
12052
|
|
|
12053
|
+
// src/mcp/tools/toolNames.ts
|
|
12054
|
+
var MCP_TOOL_CHECK_FOR_NEW_AVAILABLE_FIXES = "check_for_new_available_fixes";
|
|
12055
|
+
var MCP_TOOL_FETCH_AVAILABLE_FIXES = "fetch_available_fixes";
|
|
12056
|
+
var MCP_TOOL_SCAN_AND_FIX_VULNERABILITIES = "scan_and_fix_vulnerabilities";
|
|
12057
|
+
|
|
12015
12058
|
// src/mcp/core/ToolRegistry.ts
|
|
12016
12059
|
var ToolRegistry = class {
|
|
12017
12060
|
constructor() {
|
|
@@ -12383,6 +12426,47 @@ function friendlyType(s) {
|
|
|
12383
12426
|
}
|
|
12384
12427
|
var noFixesReturnedForParameters = `No fixes returned for the given offset and limit parameters.
|
|
12385
12428
|
`;
|
|
12429
|
+
var noFixesReturnedForParametersWithGuidance = ({
|
|
12430
|
+
offset,
|
|
12431
|
+
limit,
|
|
12432
|
+
totalCount,
|
|
12433
|
+
currentTool
|
|
12434
|
+
}) => `## No Fixes Returned for Current Parameters
|
|
12435
|
+
|
|
12436
|
+
**\u{1F4C4} Current Request:**
|
|
12437
|
+
- **Page:** ${Math.floor(offset / limit) + 1}
|
|
12438
|
+
- **Offset:** ${offset}
|
|
12439
|
+
- **Limit:** ${limit}
|
|
12440
|
+
|
|
12441
|
+
**\u274C Result:** No fixes returned for the given offset and limit parameters.
|
|
12442
|
+
|
|
12443
|
+
**\u2139\uFE0F Available Fixes:** ${totalCount} total fixes are available, but your current offset (${offset}) is beyond the available range.
|
|
12444
|
+
|
|
12445
|
+
**\u2705 How to Get the Fixes:**
|
|
12446
|
+
|
|
12447
|
+
To retrieve the available fixes, use one of these approaches:
|
|
12448
|
+
|
|
12449
|
+
1. **Start from the beginning:**
|
|
12450
|
+
\`\`\`
|
|
12451
|
+
offset: 0
|
|
12452
|
+
\`\`\`
|
|
12453
|
+
|
|
12454
|
+
2. **Go to the first page:**
|
|
12455
|
+
\`\`\`
|
|
12456
|
+
offset: 0
|
|
12457
|
+
limit: ${limit}
|
|
12458
|
+
\`\`\`
|
|
12459
|
+
|
|
12460
|
+
3. **Get all fixes at once:**
|
|
12461
|
+
\`\`\`
|
|
12462
|
+
offset: 0
|
|
12463
|
+
limit: ${totalCount}
|
|
12464
|
+
\`\`\`
|
|
12465
|
+
|
|
12466
|
+
**\u{1F4CB} Valid offset range:** 0 to ${Math.max(0, totalCount - 1)}
|
|
12467
|
+
|
|
12468
|
+
To fetch the fixes, run the \`${currentTool}\` tool again with the corrected parameters.
|
|
12469
|
+
`;
|
|
12386
12470
|
var applyFixesPrompt = ({
|
|
12387
12471
|
fixes,
|
|
12388
12472
|
hasMore,
|
|
@@ -12390,11 +12474,22 @@ var applyFixesPrompt = ({
|
|
|
12390
12474
|
nextOffset,
|
|
12391
12475
|
shownCount,
|
|
12392
12476
|
currentTool,
|
|
12393
|
-
offset
|
|
12477
|
+
offset,
|
|
12478
|
+
limit
|
|
12394
12479
|
}) => {
|
|
12395
12480
|
if (fixes.length === 0) {
|
|
12481
|
+
if (totalCount > 0) {
|
|
12482
|
+
return noFixesReturnedForParametersWithGuidance({
|
|
12483
|
+
offset,
|
|
12484
|
+
limit,
|
|
12485
|
+
totalCount,
|
|
12486
|
+
currentTool
|
|
12487
|
+
});
|
|
12488
|
+
}
|
|
12396
12489
|
return noFixesReturnedForParameters;
|
|
12397
12490
|
}
|
|
12491
|
+
const currentPage = Math.floor(offset / limit) + 1;
|
|
12492
|
+
const totalPages = Math.ceil(totalCount / limit);
|
|
12398
12493
|
const fixList = fixes.map((fix) => {
|
|
12399
12494
|
const vulnerabilityType = friendlyType(fix.safeIssueType);
|
|
12400
12495
|
const vulnerabilityDescription = fix.patchAndQuestions?.__typename === "FixData" ? fix.patchAndQuestions.extraContext?.fixDescription : void 0;
|
|
@@ -12448,6 +12543,12 @@ If you cannot apply a patch:
|
|
|
12448
12543
|
|
|
12449
12544
|
# SECURITY FIXES TO APPLY
|
|
12450
12545
|
|
|
12546
|
+
## \u{1F4C4} Pagination Info
|
|
12547
|
+
- **Page:** ${currentPage} of ${totalPages}
|
|
12548
|
+
- **Offset:** ${offset}
|
|
12549
|
+
- **Limit:** ${limit}
|
|
12550
|
+
- **Showing:** ${shownCount} of ${totalCount} total fixes
|
|
12551
|
+
|
|
12451
12552
|
${fixList.map(
|
|
12452
12553
|
(fix, index) => `
|
|
12453
12554
|
## Fix ${offset + index + 1}: ${fix.vulnerabilityType}
|
|
@@ -12485,9 +12586,9 @@ You have viewed ${shownCount} out of ${totalCount} available fixes.
|
|
|
12485
12586
|
To fetch additional fixes, run the \`${currentTool}\` tool again with the following parameters:
|
|
12486
12587
|
|
|
12487
12588
|
- **offset**: ${nextOffset} _(start index for the next batch)_
|
|
12488
|
-
- **limit**: <number_of_fixes_to_return> _(optional \u2013 default is
|
|
12589
|
+
- **limit**: <number_of_fixes_to_return> _(optional \u2013 default is ${MCP_DEFAULT_LIMIT})_
|
|
12489
12590
|
|
|
12490
|
-
If you omit both **offset** and **limit**, the command will automatically return the next
|
|
12591
|
+
If you omit both **offset** and **limit**, the command will automatically return the next ${MCP_DEFAULT_LIMIT} fixes.
|
|
12491
12592
|
` : ""}
|
|
12492
12593
|
`;
|
|
12493
12594
|
};
|
|
@@ -12544,7 +12645,8 @@ var noFixesAvailablePrompt = `There are no fixes available for this repository a
|
|
|
12544
12645
|
`;
|
|
12545
12646
|
var fixesFoundPrompt = ({
|
|
12546
12647
|
fixReport,
|
|
12547
|
-
offset
|
|
12648
|
+
offset,
|
|
12649
|
+
limit
|
|
12548
12650
|
}) => {
|
|
12549
12651
|
const totalFixes = fixReport.filteredFixesCount.aggregate?.count || 0;
|
|
12550
12652
|
if (totalFixes === 0) {
|
|
@@ -12585,10 +12687,11 @@ ${applyFixesPrompt({
|
|
|
12585
12687
|
fixes: fixReport.fixes,
|
|
12586
12688
|
totalCount: totalFixes,
|
|
12587
12689
|
hasMore,
|
|
12588
|
-
nextOffset
|
|
12690
|
+
nextOffset,
|
|
12589
12691
|
shownCount: fixReport.fixes.length,
|
|
12590
12692
|
currentTool: MCP_TOOL_FETCH_AVAILABLE_FIXES,
|
|
12591
|
-
offset
|
|
12693
|
+
offset,
|
|
12694
|
+
limit
|
|
12592
12695
|
})}`;
|
|
12593
12696
|
};
|
|
12594
12697
|
var nextStepsPrompt = ({ scannedFiles }) => `
|
|
@@ -12625,7 +12728,8 @@ var fixesPrompt = ({
|
|
|
12625
12728
|
fixes,
|
|
12626
12729
|
totalCount,
|
|
12627
12730
|
offset,
|
|
12628
|
-
scannedFiles
|
|
12731
|
+
scannedFiles,
|
|
12732
|
+
limit
|
|
12629
12733
|
}) => {
|
|
12630
12734
|
if (totalCount === 0) {
|
|
12631
12735
|
return noFixesFoundPrompt({ scannedFiles });
|
|
@@ -12642,7 +12746,8 @@ ${applyFixesPrompt({
|
|
|
12642
12746
|
nextOffset,
|
|
12643
12747
|
shownCount,
|
|
12644
12748
|
currentTool: MCP_TOOL_SCAN_AND_FIX_VULNERABILITIES,
|
|
12645
|
-
offset
|
|
12749
|
+
offset,
|
|
12750
|
+
limit
|
|
12646
12751
|
})}
|
|
12647
12752
|
|
|
12648
12753
|
${nextStepsPrompt({ scannedFiles })}
|
|
@@ -12650,7 +12755,10 @@ ${nextStepsPrompt({ scannedFiles })}
|
|
|
12650
12755
|
};
|
|
12651
12756
|
var noFreshFixesPrompt = `No fresh fixes available for this repository at this time. No user message needed. Do not show any comments to the user.`;
|
|
12652
12757
|
var initialScanInProgressPrompt = `Initial scan is still in progress. No user message needed. Do not show any comments to the user.`;
|
|
12653
|
-
var freshFixesPrompt = ({
|
|
12758
|
+
var freshFixesPrompt = ({
|
|
12759
|
+
fixes,
|
|
12760
|
+
limit
|
|
12761
|
+
}) => {
|
|
12654
12762
|
return `Here are the fresh fixes to the vulnerabilities discovered by Mobb MCP
|
|
12655
12763
|
|
|
12656
12764
|
${applyFixesPrompt({
|
|
@@ -12660,7 +12768,8 @@ ${applyFixesPrompt({
|
|
|
12660
12768
|
nextOffset: 0,
|
|
12661
12769
|
shownCount: fixes.length,
|
|
12662
12770
|
currentTool: MCP_TOOL_FETCH_AVAILABLE_FIXES,
|
|
12663
|
-
offset: 0
|
|
12771
|
+
offset: 0,
|
|
12772
|
+
limit
|
|
12664
12773
|
})}
|
|
12665
12774
|
`;
|
|
12666
12775
|
};
|
|
@@ -12859,7 +12968,11 @@ var FileOperations = class {
|
|
|
12859
12968
|
};
|
|
12860
12969
|
|
|
12861
12970
|
// src/mcp/services/ScanFiles.ts
|
|
12862
|
-
var scanFiles = async (
|
|
12971
|
+
var scanFiles = async ({
|
|
12972
|
+
fileList,
|
|
12973
|
+
repositoryPath,
|
|
12974
|
+
gqlClient
|
|
12975
|
+
}) => {
|
|
12863
12976
|
const repoUploadInfo = await initializeSecurityReport(gqlClient);
|
|
12864
12977
|
const fixReportId = repoUploadInfo.fixReportId;
|
|
12865
12978
|
const fileOperations = new FileOperations();
|
|
@@ -12870,7 +12983,17 @@ var scanFiles = async (fileList, repositoryPath, gqlClient) => {
|
|
|
12870
12983
|
);
|
|
12871
12984
|
await uploadSourceCodeArchive(packingResult.archive, repoUploadInfo);
|
|
12872
12985
|
const projectId = await getProjectId(gqlClient);
|
|
12873
|
-
|
|
12986
|
+
const gitService = new GitService(repositoryPath);
|
|
12987
|
+
const { branch } = await gitService.getCurrentCommitAndBranch();
|
|
12988
|
+
const repoUrl = await gitService.getRemoteUrl();
|
|
12989
|
+
await executeSecurityScan({
|
|
12990
|
+
fixReportId,
|
|
12991
|
+
projectId,
|
|
12992
|
+
gqlClient,
|
|
12993
|
+
repoUrl: repoUrl || "",
|
|
12994
|
+
branchName: branch || "no-branch",
|
|
12995
|
+
sha: "0123456789abcdef"
|
|
12996
|
+
});
|
|
12874
12997
|
return {
|
|
12875
12998
|
fixReportId,
|
|
12876
12999
|
projectId
|
|
@@ -12925,7 +13048,10 @@ var getProjectId = async (gqlClient) => {
|
|
|
12925
13048
|
var executeSecurityScan = async ({
|
|
12926
13049
|
fixReportId,
|
|
12927
13050
|
projectId,
|
|
12928
|
-
gqlClient
|
|
13051
|
+
gqlClient,
|
|
13052
|
+
repoUrl,
|
|
13053
|
+
branchName,
|
|
13054
|
+
sha
|
|
12929
13055
|
}) => {
|
|
12930
13056
|
if (!gqlClient) {
|
|
12931
13057
|
throw new GqlClientError();
|
|
@@ -12934,11 +13060,15 @@ var executeSecurityScan = async ({
|
|
|
12934
13060
|
const submitVulnerabilityReportVariables = {
|
|
12935
13061
|
fixReportId,
|
|
12936
13062
|
projectId,
|
|
12937
|
-
repoUrl
|
|
12938
|
-
reference:
|
|
12939
|
-
scanSource: "MCP" /* Mcp
|
|
13063
|
+
repoUrl,
|
|
13064
|
+
reference: branchName,
|
|
13065
|
+
scanSource: "MCP" /* Mcp */,
|
|
13066
|
+
sha
|
|
12940
13067
|
};
|
|
12941
13068
|
logInfo("Submitting vulnerability report");
|
|
13069
|
+
logDebug("Submit vulnerability report variables", {
|
|
13070
|
+
submitVulnerabilityReportVariables
|
|
13071
|
+
});
|
|
12942
13072
|
const submitRes = await gqlClient.submitVulnerabilityReport(
|
|
12943
13073
|
submitVulnerabilityReportVariables
|
|
12944
13074
|
);
|
|
@@ -13041,11 +13171,11 @@ var _CheckForNewAvailableFixesService = class _CheckForNewAvailableFixesService
|
|
|
13041
13171
|
return;
|
|
13042
13172
|
}
|
|
13043
13173
|
logDebug("Files requiring security scan", { filesToScan });
|
|
13044
|
-
const { fixReportId, projectId } = await scanFiles(
|
|
13045
|
-
filesToScan.map((file) => file.relativePath),
|
|
13046
|
-
path13,
|
|
13047
|
-
this.gqlClient
|
|
13048
|
-
);
|
|
13174
|
+
const { fixReportId, projectId } = await scanFiles({
|
|
13175
|
+
fileList: filesToScan.map((file) => file.relativePath),
|
|
13176
|
+
repositoryPath: path13,
|
|
13177
|
+
gqlClient: this.gqlClient
|
|
13178
|
+
});
|
|
13049
13179
|
logInfo(
|
|
13050
13180
|
`Security scan completed for ${path13} reportId: ${fixReportId} projectId: ${projectId}`
|
|
13051
13181
|
);
|
|
@@ -13136,10 +13266,10 @@ var _CheckForNewAvailableFixesService = class _CheckForNewAvailableFixesService
|
|
|
13136
13266
|
});
|
|
13137
13267
|
}
|
|
13138
13268
|
generateFreshFixesResponse() {
|
|
13139
|
-
const freshFixes = this.freshFixes.splice(0,
|
|
13269
|
+
const freshFixes = this.freshFixes.splice(0, MCP_DEFAULT_LIMIT);
|
|
13140
13270
|
if (freshFixes.length > 0) {
|
|
13141
13271
|
this.reportedFixes.push(...freshFixes);
|
|
13142
|
-
return freshFixesPrompt({ fixes: freshFixes });
|
|
13272
|
+
return freshFixesPrompt({ fixes: freshFixes, limit: MCP_DEFAULT_LIMIT });
|
|
13143
13273
|
}
|
|
13144
13274
|
return noFreshFixesPrompt;
|
|
13145
13275
|
}
|
|
@@ -13238,7 +13368,7 @@ var _FetchAvailableFixesService = class _FetchAvailableFixesService {
|
|
|
13238
13368
|
}
|
|
13239
13369
|
async checkForAvailableFixes({
|
|
13240
13370
|
repoUrl,
|
|
13241
|
-
limit =
|
|
13371
|
+
limit = MCP_DEFAULT_LIMIT,
|
|
13242
13372
|
offset
|
|
13243
13373
|
}) {
|
|
13244
13374
|
try {
|
|
@@ -13270,7 +13400,8 @@ var _FetchAvailableFixesService = class _FetchAvailableFixesService {
|
|
|
13270
13400
|
logInfo(`Successfully retrieved available fixes for ${repoUrl}`);
|
|
13271
13401
|
const prompt = fixesFoundPrompt({
|
|
13272
13402
|
fixReport,
|
|
13273
|
-
offset: effectiveOffset
|
|
13403
|
+
offset: effectiveOffset,
|
|
13404
|
+
limit
|
|
13274
13405
|
});
|
|
13275
13406
|
this.currentOffset = effectiveOffset + (fixReport.fixes?.length || 0);
|
|
13276
13407
|
return prompt;
|
|
@@ -13435,21 +13566,22 @@ var _ScanAndFixVulnerabilitiesService = class _ScanAndFixVulnerabilitiesService
|
|
|
13435
13566
|
logInfo("Scanning files");
|
|
13436
13567
|
this.reset();
|
|
13437
13568
|
this.validateFiles(fileList);
|
|
13438
|
-
const scanResult = await scanFiles(
|
|
13569
|
+
const scanResult = await scanFiles({
|
|
13439
13570
|
fileList,
|
|
13440
13571
|
repositoryPath,
|
|
13441
|
-
this.gqlClient
|
|
13442
|
-
);
|
|
13572
|
+
gqlClient: this.gqlClient
|
|
13573
|
+
});
|
|
13443
13574
|
fixReportId = scanResult.fixReportId;
|
|
13444
13575
|
} else {
|
|
13445
13576
|
logInfo("Using stored fixReportId");
|
|
13446
13577
|
}
|
|
13447
13578
|
const effectiveOffset = offset ?? (this.currentOffset || 0);
|
|
13579
|
+
const effectiveLimit = limit ?? MCP_DEFAULT_LIMIT;
|
|
13448
13580
|
logDebug("effectiveOffset", { effectiveOffset });
|
|
13449
13581
|
const fixes = await this.getReportFixes(
|
|
13450
13582
|
fixReportId,
|
|
13451
13583
|
effectiveOffset,
|
|
13452
|
-
|
|
13584
|
+
effectiveLimit
|
|
13453
13585
|
);
|
|
13454
13586
|
logInfo(`Found ${fixes.totalCount} fixes`);
|
|
13455
13587
|
if (fixes.totalCount > 0) {
|
|
@@ -13462,7 +13594,8 @@ var _ScanAndFixVulnerabilitiesService = class _ScanAndFixVulnerabilitiesService
|
|
|
13462
13594
|
fixes: fixes.fixes,
|
|
13463
13595
|
totalCount: fixes.totalCount,
|
|
13464
13596
|
offset: effectiveOffset,
|
|
13465
|
-
scannedFiles: [...fileList]
|
|
13597
|
+
scannedFiles: [...fileList],
|
|
13598
|
+
limit: effectiveLimit
|
|
13466
13599
|
});
|
|
13467
13600
|
this.currentOffset = effectiveOffset + (fixes.fixes?.length || 0);
|
|
13468
13601
|
return prompt;
|
|
@@ -13625,7 +13758,7 @@ Example payload:
|
|
|
13625
13758
|
try {
|
|
13626
13759
|
const fixResult = await this.vulnerabilityFixService.processVulnerabilities({
|
|
13627
13760
|
fileList: files.map((file) => file.relativePath),
|
|
13628
|
-
repositoryPath:
|
|
13761
|
+
repositoryPath: path13,
|
|
13629
13762
|
offset: args.offset,
|
|
13630
13763
|
limit: args.limit,
|
|
13631
13764
|
isRescan: args.rescan || !!args.maxFiles
|