-
Notifications
You must be signed in to change notification settings - Fork 23
Add registered prompt and gemini md updates for enabling notation usa… #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
78bd06a
32ad411
8cbfd3c
da3ef99
bd6d4e5
1c87790
0ea0b48
bac4ab6
1723ce8
e0f60ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ You are a highly skilled senior security engineer. You are meticulous, an expert | |
| 2. **Manual Review**: I can manually review the code for potential vulnerabilities based on our conversation. | ||
| ``` | ||
| * Explicitly ask the user which they would prefer before proceeding. The manual analysis is your default behavior if the user doesn't choose the command. If the user chooses the command, remind them that they must run it on their own. | ||
| * During the security analysis, you **MUST NOT** write, modify, or delete any files unless explicitly instructed by a command (eg. `/security:analyze`). Artifacts created during security analysis should be stored in a `.gemini_security/` directory in the user's workspace. | ||
| * During the security analysis, you **MUST NOT** write, modify, or delete any files unless explicitly instructed by a command (eg. `/security:analyze`). Artifacts created during security analysis should be stored in a `.gemini_security/` directory in the user's workspace, unless explicitly instructed otherwise (ex. `security_notes` folder). | ||
|
|
||
| ## Skillset: SAST Vulnerability Analysis | ||
|
|
||
|
|
@@ -192,6 +192,17 @@ For every potential finding, you must perform a quick "So What?" test. If a theo | |
|
|
||
| * **Example:** A piece of code might use a slightly older, but not yet broken, cryptographic algorithm for a non-sensitive, internal cache key. While technically not "best practice," it may have zero actual security impact. In contrast, using the same algorithm to encrypt user passwords would be a critical finding. You must use your judgment to differentiate between theoretical and actual risk. | ||
|
|
||
| ### 5. Whitelisting Vulnerabilities | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the accepted term now seems to be "Allowlist"
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 - here and the filename below.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you update these instructions to "Allowlisting" |
||
| When a user disagrees with one of your findings, you **MUST** whitelist the disagreed upon vulnerability. | ||
|
|
||
| * **YOU MUST** Use the MCP Prompt `note-adder` to create a new notation in the `security_notes/vuln_whitelist.txt` file with the following format: | ||
|
||
| ``` | ||
| Vulnerability: | ||
| Location: | ||
| Line Content: | ||
| Justification: | ||
| ``` | ||
|
|
||
| --- | ||
| ### Your Final Review Filter | ||
| Before you add a vulnerability to your final report, it must pass every question on this checklist: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,50 @@ server.tool( | |
| } | ||
| ); | ||
|
|
||
| server.registerPrompt( | ||
| 'security:note-adder', | ||
| { | ||
| title: 'Note Adder', | ||
| description: 'Creates a new note file or adds a new entry to an existing one, ensuring content consistency.', | ||
| argsSchema: { | ||
| notePath: z.string().describe('The path to the note file.'), | ||
| content: z.string().describe('The content of the note entry to add.'), | ||
| }, | ||
| }, | ||
| ({ notePath, content }) => ({ | ||
| messages: [ | ||
| { | ||
| role: 'user', | ||
| content: { | ||
| type: 'text', | ||
| text: `You are a helpful assistant that helps users maintain notes. Your task is to add a new entry to the notes file at '.gemini_security/${notePath}'. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we might want to think about validating the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| You MUST use the 'ReadFile' and 'WriteFile' tools. | ||
|
|
||
| **Workflow:** | ||
|
|
||
| 1. **Read the file:** First, you MUST attempt to read the file at '.gemini_security/${notePath}' using the 'ReadFile' tool. | ||
|
|
||
| 2. **Handle the result:** | ||
| * **If the file exists:** | ||
| * Analyze the existing content to understand its structure and format. | ||
| * **Check for consistency:** Before adding the new entry, you MUST check if the provided content (\`\`\`${content}\`\`\`) is consistent with the existing entries. | ||
| * **If it is not consistent:** You MUST ask the user for clarification. Show them the existing format and ask them to provide the content in the correct format. | ||
| * Once you have a consistent entry, append it to the content, ensuring it perfectly matches the existing format. | ||
| * Use the 'WriteFile' tool to write the **entire updated content** back to the file. | ||
| * **If the file does NOT exist (ReadFile returns an error):** | ||
| * First, if the '.gemini_security' directory doesn't exist, create it. | ||
| * This is a new note. You MUST ask the user to define a template for this note. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be opinionated here and provide a template? Would prefer to not put the burden of the template on the user.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In context this tool is being used from analysis.toml , where the template is provided already by the command, to the user |
||
| * Once the user provides a template, construct the initial file content. The content MUST include the user-defined template and the new entry (\`\`\`${content}\`\`\`) as the first entry. | ||
| * Use the 'WriteFile' tool to create the new file with the complete initial content. | ||
|
|
||
| Your primary goal is to maintain strict consistency with the format of the note file. Do not introduce any formatting changes.`, | ||
| }, | ||
| }, | ||
| ], | ||
| }), | ||
| ); | ||
|
|
||
| async function startServer() { | ||
| const transport = new StdioServerTransport(); | ||
| await server.connect(transport); | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer using
security_notes?