Skip to content

Commit 3970d28

Browse files
authored
Merge pull request #4 from Jeymz/main
feat: add secure code review prompt fix: correct formatting and naming convetion in secure code review prompts and instructions
2 parents 68bd3bf + 65d127e commit 3970d28

File tree

6 files changed

+157
-11
lines changed

6 files changed

+157
-11
lines changed

.github/copilot-instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ These instructions guide GitHub Copilot to suggest secure, intentional code patt
9898
- Do not use insecure hash functions like `md5` or `sha1` for password storage — use a modern password hashing lib.
9999
- Do not commit `.env` files or hardcode secrets — use secrets management infrastructure.
100100

101-
102101
---
103102

104103
## 🧠 4. AI-Generated Code Safety
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# 🛡️ Prompt: Secure Code Review
2+
3+
You are a senior software engineer performing a **comprehensive secure code review**.
4+
5+
---
6+
7+
## ✅ Context Instructions
8+
9+
- Start from a **fresh analysis context**.
10+
- Disregard any previously seen reviews, summaries, or cached content.
11+
- Re-scan the **entire current codebase** visible in this workspace.
12+
13+
---
14+
15+
## 🔍 Step 1: Project Mapping
16+
17+
- List all visible files and folders.
18+
- For each, briefly describe its purpose or domain (e.g., "core logic," "auth," "logging utilities").
19+
20+
---
21+
22+
## 🧭 Step 2: Subsystem Discovery
23+
24+
- Identify the key **subsystems or functional domains** in this project.
25+
- Explain what role each plays (e.g., request routing, encryption, config parsing).
26+
27+
---
28+
29+
🛡️ **Step 3: Deep Review by Subsystem**
30+
For each subsystem:
31+
32+
- Highlight strengths
33+
- Identify security observations
34+
- Show file paths + relevant code
35+
- Note code quality or maintainability issues
36+
37+
Quote relevant code snippets or describe logic where needed.
38+
39+
---
40+
41+
## 📄 Final Output Format
42+
43+
Generate a single Markdown file named `REVIEW.MD` with the following structure:
44+
45+
```markdown
46+
# 📋 Project Secure Code Review
47+
48+
## ✅ Strengths
49+
- ...
50+
51+
## 🛡️ Security Observations
52+
### [filename/path]
53+
- **Issue**: ...
54+
- **Impact**: ...
55+
- **Recommendation**: ...
56+
57+
## 🔍 Code Quality Notes
58+
- ...
59+
60+
## 🧭 Suggested Next Steps
61+
- ...
62+
```
63+
64+
## ⚠️ Important
65+
66+
Pay close attention to logic around:
67+
68+
- input validation
69+
- secrets or config handling
70+
- logger redaction (e.g. loggerENVCheck, loggerStackCheck)
71+
- access control
72+
- environment-specific behavior
73+
74+
Respond only after completing a fresh read of the codebase.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ Copilot will scan the file using the selected prompt and return flagged issues,
4444

4545
The `tests/` folder contains small, focused files designed to trigger specific security prompts:
4646

47-
| File | Targets |
48-
|--------------------------------|------------------------------------------|
49-
| `secret-hardcode.js` | check-for-secrets.md |
50-
| `unvalidated-input.java` | validate-input-handling.md |
51-
| `insecure-api.cs` | scan-for-insecure-apis.md |
52-
| `logs-sensitive-data.go` | assess-logging.md |
53-
| `weak-auth-flow.ts` | review-auth-flows.md |
54-
| `overtrusted-genai-snippet.js` | unvalidated-genai-acceptances.md |
47+
| File | Targets |
48+
|--------------------------------|-----------------------------------|
49+
| `secret-hardcode.js` | check-for-secrets.md |
50+
| `unvalidated-input.java` | validate-input-handling.md |
51+
| `insecure-api.cs` | scan-for-insecure-apis.md |
52+
| `logs-sensitive-data.go` | assess-logging.md |
53+
| `weak-auth-flow.ts` | review-auth-flows.md |
54+
| `overtrusted-genai-snippet.js` | unvalidated-genai-acceptances.md |
5555

5656
To run a test:
5757

copilot-instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ These instructions guide GitHub Copilot to suggest secure, intentional code patt
9898
- Do not use insecure hash functions like `md5` or `sha1` for password storage — use a modern password hashing lib.
9999
- Do not commit `.env` files or hardcode secrets — use secrets management infrastructure.
100100

101-
102101
---
103102

104103
## 🧠 4. AI-Generated Code Safety

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# 🛡️ Prompt: Secure Code Review
2+
3+
You are a senior software engineer performing a **comprehensive secure code review**.
4+
5+
---
6+
7+
## ✅ Context Instructions
8+
9+
- Start from a **fresh analysis context**.
10+
- Disregard any previously seen reviews, summaries, or cached content.
11+
- Re-scan the **entire current codebase** visible in this workspace.
12+
13+
---
14+
15+
## 🔍 Step 1: Project Mapping
16+
17+
- List all visible files and folders.
18+
- For each, briefly describe its purpose or domain (e.g., "core logic," "auth," "logging utilities").
19+
20+
---
21+
22+
## 🧭 Step 2: Subsystem Discovery
23+
24+
- Identify the key **subsystems or functional domains** in this project.
25+
- Explain what role each plays (e.g., request routing, encryption, config parsing).
26+
27+
---
28+
29+
🛡️ **Step 3: Deep Review by Subsystem**
30+
For each subsystem:
31+
32+
- Highlight strengths
33+
- Identify security observations
34+
- Show file paths + relevant code
35+
- Note code quality or maintainability issues
36+
37+
Quote relevant code snippets or describe logic where needed.
38+
39+
---
40+
41+
## 📄 Final Output Format
42+
43+
Generate a single Markdown file named `REVIEW.MD` with the following structure:
44+
45+
```markdown
46+
# 📋 Project Secure Code Review
47+
48+
## ✅ Strengths
49+
- ...
50+
51+
## 🛡️ Security Observations
52+
### [filename/path]
53+
- **Issue**: ...
54+
- **Impact**: ...
55+
- **Recommendation**: ...
56+
57+
## 🔍 Code Quality Notes
58+
- ...
59+
60+
## 🧭 Suggested Next Steps
61+
- ...
62+
```
63+
64+
## ⚠️ Important
65+
66+
Pay close attention to logic around:
67+
68+
- input validation
69+
- secrets or config handling
70+
- logger redaction (e.g. loggerENVCheck, loggerStackCheck)
71+
- access control
72+
- environment-specific behavior
73+
74+
Respond only after completing a fresh read of the codebase.

0 commit comments

Comments
 (0)