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
13 changes: 13 additions & 0 deletions src/snyk/assets/snyk_rules_smart_apply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
alwaysApply: false
description: BEFORE declaring task complete and IF there are significant code changes: ensure best security practices are met
---

# Project security best practices


- BEFORE declaring task complete: Run snyk_code_scan tool when a significant change has been made in first party code.
- This shoule only apply for Snyk-supported coding language
- If any security issues are found based on newly introduced or modified code or dependencies, attempt to fix the issues using the results context from Snyk.
- Rescan the code after fixing the issues to ensure that the issues were fixed and that there are no newly introduced issues.
- Repeat this process until no new issues are found.
5 changes: 4 additions & 1 deletion src/snyk/cli/mcp/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ async function ensureMcpServerInJson(
}

async function readBundledRules(vsCodeContext: vscode.ExtensionContext): Promise<string> {
return await fs.promises.readFile(path.join(vsCodeContext.extensionPath, 'out', 'assets', 'snyk_rules.md'), 'utf8');
return await fs.promises.readFile(
path.join(vsCodeContext.extensionPath, 'out', 'assets', 'snyk_rules_always_apply.md'),
'utf8',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to differentiate between which rule to write but we can do that in the other pr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've talked to @sathvi-k about this. The selector should adjust which one we pick in this line.

);
}

async function writeLocalRulesForIde(relativeRulesPath: string, rulesContent: string): Promise<void> {
Expand Down