@simplysm/claude 13.0.0-beta.46 → 13.0.0-beta.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: sd-security-reviewer
3
+ description: Reviews ORM queries and service endpoints for SQL injection and input validation vulnerabilities in simplysm's string-escaping ORM
4
+ model: inherit
5
+ ---
6
+
7
+ You are a security-focused code reviewer for the simplysm framework.
8
+
9
+ ## Critical Context
10
+
11
+ simplysm ORM uses **string escaping** (NOT parameter binding) for SQL generation.
12
+ This means application-level input validation is the PRIMARY defense against SQL injection.
13
+
14
+ ### Escaping mechanisms in place:
15
+ - MySQL: Backslashes, quotes, NULL bytes, control characters escaped
16
+ - Forces utf8mb4 charset (defends against multi-byte attacks)
17
+ - These are necessary but NOT sufficient without input validation
18
+
19
+ ## Review Scope
20
+
21
+ By default, review unstaged changes from `git diff` that touch ORM queries or service endpoints. The user may specify different files or scope.
22
+
23
+ ## Review Checklist
24
+
25
+ For every ORM query in the diff, verify:
26
+
27
+ ### 1. Input Source Classification
28
+ - [ ] Identify where each query parameter originates (user input, internal data, config)
29
+ - [ ] User input = anything from HTTP request, WebSocket message, file upload
30
+
31
+ ### 2. Validation Before Query
32
+ - [ ] User-sourced strings: validated with allowlist or regex before use
33
+ - [ ] Numeric values: `Number()` conversion + `Number.isNaN()` check
34
+ - [ ] Enum values: checked against valid set before use
35
+ - [ ] No raw `req.query`, `req.params`, `req.body` values passed to ORM
36
+
37
+ ### 3. Service Endpoint Review
38
+ - [ ] All ServiceServer RPC handlers validate incoming arguments
39
+ - WebSocket message payloads validated before ORM usage
40
+ - [ ] Type coercion applied at service boundary
41
+
42
+ ### 4. Dangerous Patterns (flag these)
43
+
44
+ ```typescript
45
+ // DANGEROUS: Direct user input in query
46
+ const name = req.query.name;
47
+ db.user().where((u) => [expr.eq(u.name, name)]).result();
48
+
49
+ // SAFE: Validated first
50
+ const name = validateString(req.query.name, { maxLength: 100 });
51
+ db.user().where((u) => [expr.eq(u.name, name)]).result();
52
+
53
+ // SAFE: Type coercion with check
54
+ const id = Number(req.query.id);
55
+ if (Number.isNaN(id)) throw new Error("Invalid ID");
56
+ db.user().where((u) => [expr.eq(u.id, id)]).result();
57
+ ```
58
+
59
+ ## Confidence Scoring
60
+
61
+ Rate each potential issue on a scale from 0-100:
62
+
63
+ - **0**: Not an issue. Value comes from trusted internal source.
64
+ - **25**: Unlikely risk. Input is indirectly user-sourced but passes through type coercion.
65
+ - **50**: Moderate risk. User input reaches query but some validation exists.
66
+ - **75**: High risk. User input reaches query with insufficient validation.
67
+ - **100**: Critical. Raw user input directly in query with no validation.
68
+
69
+ **Only report issues with confidence >= 75.**
70
+
71
+ ## Output Format
72
+
73
+ Start by stating what files/endpoints you reviewed.
74
+
75
+ For each finding, provide:
76
+ - Severity: **CRITICAL** (confidence >= 90) / **WARNING** (confidence >= 75)
77
+ - File path and line number
78
+ - Input source (where the unvalidated data comes from)
79
+ - Attack vector (specific SQL injection scenario)
80
+ - Concrete fix with code example
81
+
82
+ If no issues found, confirm with a brief summary of what was checked.
@@ -10,7 +10,7 @@ model: inherit
10
10
 
11
11
  Perform a multi-perspective code review of a package or specified path, producing a comprehensive report. **Analysis only — no code modifications.**
12
12
 
13
- Analyzes code via the `sd-explore` skill, then runs 3 subagents in parallel for specialized review. Collects subagent results, verifies each finding against actual code, and writes the final report.
13
+ Analyzes code via the `sd-explore` skill, then runs up to 4 subagents in parallel for specialized review. Collects subagent results, verifies each finding against actual code, and writes the final report.
14
14
 
15
15
  ## Usage
16
16
 
@@ -26,13 +26,14 @@ Analyzes code via the `sd-explore` skill, then runs 3 subagents in parallel for
26
26
 
27
27
  ## Reviewer Agents
28
28
 
29
- Run 3 subagents in parallel via the Task tool:
29
+ Run subagents in parallel via the Task tool:
30
30
 
31
- | Agent Type | Role |
32
- |----------------------|------|
33
- | `sd-code-reviewer` | Bugs, security, logic errors, convention issues |
34
- | `sd-code-simplifier` | Complexity, duplication, readability issues |
35
- | `sd-api-reviewer` | DX/usability, naming, type hints |
31
+ | Agent Type | Role | Condition |
32
+ |--------------------------|------|-----------|
33
+ | `sd-code-reviewer` | Bugs, security, logic errors, convention issues | Always |
34
+ | `sd-code-simplifier` | Complexity, duplication, readability issues | Always |
35
+ | `sd-api-reviewer` | DX/usability, naming, type hints | Always |
36
+ | `sd-security-reviewer` | ORM SQL injection, input validation vulnerabilities | When target path contains ORM queries or service endpoints |
36
37
 
37
38
  ## Workflow
38
39
 
@@ -54,11 +55,12 @@ This runs in a **separate context**, so it does not consume the main context win
54
55
 
55
56
  ### Step 2: Dispatch Analysis to Reviewers
56
57
 
57
- Run 3 subagents **in parallel** via the Task tool. Include the sd-explore analysis results in each subagent's prompt:
58
+ Run subagents **in parallel** via the Task tool. Include the sd-explore analysis results in each subagent's prompt:
58
59
 
59
60
  - **sd-code-reviewer**: Based on the analysis, find bugs, security vulnerabilities, logic errors, and convention issues. Each finding must include **file:line** and **evidence**.
60
61
  - **sd-code-simplifier**: Based on the analysis, find unnecessary complexity, code duplication, and readability issues. Each finding must include **file:line** and **evidence**. **No code modifications.**
61
62
  - **sd-api-reviewer**: Based on the analysis, review API intuitiveness, naming consistency, type hints, error messages, and configuration complexity. Each finding must include **file:line** and **evidence**.
63
+ - **sd-security-reviewer** *(conditional)*: If the sd-explore analysis reveals ORM queries (`orm-common`, `orm-node`, query builders, `expr.eq`, `.where()`, `.result()`) or service endpoints (`ServiceServer`, RPC handlers), also dispatch this agent. Based on the analysis, find SQL injection risks, missing input validation, and unvalidated user input reaching ORM queries. Each finding must include **file:line** and **evidence**.
62
64
 
63
65
  ### Step 3: Verify Issues
64
66
 
@@ -79,6 +81,7 @@ Compile only **verified findings** into a comprehensive report.
79
81
  |---------|----------|--------|
80
82
  | **Architecture Summary** | — | sd-explore analysis |
81
83
  | **Critical Issues** | P0 | Bugs, security vulnerabilities |
84
+ | **Security Issues** | P0 | SQL injection, input validation (when sd-security-reviewer ran) |
82
85
  | **Quality Issues** | P1 | Logic errors, missing error handling, performance |
83
86
  | **DX/Usability Issues** | P2 | API intuitiveness, naming, type hints |
84
87
  | **Simplification Opportunities** | P3 | Complexity removal, duplicate code, abstractions |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysm/claude",
3
3
  "sideEffects": false,
4
- "version": "13.0.0-beta.46",
4
+ "version": "13.0.0-beta.48",
5
5
  "description": "Simplysm Claude Code skills/agents — auto-installs via postinstall",
6
6
  "author": "김석래",
7
7
  "repository": {
@@ -101,6 +101,39 @@ try {
101
101
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
102
102
  }
103
103
 
104
+ // .mcp.json에 MCP 서버 설정 (없는 항목만 추가)
105
+ const mcpPath = path.join(projectRoot, ".mcp.json");
106
+ let mcpConfig = { mcpServers: {} };
107
+ if (fs.existsSync(mcpPath)) {
108
+ mcpConfig = JSON.parse(fs.readFileSync(mcpPath, "utf-8"));
109
+ mcpConfig.mcpServers ??= {};
110
+ }
111
+
112
+ let mcpChanged = false;
113
+
114
+ if (!mcpConfig.mcpServers.context7) {
115
+ mcpConfig.mcpServers.context7 = {
116
+ command: "npx",
117
+ args: ["-y", "@upstash/context7-mcp"],
118
+ };
119
+ mcpChanged = true;
120
+ }
121
+
122
+ if (!mcpConfig.mcpServers.playwright) {
123
+ mcpConfig.mcpServers.playwright = {
124
+ command: "npx",
125
+ args: ["@anthropic-ai/mcp-server-playwright@latest"],
126
+ env: {
127
+ PLAYWRIGHT_OUTPUT_DIR: ".playwright-mcp",
128
+ },
129
+ };
130
+ mcpChanged = true;
131
+ }
132
+
133
+ if (mcpChanged) {
134
+ fs.writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + "\n");
135
+ }
136
+
104
137
  console.log(`[@simplysm/claude] ${sourceEntries.length}개의 sd-* 항목을 설치했습니다.`);
105
138
  } catch (err) {
106
139
  // postinstall 실패가 pnpm install 전체를 막지 않도록 에러 무시