mcp-subagents-opencode 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +602 -0
- package/build/config/timeouts.d.ts +9 -0
- package/build/config/timeouts.d.ts.map +1 -0
- package/build/config/timeouts.js +18 -0
- package/build/config/timeouts.js.map +1 -0
- package/build/helpers.d.ts +6 -0
- package/build/helpers.d.ts.map +1 -0
- package/build/helpers.js +47 -0
- package/build/helpers.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +245 -0
- package/build/index.js.map +1 -0
- package/build/models.d.ts +32 -0
- package/build/models.d.ts.map +1 -0
- package/build/models.js +58 -0
- package/build/models.js.map +1 -0
- package/build/server/register-notifications.d.ts +3 -0
- package/build/server/register-notifications.d.ts.map +1 -0
- package/build/server/register-notifications.js +77 -0
- package/build/server/register-notifications.js.map +1 -0
- package/build/server/register-resources.d.ts +3 -0
- package/build/server/register-resources.d.ts.map +1 -0
- package/build/server/register-resources.js +210 -0
- package/build/server/register-resources.js.map +1 -0
- package/build/server/register-retry-execution.d.ts +2 -0
- package/build/server/register-retry-execution.d.ts.map +1 -0
- package/build/server/register-retry-execution.js +28 -0
- package/build/server/register-retry-execution.js.map +1 -0
- package/build/server/register-tasks.d.ts +3 -0
- package/build/server/register-tasks.d.ts.map +1 -0
- package/build/server/register-tasks.js +52 -0
- package/build/server/register-tasks.js.map +1 -0
- package/build/server/register-tools.d.ts +3 -0
- package/build/server/register-tools.d.ts.map +1 -0
- package/build/server/register-tools.js +32 -0
- package/build/server/register-tools.js.map +1 -0
- package/build/server/resource-helpers.d.ts +21 -0
- package/build/server/resource-helpers.d.ts.map +1 -0
- package/build/server/resource-helpers.js +84 -0
- package/build/server/resource-helpers.js.map +1 -0
- package/build/services/account-manager.d.ts +88 -0
- package/build/services/account-manager.d.ts.map +1 -0
- package/build/services/account-manager.js +239 -0
- package/build/services/account-manager.js.map +1 -0
- package/build/services/claude-code-runner.d.ts +15 -0
- package/build/services/claude-code-runner.d.ts.map +1 -0
- package/build/services/claude-code-runner.js +475 -0
- package/build/services/claude-code-runner.js.map +1 -0
- package/build/services/client-context.d.ts +31 -0
- package/build/services/client-context.d.ts.map +1 -0
- package/build/services/client-context.js +44 -0
- package/build/services/client-context.js.map +1 -0
- package/build/services/exhaustion-fallback.d.ts +27 -0
- package/build/services/exhaustion-fallback.d.ts.map +1 -0
- package/build/services/exhaustion-fallback.js +30 -0
- package/build/services/exhaustion-fallback.js.map +1 -0
- package/build/services/fallback-orchestrator.d.ts +16 -0
- package/build/services/fallback-orchestrator.d.ts.map +1 -0
- package/build/services/fallback-orchestrator.js +48 -0
- package/build/services/fallback-orchestrator.js.map +1 -0
- package/build/services/opencode-client.d.ts +40 -0
- package/build/services/opencode-client.d.ts.map +1 -0
- package/build/services/opencode-client.js +147 -0
- package/build/services/opencode-client.js.map +1 -0
- package/build/services/opencode-spawner.d.ts +56 -0
- package/build/services/opencode-spawner.d.ts.map +1 -0
- package/build/services/opencode-spawner.js +426 -0
- package/build/services/opencode-spawner.js.map +1 -0
- package/build/services/output-file.d.ts +24 -0
- package/build/services/output-file.d.ts.map +1 -0
- package/build/services/output-file.js +90 -0
- package/build/services/output-file.js.map +1 -0
- package/build/services/progress-registry.d.ts +12 -0
- package/build/services/progress-registry.d.ts.map +1 -0
- package/build/services/progress-registry.js +97 -0
- package/build/services/progress-registry.js.map +1 -0
- package/build/services/question-registry.d.ts +79 -0
- package/build/services/question-registry.d.ts.map +1 -0
- package/build/services/question-registry.js +249 -0
- package/build/services/question-registry.js.map +1 -0
- package/build/services/retry-queue.d.ts +41 -0
- package/build/services/retry-queue.d.ts.map +1 -0
- package/build/services/retry-queue.js +195 -0
- package/build/services/retry-queue.js.map +1 -0
- package/build/services/sdk-client-manager.d.ts +149 -0
- package/build/services/sdk-client-manager.d.ts.map +1 -0
- package/build/services/sdk-client-manager.js +632 -0
- package/build/services/sdk-client-manager.js.map +1 -0
- package/build/services/sdk-session-adapter.d.ts +203 -0
- package/build/services/sdk-session-adapter.d.ts.map +1 -0
- package/build/services/sdk-session-adapter.js +1088 -0
- package/build/services/sdk-session-adapter.js.map +1 -0
- package/build/services/sdk-spawner.d.ts +42 -0
- package/build/services/sdk-spawner.d.ts.map +1 -0
- package/build/services/sdk-spawner.js +488 -0
- package/build/services/sdk-spawner.js.map +1 -0
- package/build/services/session-hooks.d.ts +24 -0
- package/build/services/session-hooks.d.ts.map +1 -0
- package/build/services/session-hooks.js +130 -0
- package/build/services/session-hooks.js.map +1 -0
- package/build/services/session-snapshot.d.ts +19 -0
- package/build/services/session-snapshot.d.ts.map +1 -0
- package/build/services/session-snapshot.js +203 -0
- package/build/services/session-snapshot.js.map +1 -0
- package/build/services/subscription-registry.d.ts +12 -0
- package/build/services/subscription-registry.d.ts.map +1 -0
- package/build/services/subscription-registry.js +27 -0
- package/build/services/subscription-registry.js.map +1 -0
- package/build/services/task-manager.d.ts +150 -0
- package/build/services/task-manager.d.ts.map +1 -0
- package/build/services/task-manager.js +765 -0
- package/build/services/task-manager.js.map +1 -0
- package/build/services/task-persistence.d.ts +29 -0
- package/build/services/task-persistence.d.ts.map +1 -0
- package/build/services/task-persistence.js +159 -0
- package/build/services/task-persistence.js.map +1 -0
- package/build/services/task-status-mapper.d.ts +21 -0
- package/build/services/task-status-mapper.d.ts.map +1 -0
- package/build/services/task-status-mapper.js +171 -0
- package/build/services/task-status-mapper.js.map +1 -0
- package/build/templates/index.d.ts +22 -0
- package/build/templates/index.d.ts.map +1 -0
- package/build/templates/index.js +147 -0
- package/build/templates/index.js.map +1 -0
- package/build/templates/overlays/coder-csharp.mdx +58 -0
- package/build/templates/overlays/coder-go.mdx +53 -0
- package/build/templates/overlays/coder-java.mdx +54 -0
- package/build/templates/overlays/coder-kotlin.mdx +56 -0
- package/build/templates/overlays/coder-nextjs.mdx +65 -0
- package/build/templates/overlays/coder-python.mdx +53 -0
- package/build/templates/overlays/coder-react.mdx +55 -0
- package/build/templates/overlays/coder-ruby.mdx +59 -0
- package/build/templates/overlays/coder-rust.mdx +48 -0
- package/build/templates/overlays/coder-supabase.mdx +268 -0
- package/build/templates/overlays/coder-supastarter.mdx +313 -0
- package/build/templates/overlays/coder-swift.mdx +56 -0
- package/build/templates/overlays/coder-tauri.mdx +566 -0
- package/build/templates/overlays/coder-triggerdev.mdx +296 -0
- package/build/templates/overlays/coder-typescript.mdx +45 -0
- package/build/templates/overlays/coder-vue.mdx +62 -0
- package/build/templates/overlays/planner-architecture.mdx +78 -0
- package/build/templates/overlays/planner-bugfix.mdx +36 -0
- package/build/templates/overlays/planner-feature.mdx +38 -0
- package/build/templates/overlays/planner-migration.mdx +50 -0
- package/build/templates/overlays/planner-refactor.mdx +57 -0
- package/build/templates/overlays/researcher-library.mdx +59 -0
- package/build/templates/overlays/researcher-performance.mdx +68 -0
- package/build/templates/overlays/researcher-security.mdx +86 -0
- package/build/templates/overlays/tester-graphql.mdx +191 -0
- package/build/templates/overlays/tester-playwright.mdx +621 -0
- package/build/templates/overlays/tester-rest.mdx +101 -0
- package/build/templates/overlays/tester-suite.mdx +177 -0
- package/build/templates/super-coder.mdx +529 -0
- package/build/templates/super-planner.mdx +568 -0
- package/build/templates/super-researcher.mdx +406 -0
- package/build/templates/super-tester.mdx +243 -0
- package/build/tools/answer-question.d.ts +30 -0
- package/build/tools/answer-question.d.ts.map +1 -0
- package/build/tools/answer-question.js +108 -0
- package/build/tools/answer-question.js.map +1 -0
- package/build/tools/cancel-task.d.ts +44 -0
- package/build/tools/cancel-task.d.ts.map +1 -0
- package/build/tools/cancel-task.js +144 -0
- package/build/tools/cancel-task.js.map +1 -0
- package/build/tools/send-message.d.ts +39 -0
- package/build/tools/send-message.d.ts.map +1 -0
- package/build/tools/send-message.js +124 -0
- package/build/tools/send-message.js.map +1 -0
- package/build/tools/shared-spawn.d.ts +56 -0
- package/build/tools/shared-spawn.d.ts.map +1 -0
- package/build/tools/shared-spawn.js +114 -0
- package/build/tools/shared-spawn.js.map +1 -0
- package/build/tools/spawn-agent.d.ts +85 -0
- package/build/tools/spawn-agent.d.ts.map +1 -0
- package/build/tools/spawn-agent.js +133 -0
- package/build/tools/spawn-agent.js.map +1 -0
- package/build/tools/spawn-coder.d.ts +70 -0
- package/build/tools/spawn-coder.d.ts.map +1 -0
- package/build/tools/spawn-coder.js +71 -0
- package/build/tools/spawn-coder.js.map +1 -0
- package/build/tools/spawn-planner.d.ts +70 -0
- package/build/tools/spawn-planner.d.ts.map +1 -0
- package/build/tools/spawn-planner.js +71 -0
- package/build/tools/spawn-planner.js.map +1 -0
- package/build/tools/spawn-researcher.d.ts +70 -0
- package/build/tools/spawn-researcher.d.ts.map +1 -0
- package/build/tools/spawn-researcher.js +70 -0
- package/build/tools/spawn-researcher.js.map +1 -0
- package/build/tools/spawn-task.d.ts +74 -0
- package/build/tools/spawn-task.d.ts.map +1 -0
- package/build/tools/spawn-task.js +107 -0
- package/build/tools/spawn-task.js.map +1 -0
- package/build/tools/spawn-tester.d.ts +70 -0
- package/build/tools/spawn-tester.d.ts.map +1 -0
- package/build/tools/spawn-tester.js +69 -0
- package/build/tools/spawn-tester.js.map +1 -0
- package/build/types.d.ts +101 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +28 -0
- package/build/types.js.map +1 -0
- package/build/utils/brief-validator.d.ts +30 -0
- package/build/utils/brief-validator.d.ts.map +1 -0
- package/build/utils/brief-validator.js +254 -0
- package/build/utils/brief-validator.js.map +1 -0
- package/build/utils/format.d.ts +34 -0
- package/build/utils/format.d.ts.map +1 -0
- package/build/utils/format.js +55 -0
- package/build/utils/format.js.map +1 -0
- package/build/utils/sanitize.d.ts +240 -0
- package/build/utils/sanitize.d.ts.map +1 -0
- package/build/utils/sanitize.js +89 -0
- package/build/utils/sanitize.js.map +1 -0
- package/build/utils/task-id-generator.d.ts +10 -0
- package/build/utils/task-id-generator.d.ts.map +1 -0
- package/build/utils/task-id-generator.js +22 -0
- package/build/utils/task-id-generator.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
## LIBRARY EVALUATION REFERENCE
|
|
2
|
+
|
|
3
|
+
These frameworks help structure library evaluation. Use what's relevant — a simple "which library" question may only need a comparison matrix, while an adoption decision needs the full analysis. Let the research question guide depth.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### COMPARISON MATRIX (Template)
|
|
8
|
+
|
|
9
|
+
When comparing libraries, this structure helps organize findings:
|
|
10
|
+
|
|
11
|
+
| Criterion | Library A | Library B |
|
|
12
|
+
|-----------|-----------|-----------|
|
|
13
|
+
| Core features | Does it do what we need? | |
|
|
14
|
+
| Performance / bundle size | Benchmarks, minified+gzip | |
|
|
15
|
+
| TypeScript support | Native types? Quality? | |
|
|
16
|
+
| License | Compatible with our project? | |
|
|
17
|
+
| Maintenance | Last release, active issues | |
|
|
18
|
+
| Migration cost | From current → this library | |
|
|
19
|
+
| Community | Downloads, SO questions, Discord | |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### GITHUB HEALTH SIGNALS
|
|
24
|
+
|
|
25
|
+
Quick health check for any library:
|
|
26
|
+
|
|
27
|
+
| Signal | Healthy | Red Flag |
|
|
28
|
+
|--------|---------|----------|
|
|
29
|
+
| Last commit | <3 months | >12 months |
|
|
30
|
+
| Contributors | >5 active | Single maintainer |
|
|
31
|
+
| Releases | Regular | None in >1 year |
|
|
32
|
+
| Open issues | Triaged, responsive | >500 untriaged |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
### LICENSE COMPATIBILITY (Reference)
|
|
37
|
+
|
|
38
|
+
| Our License | Safe | Risky |
|
|
39
|
+
|-------------|------|-------|
|
|
40
|
+
| MIT/Apache | MIT, Apache, BSD, ISC | GPL (copyleft) |
|
|
41
|
+
| GPL | MIT, Apache, GPL, LGPL | Proprietary |
|
|
42
|
+
| Proprietary | MIT, Apache, BSD, ISC | GPL, AGPL |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### MIGRATION COST FACTORS
|
|
47
|
+
|
|
48
|
+
When evaluating a library that replaces an existing one:
|
|
49
|
+
- API surface similarity (drop-in vs complete rewrite)
|
|
50
|
+
- Files affected (scope)
|
|
51
|
+
- Type compatibility
|
|
52
|
+
- Test impact
|
|
53
|
+
- Runtime behavior differences
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### COMMUNITY HEALTH SIGNALS
|
|
58
|
+
|
|
59
|
+
Beyond GitHub: npm/PyPI download trends, Stack Overflow activity, Discord/Slack community responsiveness, blog ecosystem, conference talks.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
## PERFORMANCE RESEARCH REFERENCE
|
|
2
|
+
|
|
3
|
+
These frameworks help structure performance research. Use what's relevant — a specific "why is X slow" question needs profiling guidance, while a "should we use X or Y" question needs benchmark methodology. Let the question guide your approach.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### BENCHMARK METHODOLOGY
|
|
8
|
+
|
|
9
|
+
When evaluating or comparing performance:
|
|
10
|
+
- **Warm-up:** Discard first N iterations (JIT, cache warming)
|
|
11
|
+
- **Sample size:** 100+ for micro, 10+ for integration
|
|
12
|
+
- **Percentiles:** Report p50, p95, p99 — not averages (averages hide tail latency)
|
|
13
|
+
- **Environment:** Note hardware, OS, runtime, load — results aren't portable without context
|
|
14
|
+
- **Comparison:** Same environment, same workload, same methodology, warm-up excluded
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
### PROFILING BY LAYER
|
|
19
|
+
|
|
20
|
+
When investigating performance issues, identify the bottleneck layer first:
|
|
21
|
+
|
|
22
|
+
| Layer | Tools | Key Metrics |
|
|
23
|
+
|-------|-------|-------------|
|
|
24
|
+
| Frontend | Lighthouse, DevTools | FCP, LCP, CLS, TTI, bundle size |
|
|
25
|
+
| Network | DevTools Network, curl -w | TTFB, transfer size, connections |
|
|
26
|
+
| Backend | Profiler, APM | Response time, CPU, memory |
|
|
27
|
+
| Database | EXPLAIN ANALYZE, slow query log | Query time, index usage, locks |
|
|
28
|
+
| Infrastructure | top, iostat, docker stats | CPU%, memory%, disk I/O |
|
|
29
|
+
|
|
30
|
+
**Rule of thumb:** Identify WHICH layer is the bottleneck before recommending optimizations.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### CORE WEB VITALS (Reference)
|
|
35
|
+
|
|
36
|
+
| Metric | Good | Poor | Measures |
|
|
37
|
+
|--------|------|------|----------|
|
|
38
|
+
| LCP | <2.5s | >4.0s | Largest content rendered |
|
|
39
|
+
| INP | <200ms | >500ms | Interaction responsiveness |
|
|
40
|
+
| CLS | <0.1 | >0.25 | Visual stability |
|
|
41
|
+
|
|
42
|
+
Lab tools: Lighthouse, WebPageTest. Field tools: CrUX, RUM.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### OPTIMIZATION HIERARCHY
|
|
47
|
+
|
|
48
|
+
When recommending optimizations, higher levels yield bigger gains:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
1. ALGORITHM (Big-O) — up to 1000x (right data structure? unnecessary work?)
|
|
52
|
+
2. ARCHITECTURE — up to 100x (caching, async, connection pooling)
|
|
53
|
+
3. IMPLEMENTATION — up to 10x (batching, streaming, pagination)
|
|
54
|
+
4. MICRO-OPTIMIZATION — up to 2x (object pooling, SIMD, JIT hints)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A better algorithm always beats a micro-optimized bad algorithm.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### DATABASE PERFORMANCE PATTERNS (Reference)
|
|
62
|
+
|
|
63
|
+
| Problem | Diagnosis | Solution |
|
|
64
|
+
|---------|-----------|----------|
|
|
65
|
+
| Slow queries | EXPLAIN ANALYZE | Add indexes, rewrite, denormalize |
|
|
66
|
+
| N+1 queries | Count queries/request | Eager loading, batch, DataLoader |
|
|
67
|
+
| Lock contention | pg_stat_activity | Optimize transactions, reduce scope |
|
|
68
|
+
| Connection exhaustion | Pool metrics | Pool sizing, timeouts |
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
## SECURITY RESEARCH REFERENCE
|
|
2
|
+
|
|
3
|
+
These frameworks and references are available to guide your research. Use what's relevant to the specific question — you don't need to apply every framework to every task. Let the research question drive your approach.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### OWASP TOP 10 (Reference)
|
|
8
|
+
|
|
9
|
+
Use when evaluating security posture of a component:
|
|
10
|
+
|
|
11
|
+
| # | Category | Key Question |
|
|
12
|
+
|---|----------|-------------|
|
|
13
|
+
| A01 | Broken Access Control | Can users act outside their intended permissions? |
|
|
14
|
+
| A02 | Cryptographic Failures | Is sensitive data properly encrypted in transit and at rest? |
|
|
15
|
+
| A03 | Injection | Can untrusted data be interpreted as commands? |
|
|
16
|
+
| A04 | Insecure Design | Are there missing security controls in the architecture? |
|
|
17
|
+
| A05 | Security Misconfiguration | Are defaults secure? Unnecessary features disabled? |
|
|
18
|
+
| A06 | Vulnerable Components | Are dependencies up-to-date? Known CVEs? |
|
|
19
|
+
| A07 | Auth Failures | Can authentication be bypassed? |
|
|
20
|
+
| A08 | Data Integrity Failures | Can software updates or CI/CD pipelines be compromised? |
|
|
21
|
+
| A09 | Logging & Monitoring | Would an attack be detected? |
|
|
22
|
+
| A10 | SSRF | Can the server make requests to internal resources? |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### CVE LOOKUP PATTERNS
|
|
27
|
+
|
|
28
|
+
When researching known vulnerabilities:
|
|
29
|
+
- NVD: `site:nvd.nist.gov [library] [version]`
|
|
30
|
+
- GitHub Advisories: `site:github.com/advisories [library]`
|
|
31
|
+
- Snyk: `site:snyk.io/vuln [library]`
|
|
32
|
+
- Library's own SECURITY.md
|
|
33
|
+
|
|
34
|
+
For each CVE: note ID, CVSS score, affected versions, whether our version is affected, available fix/patch.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
### STRIDE THREAT MODEL (Reference)
|
|
39
|
+
|
|
40
|
+
Useful when analyzing a system for threats:
|
|
41
|
+
|
|
42
|
+
| Threat | Question |
|
|
43
|
+
|--------|----------|
|
|
44
|
+
| **S**poofing | Can someone impersonate another identity? |
|
|
45
|
+
| **T**ampering | Can data be modified in transit/at rest? |
|
|
46
|
+
| **R**epudiation | Can actions be denied without audit trail? |
|
|
47
|
+
| **I**nformation Disclosure | Can unauthorized data be accessed? |
|
|
48
|
+
| **D**enial of Service | Can the system be made unavailable? |
|
|
49
|
+
| **E**levation of Privilege | Can an attacker gain higher access? |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### COMPLIANCE STANDARDS (Reference)
|
|
54
|
+
|
|
55
|
+
Reference only when the research question involves compliance:
|
|
56
|
+
|
|
57
|
+
| Standard | Scope | Key Concern |
|
|
58
|
+
|----------|-------|-------------|
|
|
59
|
+
| SOC 2 | SaaS/Cloud | Access control, encryption, monitoring |
|
|
60
|
+
| GDPR | EU user data | Consent, data minimization, deletion rights |
|
|
61
|
+
| HIPAA | Health data | PHI encryption, access logs |
|
|
62
|
+
| PCI DSS | Payment data | Card data encryption, segmentation |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### SOURCE AUTHORITY RANKING
|
|
67
|
+
|
|
68
|
+
For security topics, prefer higher-authority sources:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
NIST, RFCs, FIPS > OWASP, CWE, SANS, CVE/NVD > Auth0/Cloudflare/AWS blogs > Reddit, Stack Overflow
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### SEVERITY CLASSIFICATION
|
|
77
|
+
|
|
78
|
+
When reporting findings, classify severity to help prioritize:
|
|
79
|
+
|
|
80
|
+
| Severity | Definition |
|
|
81
|
+
|----------|-----------|
|
|
82
|
+
| CRITICAL | Active exploitation possible, data breach risk |
|
|
83
|
+
| HIGH | Exploitable with minimal skill, significant impact |
|
|
84
|
+
| MEDIUM | Requires specific conditions or moderate skill |
|
|
85
|
+
| LOW | Theoretical risk, minimal impact |
|
|
86
|
+
| INFO | Best practice deviation, no direct risk |
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
## GRAPHQL API TESTING GUIDELINES
|
|
2
|
+
|
|
3
|
+
You are testing a **GraphQL API**. GraphQL has unique testing patterns — errors come in the response body (not HTTP status), a single endpoint handles all operations, and schema introspection enables systematic testing.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### TOOLKIT PATTERN
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
curl -X POST http://localhost:3000/graphql \
|
|
11
|
+
-H "Content-Type: application/json" \
|
|
12
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
13
|
+
-d '{"query":"...", "variables":{}}' \
|
|
14
|
+
-w "\n\nHTTP_CODE: %{http_code}\nTIME: %{time_total}s" \
|
|
15
|
+
-s -S 2>&1 | tee .agent-workspace/qa/evidence/curl/NN-description.txt
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
### SCHEMA INTROSPECTION
|
|
21
|
+
|
|
22
|
+
Start every GraphQL test session by discovering the schema:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Full introspection query
|
|
26
|
+
curl -X POST http://localhost:3000/graphql \
|
|
27
|
+
-H "Content-Type: application/json" \
|
|
28
|
+
-d '{"query":"{ __schema { queryType { fields { name } } mutationType { fields { name } } } }"}' \
|
|
29
|
+
-s | jq .
|
|
30
|
+
|
|
31
|
+
# Check specific type
|
|
32
|
+
curl -X POST http://localhost:3000/graphql \
|
|
33
|
+
-H "Content-Type: application/json" \
|
|
34
|
+
-d '{"query":"{ __type(name: \"User\") { fields { name type { name kind } } } }"}' \
|
|
35
|
+
-s | jq .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This tells you what queries, mutations, and types are available.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### QUERY TESTING
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Simple query
|
|
46
|
+
curl -X POST http://localhost:3000/graphql \
|
|
47
|
+
-H "Content-Type: application/json" \
|
|
48
|
+
-d '{"query":"{ users { id name email } }"}' \
|
|
49
|
+
-s | jq .
|
|
50
|
+
|
|
51
|
+
# Query with variables
|
|
52
|
+
curl -X POST http://localhost:3000/graphql \
|
|
53
|
+
-H "Content-Type: application/json" \
|
|
54
|
+
-d '{"query":"query GetUser($id: ID!) { user(id: $id) { id name email } }", "variables":{"id":"123"}}' \
|
|
55
|
+
-s | jq .
|
|
56
|
+
|
|
57
|
+
# Nested query (N+1 risk area)
|
|
58
|
+
curl -X POST http://localhost:3000/graphql \
|
|
59
|
+
-H "Content-Type: application/json" \
|
|
60
|
+
-d '{"query":"{ users { id posts { id title comments { id body } } } }"}' \
|
|
61
|
+
-s | jq .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### MUTATION TESTING
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Create
|
|
70
|
+
curl -X POST http://localhost:3000/graphql \
|
|
71
|
+
-H "Content-Type: application/json" \
|
|
72
|
+
-d '{"query":"mutation { createUser(input: {name: \"Test\", email: \"test@example.com\"}) { id name } }"}' \
|
|
73
|
+
-s | jq .
|
|
74
|
+
|
|
75
|
+
# Update
|
|
76
|
+
curl -X POST http://localhost:3000/graphql \
|
|
77
|
+
-H "Content-Type: application/json" \
|
|
78
|
+
-d '{"query":"mutation { updateUser(id: \"ID\", input: {name: \"Updated\"}) { id name } }"}' \
|
|
79
|
+
-s | jq .
|
|
80
|
+
|
|
81
|
+
# Delete
|
|
82
|
+
curl -X POST http://localhost:3000/graphql \
|
|
83
|
+
-H "Content-Type: application/json" \
|
|
84
|
+
-d '{"query":"mutation { deleteUser(id: \"ID\") { success } }"}' \
|
|
85
|
+
-s | jq .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### ERROR HANDLING — THE KEY DIFFERENCE
|
|
91
|
+
|
|
92
|
+
**GraphQL errors are in the response body, NOT HTTP status codes.** A GraphQL request almost always returns HTTP 200 — check the `errors` field.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# This returns HTTP 200 even with errors:
|
|
96
|
+
RESPONSE=$(curl -X POST http://localhost:3000/graphql \
|
|
97
|
+
-H "Content-Type: application/json" \
|
|
98
|
+
-d '{"query":"{ nonexistent { id } }"}' \
|
|
99
|
+
-s)
|
|
100
|
+
|
|
101
|
+
# Check for errors in response body
|
|
102
|
+
echo "$RESPONSE" | jq '.errors'
|
|
103
|
+
echo "$RESPONSE" | jq '.errors[0].message'
|
|
104
|
+
echo "$RESPONSE" | jq '.errors[0].extensions.code'
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Verify error format:**
|
|
108
|
+
- `errors` array present
|
|
109
|
+
- Each error has `message` field
|
|
110
|
+
- Extensions with error codes (if the API uses them)
|
|
111
|
+
- No data leakage in error messages
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### AUTH & AUTHORIZATION TESTING
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# No auth header — should return error in body (NOT 401)
|
|
119
|
+
curl -X POST http://localhost:3000/graphql \
|
|
120
|
+
-H "Content-Type: application/json" \
|
|
121
|
+
-d '{"query":"{ me { id email } }"}' \
|
|
122
|
+
-s | jq '.errors'
|
|
123
|
+
|
|
124
|
+
# Invalid token
|
|
125
|
+
curl -X POST http://localhost:3000/graphql \
|
|
126
|
+
-H "Content-Type: application/json" \
|
|
127
|
+
-H "Authorization: Bearer invalid" \
|
|
128
|
+
-d '{"query":"{ me { id email } }"}' \
|
|
129
|
+
-s | jq '.errors'
|
|
130
|
+
|
|
131
|
+
# Field-level authorization — try accessing admin fields as regular user
|
|
132
|
+
curl -X POST http://localhost:3000/graphql \
|
|
133
|
+
-H "Content-Type: application/json" \
|
|
134
|
+
-H "Authorization: Bearer $USER_TOKEN" \
|
|
135
|
+
-d '{"query":"{ users { id email role passwordHash } }"}' \
|
|
136
|
+
-s | jq .
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### INPUT VALIDATION TESTING
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Missing required field
|
|
145
|
+
curl -X POST http://localhost:3000/graphql \
|
|
146
|
+
-H "Content-Type: application/json" \
|
|
147
|
+
-d '{"query":"mutation { createUser(input: {}) { id } }"}' \
|
|
148
|
+
-s | jq '.errors'
|
|
149
|
+
|
|
150
|
+
# Invalid type
|
|
151
|
+
curl -X POST http://localhost:3000/graphql \
|
|
152
|
+
-H "Content-Type: application/json" \
|
|
153
|
+
-d '{"query":"mutation { createUser(input: {name: 123}) { id } }"}' \
|
|
154
|
+
-s | jq '.errors'
|
|
155
|
+
|
|
156
|
+
# Injection attempt — GraphQL should handle this safely
|
|
157
|
+
curl -X POST http://localhost:3000/graphql \
|
|
158
|
+
-H "Content-Type: application/json" \
|
|
159
|
+
-d '{"query":"{ user(id: \"1; DROP TABLE users\") { id } }"}' \
|
|
160
|
+
-s | jq .
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### SUBSCRIPTION TESTING (if applicable)
|
|
166
|
+
|
|
167
|
+
For WebSocket-based subscriptions, use `wscat` or `websocat`:
|
|
168
|
+
```bash
|
|
169
|
+
# Connect and subscribe
|
|
170
|
+
wscat -c ws://localhost:3000/graphql -x '{"type":"connection_init","payload":{}}' \
|
|
171
|
+
-x '{"type":"subscribe","id":"1","payload":{"query":"subscription { messageAdded { id content } }"}}'
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### PERFORMANCE TESTING
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Query complexity — deeply nested queries can cause performance issues
|
|
180
|
+
# Test with increasing depth to find limits
|
|
181
|
+
curl -X POST http://localhost:3000/graphql \
|
|
182
|
+
-H "Content-Type: application/json" \
|
|
183
|
+
-d '{"query":"{ users { posts { comments { author { posts { comments { id } } } } } } }"}' \
|
|
184
|
+
-w "\nTIME: %{time_total}s" -s | jq .
|
|
185
|
+
|
|
186
|
+
# Batch queries (if supported)
|
|
187
|
+
curl -X POST http://localhost:3000/graphql \
|
|
188
|
+
-H "Content-Type: application/json" \
|
|
189
|
+
-d '[{"query":"{ user(id: \"1\") { name } }"}, {"query":"{ user(id: \"2\") { name } }"}]' \
|
|
190
|
+
-s | jq .
|
|
191
|
+
```
|