Skip to content

Commit fedff08

Browse files
jackryan-snykgitbook-bot
authored andcommitted
GITBOOK-9839: vc-Add-Kiro-guide
1 parent 11e8ff0 commit fedff08

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed
333 KB
Loading
292 KB
Loading
98.2 KB
Loading

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
* [Goose CLI guide](integrations/developer-guardrails-for-agentic-workflows/quickstart-guides-for-mcp/gemini-cli-guide.md)
293293
* [JetBrains AI assistant](integrations/developer-guardrails-for-agentic-workflows/quickstart-guides-for-mcp/jetbrains-ai-assistant.md)
294294
* [JetBrains Junie](integrations/developer-guardrails-for-agentic-workflows/quickstart-guides-for-mcp/jetbrains-junie.md)
295+
* [Kiro guide](integrations/developer-guardrails-for-agentic-workflows/quickstart-guides-for-mcp/kiro-guide.md)
295296
* [Qodo guide](integrations/developer-guardrails-for-agentic-workflows/quickstart-guides-for-mcp/qodo-guide.md)
296297
* [Windsurf guide](integrations/developer-guardrails-for-agentic-workflows/quickstart-guides-for-mcp/windsurf-guide.md)
297298
* [Troubleshooting for the Snyk MCP server](integrations/developer-guardrails-for-agentic-workflows/troubleshooting-for-the-snyk-mcp-server.md)
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Kiro guide
2+
3+
You can add the Snyk MCP server to Kiro to secure code generated with agentic workflows through an LLM. This can be achieved in several ways. When you use it for the first time, the MCP server will ask for trust and trigger authentication if necessary.
4+
5+
## Prerequisites
6+
7+
* [Install the code assistant extension](kiro-guide.md#install-kiro)
8+
* [Install the Snyk CLI](../../../developer-tools/snyk-cli/install-or-update-the-snyk-cli/)
9+
* [Install the Snyk MCP](kiro-guide.md#install-the-snyk-mcp-server-in-qodo)
10+
11+
### Install Kiro
12+
13+
Install Kiro on your machine. For more details, visit the official [Kiro](https://kiro.dev/) page.
14+
15+
### Install the Snyk MCP Server in Kiro
16+
17+
Install the Snyk MCP Server using the method suited to your OS and environment.
18+
19+
Create or edit the MCP configuration file `~/.kiro/settings/mcp.json` .
20+
21+
#### Install with Node.js and `npx`
22+
23+
If you have the Node.js `npx` executable installed in your environment, add the following JSON snippet to the file:
24+
25+
```json5
26+
{
27+
"mcpServers": {
28+
"Snyk": {
29+
"command": "npx",
30+
"args": ["-y", "snyk@latest", "mcp", "-t", "stdio"],
31+
"env": {}
32+
}
33+
}
34+
}
35+
```
36+
37+
#### Install with pre-installed Snyk CLI
38+
39+
If you have the Snyk CLI installed and accessible on your system path, include the following JSON snippet in the file. You might need to specify the full path to the Snyk executable CLI:
40+
41+
```json5
42+
{
43+
"servers": {
44+
"Snyk": {
45+
"command": "/absolute/path/to/snyk",
46+
"args": ["mcp", "-t", "stdio"],
47+
"env": {}
48+
}
49+
}
50+
}
51+
```
52+
53+
If the `snyk` command is not available, add it by following the instructions on the [Installing or updating the Snyk CLI](../../../developer-tools/snyk-cli/install-or-update-the-snyk-cli/) page. 
54+
55+
The following example shows a Snyk MCP Server that was successfully configured and started.
56+
57+
<figure><img src="../../../.gitbook/assets/image (520).png" alt=""><figcaption></figcaption></figure>
58+
59+
## Setting up the Snyk MCP Server
60+
61+
As a one-time setup, you may need to authenticate and trust the current Project directory. If required, the agentic workflow will likely manage this automatically.
62+
63+
These workflows are mostly automatically executed by the underlying model and the agentic code assistant, and you will need to approve them using a browser confirmation dialog. The process should look similar to this:
64+
65+
<figure><img src="../../../.gitbook/assets/image (521).png" alt=""><figcaption></figcaption></figure>
66+
67+
If you need to authenticate and trust the current directory, then proceed and complete the process.
68+
69+
## Examples
70+
71+
### Scanning for security vulnerabilities
72+
73+
{% code title="prompt" overflow="wrap" %}
74+
```
75+
Scan this directory for code security & dependency vulnerabilities and security issues
76+
```
77+
{% endcode %}
78+
79+
Kiro indicates that this request is related to security vulnerability scanning and calls the Snyk MCP Server for various scans.
80+
81+
Kiro is then able to gather all the security scanning results, both code (SAST) and dependencies (SCA), and based on recommendations and contextual information provided by the Snyk MCP Server, it is now able to provide code changes that address some or all of the security vulnerabilities that were found.
82+
83+
### "Secure at inception" rules
84+
85+
To practice [Secure at Inception](https://snyk.io/solutions/secure-ai-generated-code/), Snyk recommends adopting rules that align the LLM for secure code generation and workflows.
86+
87+
The following is a suggested instruction for [Kiro Agent Steering](https://kiro.dev/docs/steering/):
88+
89+
{% code title="Kiro Agent Steering" overflow="wrap" %}
90+
```
91+
Always run Snyk Code scanning tool for new first party code generated.
92+
Always run Snyk SCA scanning tool for new dependencies or dependency updates.
93+
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.
94+
Rescan the code after fixing the issues to ensure that the issues were fixed and that there are no newly introduced issues.
95+
Repeat this process until no issues are found.
96+
```
97+
{% endcode %}
98+
99+
Append the following contents to an Agent Steering file
100+
101+
{% code title="best_practices.md" overflow="wrap" %}
102+
```
103+
---
104+
applyTo: "**"
105+
---
106+
107+
# Project security best practices
108+
109+
- Always run Snyk Code scanning tool for new first party code generated.
110+
- Always run Snyk SCA scanning tool for new dependencies or dependency updates.
111+
- 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.
112+
- Rescan the code after fixing the issues to ensure that the issues were fixed and that there are no newly introduced issues.
113+
- Repeat this process until no issues are found.
114+
```
115+
{% endcode %}

0 commit comments

Comments
 (0)