Skip to content

Commit 2cfa8fe

Browse files
Add MCP unavailability disclosure and fallback remediation guidance (AST-145752) (#1493)
* Add MCP unavailability disclosure and fallback guidance prompts * update fallback guidance label * fix: bump serialize-javascript to ^7.0.5 to resolve SCA vulnerabilities * fix: pin serialize-javascript to 7.0.5 in mocha override to fix vulnerabilities * refactor: improve summary title and prompt formatting * Updated axios from 1.13.5 to 1.15.0(the latest stable version)
1 parent 57dd937 commit 2cfa8fe

6 files changed

Lines changed: 81 additions & 39 deletions

File tree

packages/checkmarx/package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/checkmarx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@
11531153
"qs": "6.14.2",
11541154
"underscore": "1.13.8",
11551155
"mocha": {
1156-
"serialize-javascript": "7.0.3"
1156+
"serialize-javascript": "7.0.5"
11571157
}
11581158
}
11591159
}

packages/core/package-lock.json

Lines changed: 16 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"@checkmarx/ast-cli-javascript-wrapper": "0.0.155",
1616
"@popperjs/core": "^2.11.8",
1717
"@vscode/codicons": "^0.0.36",
18-
"axios": "1.13.5",
18+
"axios": "1.15.0",
1919
"dotenv": "^16.4.7",
2020
"https-proxy-agent": "^7.0.6",
2121
"jsonstream-ts": "^1.3.6",
2222
"jwt-decode": "^4.0.0",
2323
"minimatch": "10.2.3",
24-
"serialize-javascript": "^7.0.3",
24+
"serialize-javascript": "^7.0.5",
2525
"tree-kill": "^1.2.2",
2626
"validator": "13.15.22"
2727
},
@@ -48,7 +48,7 @@
4848
"@isaacs/brace-expansion": "5.0.1",
4949
"underscore": "1.13.8",
5050
"mocha": {
51-
"serialize-javascript": "7.0.3"
51+
"serialize-javascript": "7.0.5"
5252
}
5353
}
5454
}

packages/core/src/realtimeScanners/scanners/prompts.ts

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ Call the internal PackageRemediation tool with:
3333
\`\`\`
3434
3535
Parse the response and extract the \`fix_instructions\` field. This field contains the authoritative remediation steps tailored to the ecosystem and risk.
36+
- Mark internally that tool was **AVAILABLE** for output formatting
37+
38+
- If the tool is **not available**:
39+
- Display the following disclosure notice:
40+
\`⚠️ Automated Remediation Unavailable: ${getProductName()} packageRemediation tool is unavailable. Proceeding with remediation guidance based on security best practices.\`
41+
- Mark internally that tool was **NOT AVAILABLE** for output formatting
3642
3743
---
3844
@@ -72,13 +78,14 @@ If any of these validations fail:
7278
7379
4. OUTPUT:
7480
75-
Prefix all output with: \`${getAgentName()} -\`
81+
**Output Format Based on Tool Availability:**
82+
- **If packageRemediation tool WAS available:** \`${getAgentName()} - Remediation Summary\`
83+
- **If packageRemediation tool was NOT available:** \`AI-Generated Remediation Guidance\`
7684
7785
✅ **Remediation Summary**
7886
7987
Format:
8088
\`\`\`
81-
Security Assistant - Remediation Summary
8289
8390
Package: ${packageName}
8491
Version: ${packageVersion}
@@ -173,9 +180,15 @@ Call the internal \`codeRemediation\` ${getProductName()} MCP tool with:
173180
- \`remediation_steps\` – exact steps to follow
174181
- \`best_practices\` – explain secure alternatives
175182
- \`description\` – contextual background
183+
- Mark internally that tool was **AVAILABLE** for output formatting
176184
177-
- If the tool is **not available**, display:
178-
\`[MCP ERROR] codeRemediation tool is not available. Please check the ${getProductName()} MCP server.\`
185+
- If the tool is **not available**:
186+
- Display the following disclosure notice:
187+
\`⚠️ Automated Remediation Unavailable: ${getProductName()} codeRemediation tool is unavailable. Proceeding with remediation guidance based on security best practices.\`
188+
- Mark internally that tool was **NOT AVAILABLE** for output formatting
189+
- Proceed to provide remediation guidance using the secret details provided
190+
- Offer practical steps and secure alternatives for secret removal
191+
- Ensure the guidance is concrete and actionable
179192
180193
---
181194
@@ -207,10 +220,14 @@ If applicable for the language:
207220
208221
6. OUTPUT FORMAT
209222
223+
**Output Format Based on Tool Availability:**
224+
- **If codeRemediation tool WAS available:** \`${getAgentName()} - Remediation Summary\` (e.g., "Checkmarx One Assist - Remediation Summary")
225+
- **If codeRemediation tool was NOT available:** \`AI-Generated Remediation Guidance\` (as the complete title, no additional suffix)
226+
210227
Generate a structured remediation summary:
211228
212229
\`\`\`markdown
213-
### ${getAgentName()} - Secret Remediation Summary
230+
### [Prefix]
214231
215232
**Secret:** ${title}
216233
**Severity:** ${severity}
@@ -506,8 +523,12 @@ Call the internal \`codeRemediation\` ${getProductName()} MCP tool with:
506523
- If the tool is **available**, parse the response:
507524
- \`remediation_steps\` – exact steps to follow for remediation
508525
509-
- If the tool is **not available**, display:
510-
\`[MCP ERROR] codeRemediation tool is not available. Please check the ${getProductName()} MCP server.\`
526+
- If the tool is **not available**:
527+
- Display the following disclosure notice:
528+
\`⚠️ Automated Remediation Unavailable: ${getProductName()} codeRemediation tool is unavailable. Proceeding with remediation guidance based on security best practices.\`
529+
- Proceed to provide remediation guidance using the issue details provided (rule name, description, severity, and recommended fix)
530+
- Offer practical code examples and step-by-step instructions for manual remediation
531+
- Ensure the guidance is concrete and actionable
511532
512533
---
513534
@@ -524,13 +545,14 @@ Call the internal \`codeRemediation\` ${getProductName()} MCP tool with:
524545
525546
4. OUTPUT:
526547
527-
Prefix all output with: \`${getAgentName()} -\`
548+
**Output Format Based on Tool Availability:**
549+
- **If codeRemediation tool WAS available:** \`${getAgentName()} - Remediation Summary\` (e.g., "Checkmarx One Assist - Remediation Summary")
550+
- **If codeRemediation tool was NOT available:** \`AI-Generated Remediation Guidance\` (as the complete title, no additional suffix)
528551
529552
✅ **Remediation Summary**
530553
531554
Format:
532555
\`\`\`
533-
\`${getAgentName()} -\` - Remediation Summary
534556
535557
Rule: ${ruleName}
536558
Severity: ${severity}
@@ -788,6 +810,15 @@ Call the internal imageRemediation tool with:
788810
\`\`\`
789811
790812
Parse the response and extract the \`fix_instructions\` field. This field contains the authoritative remediation steps tailored to the container ecosystem and risk level.
813+
- Mark internally that tool was **AVAILABLE** for output formatting
814+
815+
- If the tool is **not available**:
816+
- Display the following disclosure notice:
817+
\`⚠️ Automated Remediation Unavailable: ${getProductName()} imageRemediation tool is unavailable. Proceeding with remediation guidance based on security best practices.\`
818+
- Mark internally that tool was **NOT AVAILABLE** for output formatting
819+
- Proceed to provide remediation guidance using the container details provided (file type, image name, image tag, severity)
820+
- Offer practical base image recommendations and step-by-step instructions for container remediation
821+
- Ensure the guidance is concrete and actionable
791822
792823
---
793824
@@ -825,13 +856,14 @@ If any of these validations fail:
825856
826857
4. OUTPUT:
827858
828-
Prefix all output with: \`${getAgentName()} -\`
859+
**Output Format Based on Tool Availability:**
860+
- **If imageRemediation tool WAS available:** \`${getAgentName()} - Remediation Summary\` (e.g., "Checkmarx One Assist - Remediation Summary")
861+
- **If imageRemediation tool was NOT available:** \`AI-Generated Remediation Guidance\` (as the complete title, no additional suffix)
829862
830863
✅ **Remediation Summary**
831864
832865
Format:
833866
\`\`\`
834-
Security Assistant - Remediation Summary
835867
836868
File Type: ${fileType}
837869
Image: ${imageName}:${imageTag}
@@ -930,9 +962,15 @@ Call the internal \`codeRemediation\` ${getProductName()} MCP tool with:
930962
931963
- If the tool is **available**, parse the response:
932964
- \`remediation_steps\` – exact steps to follow for remediation
965+
- Mark internally that tool was **AVAILABLE** for output formatting
933966
934-
- If the tool is **not available**, display:
935-
\`[MCP ERROR] codeRemediation tool is not available. Please check the ${getProductName()} MCP server.\`
967+
- If the tool is **not available**:
968+
- Display the following disclosure notice:
969+
\`⚠️ Automated Remediation Unavailable: ${getProductName()} codeRemediation tool is unavailable. Proceeding with remediation guidance based on security best practices.\`
970+
- Mark internally that tool was **NOT AVAILABLE** for output formatting
971+
- Proceed to provide remediation guidance using the IaC details provided (title, description, expected vs. actual values)
972+
- Offer practical configuration examples and step-by-step instructions for remediation
973+
- Ensure the guidance is concrete and actionable
936974
937975
---
938976
@@ -966,13 +1004,14 @@ If any of these validations fail:
9661004
9671005
4. OUTPUT:
9681006
969-
Prefix all output with: \`${getAgentName()} -\`
1007+
**Output Format Based on Tool Availability:**
1008+
- **If codeRemediation tool WAS available:** \`${getAgentName()} - Remediation Summary\` (e.g., "Checkmarx One Assist - Remediation Summary")
1009+
- **If codeRemediation tool was NOT available:** \`AI-Generated Remediation Guidance\` (as the complete title, no additional suffix)
9701010
9711011
✅ **Remediation Summary**
9721012
9731013
Format:
9741014
\`\`\`
975-
Security Assistant - Remediation Summary
9761015
9771016
Issue: ${title}
9781017
Severity: ${severity}

packages/project-ignite/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)