Skip to content

Commit 93d59c6

Browse files
feature: Use write_todos tool to keep track of security analysis progress
1 parent 1ba2442 commit 93d59c6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

commands/security/analyze.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The core principle is to trace untrusted or sensitive data from its entry point
1616
Your primary objective during the **"SAST Recon on [file]"** task is to identify and flag **every potential Source of untrusted or sensitive input**.
1717
1818
* **Action:** Scan the entire file for code that brings external or sensitive data into the application.
19-
* **Trigger:** The moment you identify a `Source`, you **MUST** immediately rewrite the `SECURITY_ANALYSIS_TODO.md` file and add a new, indented sub-task:
19+
* **Trigger:** The moment you identify a `Source`, you **MUST** immediately update your todos using the `write_todos` tool. Add a new, indented sub-task:
2020
* `- [ ] Investigate data flow from [variable_name] on line [line_number]`.
2121
* You are not tracing or analyzing the flow yet. You are only planting flags for later investigation. This ensures you scan the entire file and identify all potential starting points before diving deep.
2222
@@ -37,15 +37,15 @@ For EVERY task, you MUST follow this procedure. This loop separates high-level s
3737
3838
1. **Phase 0: Initial Planning**
3939
* **Action:** First, understand the high-level task from the user's prompt.
40-
* **Action:** If it does not already exist, create a new folder named `.gemini_security` in the user's workspace.
41-
* **Action:** Create a new file named `SECURITY_ANALYSIS_TODO.md` in `.gemini_security`, and write the initial, high-level objectives from the prompt into it.
42-
* **Action:** Create a new, empty file named `DRAFT_SECURITY_REPORT.md` in `.gemini_security`.
43-
* **Action"** Prep yourself using the following possible notes files under `.gemini_security/`. If they do not exist, skip them.
40+
* **Action:** If it does not already exist, create a new folder named `.gemini_security_new` in the user's workspace.
41+
* **Action:** Use the `write_todos` tool to write the initial, high-level objectives from the prompt.
42+
* **Action:** Create a new, empty file named `DRAFT_SECURITY_REPORT.md` in `.gemini_security_new`.
43+
* **Action"** Prep yourself using the following possible notes files under `.gemini_security_new/`. If they do not exist, skip them.
4444
* `vuln_allowlist.txt`: The allowlist file has vulnerabilities to ignore during your scan. If you match a vulernability to this file, notify the user and skip it in your scan.
4545
4646
2. **Phase 1: Dynamic Execution & Planning**
47-
* **Action:** Read the `SECURITY_ANALYSIS_TODO.md` file and execute the first task about determinig the scope of the analysis.
48-
* **Action (Plan Refinement):** After identifying the scope, rewrite `SECURITY_ANALYSIS_TODO.md` to replace the generic "analyze files" task with a specific **Reconnaissance Task** for each file (e.g., `- [ ] SAST Recon on fileA.js`).
47+
* **Action:** Read your todo list and execute the first task about determinig the scope of the analysis.
48+
* **Action (Plan Refinement):** After identifying the scope, rewrite your todo list using 'write_todos' to replace the generic "analyze files" task with a specific **Reconnaissance Task** for each file (e.g., `- [ ] SAST Recon on fileA.js`).
4949
5050
3. **Phase 2: The Two-Pass Analysis Loop**
5151
* This is the core execution loop for analyzing a single file.
@@ -63,7 +63,7 @@ For EVERY task, you MUST follow this procedure. This loop separates high-level s
6363
* **Action:** Repeat this Recon -> Investigate loop until all tasks and sub-tasks are complete.
6464
6565
4. **Phase 3: Final Review & Refinement**
66-
* **Action:** This phase begins when all analysis tasks in `SECURITY_ANALYSIS_TODO.md` are complete.
66+
* **Action:** This phase begins when all analysis tasks in your todo list are complete.
6767
* **Action:** Read the entire `DRAFT_SECURITY_REPORT.md` file.
6868
* **Action:** Critically review **every single finding** in the draft against the **"High-Fidelity Reporting & Minimizing False Positives"** principles and its five-question checklist.
6969
* **Action:** You must use the `gemini-cli-security` MCP server to get the line numbers for each finding. For each vulnerability you have found, you must call the `find_line_numbers` tool with the `filePath` and the `snippet` of the vulnerability. You will then add the `startLine` and `endLine` to the final report.
@@ -72,10 +72,10 @@ For EVERY task, you MUST follow this procedure. This loop separates high-level s
7272
5. **Phase 4: Final Reporting & Cleanup**
7373
* **Action:** Output the final, reviewed report as your response to the user.
7474
* **Action:** If, after the review, no vulnerabilities remain, your final output **MUST** be the standard "clean report" message specified by the task prompt.
75-
* **Action:** Remove the temporary files (`SECURITY_ANALYSIS_TODO.md` and `DRAFT_SECURITY_REPORT.md`) from the `.gemini_security/` directory. Only remove these files and do not remove any other user files under any circumstances.
75+
* **Action:** Remove the temporary file `DRAFT_SECURITY_REPORT.md` from the `.gemini_security_new/` directory. Only remove these files and do not remove any other user files under any circumstances.
7676
7777
78-
### Example of the Workflow in `SECURITY_ANALYSIS_TODO.md`
78+
### Example todo-list workflow
7979
8080
1. **Initial State:**
8181
```markdown
@@ -97,7 +97,7 @@ For EVERY task, you MUST follow this procedure. This loop separates high-level s
9797
9898
**Step 1: Initial Planning**
9999
100-
Your first action is to create a `SECURITY_ANALYSIS_TODO.md` file with the following exact, high-level plan. This initial plan is fixed and must not be altered. When writing files always use absolute paths (e.g., `/path/to/file`).
100+
Your first action is to create a todo list using 'write_todos' with the following exact, high-level plan. This initial plan is fixed and must not be altered. When writing files always use absolute paths (e.g., `/path/to/file`).
101101
102102
- [ ] Define the audit scope.
103103
- [ ] Conduct a two-pass SAST analysis on all files within scope.
@@ -112,10 +112,10 @@ You will now begin executing the plan. The following are your precise instructio
112112
* After using the tool, provide the user a list of changed files. If the list of files is empty, ask the user to provide files to be scanned.
113113
114114
2. **Immediately after defining the scope, you must refine your plan:**
115-
* You will rewrite the `SECURITY_ANALYSIS_TODO.md` file.
115+
* You will rewrite the todo list using 'write_todos' .
116116
* Out of Scope Files: Files that are primarily used for managing dependencies like lockfiles (e.g., `package-lock.json`, `package.json` `yarn.lock`, `go.sum`) should be considered out of scope and **must be omitted from the plan entirely**, as they contain no actionable code to review.
117117
* You **MUST** replace the line `- [ ] Conduct a two-pass SAST analysis on all files within scope.` with a specific **"SAST Recon on [file]"** task for each file you discovered in the previous step.
118118
119119
After completing these two initial tasks, continue executing the dynamically generated plan according to your **Core Operational Loop**.
120120
121-
Proceed with the Initial Planning Phase now."""
121+
Proceed with the Initial Planning Phase now."""

0 commit comments

Comments
 (0)