@gendigital/sage-opencode 0.11.0 → 0.13.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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +255 -74
  4. package/dist/index.js.map +1 -1
  5. package/dist/mcp-server.cjs +230 -96
  6. package/dist/mcp-server.cjs.map +4 -4
  7. package/dist/plugin-discovery.d.ts +1 -0
  8. package/dist/plugin-discovery.d.ts.map +1 -1
  9. package/dist/plugin-discovery.js +27 -1
  10. package/dist/plugin-discovery.js.map +1 -1
  11. package/dist/startup-scan.d.ts +11 -3
  12. package/dist/startup-scan.d.ts.map +1 -1
  13. package/dist/startup-scan.js +59 -21
  14. package/dist/startup-scan.js.map +1 -1
  15. package/dist/tool-handler.d.ts +2 -1
  16. package/dist/tool-handler.d.ts.map +1 -1
  17. package/dist/tool-handler.js +17 -4
  18. package/dist/tool-handler.js.map +1 -1
  19. package/package.json +3 -3
  20. package/resources/threats/_macros.yaml +193 -0
  21. package/resources/threats/agent-layer.yaml +19 -1
  22. package/resources/threats/commands.yaml +165 -31
  23. package/resources/threats/credentials.yaml +24 -4
  24. package/resources/threats/dummy.yaml +52 -17
  25. package/resources/threats/files.yaml +38 -0
  26. package/resources/threats/mac-commands.yaml +118 -27
  27. package/resources/threats/mac-credentials.yaml +34 -8
  28. package/resources/threats/mac-files.yaml +20 -0
  29. package/resources/threats/mac-obfuscation.yaml +28 -6
  30. package/resources/threats/mac-persistence.yaml +30 -4
  31. package/resources/threats/mac-supply-chain.yaml +12 -3
  32. package/resources/threats/mitre.yaml +325 -62
  33. package/resources/threats/obfuscation.yaml +33 -8
  34. package/resources/threats/persistence.yaml +40 -5
  35. package/resources/threats/prompt-injection.yaml +58 -0
  36. package/resources/threats/self-defense.yaml +15 -2
  37. package/resources/threats/supply_chain.yaml +6 -1
  38. package/resources/threats/urls.yaml +10 -0
  39. package/resources/threats/win-commands.yaml +294 -60
  40. package/resources/threats/win-credentials.yaml +68 -9
  41. package/resources/threats/win-files.yaml +20 -0
  42. package/resources/threats/win-obfuscation.yaml +56 -8
  43. package/resources/threats/win-persistence.yaml +45 -7
  44. package/resources/threats/win-supply-chain.yaml +5 -1
@@ -2,8 +2,13 @@
2
2
  # Author: Test — NOT real threats
3
3
  #
4
4
  # Canary rules that match completely harmless, highly-specific marker strings.
5
- # The "__sage_test_" prefix would never appear in real-world code,
6
- # making false positives essentially impossible.
5
+ # The markers are deliberately OPAQUE (e.g. "diagmark_cmd_a75bf229", not
6
+ # "__sage_test_deny_cmd_..."): a self-describing name reads as a security probe, and
7
+ # a safety-trained model given security context (e.g. OpenCode, which injects Sage's
8
+ # scan findings into the prompt) will REFUSE to run it — so the artifact never
9
+ # reaches Sage and the E2E deny/ask test can't fire. Opaque markers run as rote yet
10
+ # stay unique random strings, so false positives are essentially impossible. The
11
+ # rule id/title carry the human-readable meaning; the hex suffix aids traceability.
7
12
  #
8
13
  # Coverage matrix:
9
14
  # Tool match_on block(deny) require_approval(ask) log(allow)
@@ -21,50 +26,60 @@
21
26
  # ─── Command patterns (Bash tool) ───────────────────────────────────
22
27
 
23
28
  - id: "DUMMY-CMD-DENY-001"
29
+ version: 1
30
+ detection_name: "CMD:SageTestCommandDeny-A [Tst]"
24
31
  category: testing
25
32
  severity: critical
26
33
  confidence: 0.95
27
- pattern: "__sage_test_deny_cmd_a75bf229__"
34
+ pattern: "diagmark_cmd_a75bf229"
28
35
  match_on: command
29
36
  title: "[TEST] Canary deny command (alpha)"
30
37
  expires_at: null
31
38
  revoked: false
32
39
 
33
40
  - id: "DUMMY-CMD-DENY-002"
41
+ version: 1
42
+ detection_name: "CMD:SageTestCommandDeny-B [Tst]"
34
43
  category: testing
35
44
  severity: critical
36
45
  confidence: 0.95
37
- pattern: "__sage_test_deny_run_c3d91e4a__"
46
+ pattern: "diagmark_run_c3d91e4a"
38
47
  match_on: command
39
48
  title: "[TEST] Canary deny command (bravo)"
40
49
  expires_at: null
41
50
  revoked: false
42
51
 
43
52
  - id: "DUMMY-CMD-ASK-001"
53
+ version: 1
54
+ detection_name: "CMD:SageTestCommandAsk-A [Tst]"
44
55
  category: testing
45
56
  severity: warning
46
57
  confidence: 0.60
47
- pattern: "__sage_test_ask_cmd_8f2e6b71__"
58
+ pattern: "diagmark_cmd_8f2e6b71"
48
59
  match_on: command
49
60
  title: "[TEST] Canary approval command (alpha)"
50
61
  expires_at: null
51
62
  revoked: false
52
63
 
53
64
  - id: "DUMMY-CMD-ASK-002"
65
+ version: 1
66
+ detection_name: "CMD:SageTestCommandAsk-B [Tst]"
54
67
  category: testing
55
68
  severity: warning
56
69
  confidence: 0.60
57
- pattern: "__sage_test_ask_run_d4a09c53__"
70
+ pattern: "diagmark_run_d4a09c53"
58
71
  match_on: command
59
72
  title: "[TEST] Canary approval command (bravo)"
60
73
  expires_at: null
61
74
  revoked: false
62
75
 
63
76
  - id: "DUMMY-CMD-LOG-001"
77
+ version: 1
78
+ detection_name: "CMD:SageTestCommandLog-A [Tst]"
64
79
  category: testing
65
80
  severity: info
66
81
  confidence: 0.10
67
- pattern: "__sage_test_log_cmd_1b7e3f82__"
82
+ pattern: "diagmark_cmd_1b7e3f82"
68
83
  match_on: command
69
84
  title: "[TEST] Canary log-only command"
70
85
  expires_at: null
@@ -74,30 +89,36 @@
74
89
  # ─── File-path patterns (Write / Edit / Read / Delete tools) ────────
75
90
 
76
91
  - id: "DUMMY-FILE-DENY-001"
92
+ version: 1
93
+ detection_name: "FN:SageTestFileDeny-A [Tst]"
77
94
  category: testing
78
95
  severity: critical
79
96
  confidence: 0.95
80
- pattern: "__sage_test_deny_file_e6c4a918__"
97
+ pattern: "diagmark_file_e6c4a918"
81
98
  match_on: file_path
82
99
  title: "[TEST] Canary deny file path"
83
100
  expires_at: null
84
101
  revoked: false
85
102
 
86
103
  - id: "DUMMY-FILE-ASK-001"
104
+ version: 1
105
+ detection_name: "FN:SageTestFileAsk-A [Tst]"
87
106
  category: testing
88
107
  severity: warning
89
108
  confidence: 0.60
90
- pattern: "__sage_test_ask_file_52fd7b36__"
109
+ pattern: "diagmark_file_52fd7b36"
91
110
  match_on: file_path
92
111
  title: "[TEST] Canary approval file path"
93
112
  expires_at: null
94
113
  revoked: false
95
114
 
96
115
  - id: "DUMMY-FILE-LOG-001"
116
+ version: 1
117
+ detection_name: "FN:SageTestFileLog-A [Tst]"
97
118
  category: testing
98
119
  severity: info
99
120
  confidence: 0.10
100
- pattern: "__sage_test_log_file_9a13de74__"
121
+ pattern: "diagmark_file_9a13de74"
101
122
  match_on: file_path
102
123
  title: "[TEST] Canary log-only file path"
103
124
  expires_at: null
@@ -107,30 +128,36 @@
107
128
  # ─── Content patterns (Write / Edit tools — file body) ──────────────
108
129
 
109
130
  - id: "DUMMY-CONTENT-DENY-001"
131
+ version: 1
132
+ detection_name: "Other:SageTestContentDeny-A [Tst]"
110
133
  category: testing
111
134
  severity: critical
112
135
  confidence: 0.95
113
- pattern: "__SAGE_TEST_DENY_CONTENT_3c8f15b7__"
136
+ pattern: "diagmark_content_3c8f15b7"
114
137
  match_on: content
115
138
  title: "[TEST] Canary deny content"
116
139
  expires_at: null
117
140
  revoked: false
118
141
 
119
142
  - id: "DUMMY-CONTENT-ASK-001"
143
+ version: 1
144
+ detection_name: "Other:SageTestContentAsk-A [Tst]"
120
145
  category: testing
121
146
  severity: warning
122
147
  confidence: 0.60
123
- pattern: "__SAGE_TEST_ASK_CONTENT_7d4ea2c9__"
148
+ pattern: "diagmark_content_7d4ea2c9"
124
149
  match_on: content
125
150
  title: "[TEST] Canary approval content"
126
151
  expires_at: null
127
152
  revoked: false
128
153
 
129
154
  - id: "DUMMY-CONTENT-LOG-001"
155
+ version: 1
156
+ detection_name: "Other:SageTestContentLog-A [Tst]"
130
157
  category: testing
131
158
  severity: info
132
159
  confidence: 0.10
133
- pattern: "__SAGE_TEST_LOG_CONTENT_f0b683d1__"
160
+ pattern: "diagmark_content_f0b683d1"
134
161
  match_on: content
135
162
  title: "[TEST] Canary log-only content"
136
163
  expires_at: null
@@ -141,30 +168,36 @@
141
168
  # Uses .test TLD (RFC 2606 reserved, never resolves) for safety.
142
169
 
143
170
  - id: "DUMMY-URL-DENY-001"
171
+ version: 1
172
+ detection_name: "FN:SageTestUrlDeny-A [Tst]"
144
173
  category: testing
145
174
  severity: critical
146
175
  confidence: 0.95
147
- pattern: "sage-canary-deny-4e91ca37\\.test"
176
+ pattern: "diaghost-4e91ca37\\.test"
148
177
  match_on: url
149
178
  title: "[TEST] Canary deny URL"
150
179
  expires_at: null
151
180
  revoked: false
152
181
 
153
182
  - id: "DUMMY-URL-ASK-001"
183
+ version: 1
184
+ detection_name: "FN:SageTestUrlAsk-A [Tst]"
154
185
  category: testing
155
186
  severity: warning
156
187
  confidence: 0.60
157
- pattern: "sage-canary-ask-b26d80f5\\.test"
188
+ pattern: "diaghost-b26d80f5\\.test"
158
189
  match_on: url
159
190
  title: "[TEST] Canary approval URL"
160
191
  expires_at: null
161
192
  revoked: false
162
193
 
163
194
  - id: "DUMMY-URL-LOG-001"
195
+ version: 1
196
+ detection_name: "FN:SageTestUrlLog-A [Tst]"
164
197
  category: testing
165
198
  severity: info
166
199
  confidence: 0.10
167
- pattern: "sage-canary-log-65f3d7a4\\.test"
200
+ pattern: "diaghost-65f3d7a4\\.test"
168
201
  match_on: url
169
202
  title: "[TEST] Canary log-only URL"
170
203
  expires_at: null
@@ -174,10 +207,12 @@
174
207
  # ─── Domain pattern (verifies domain→url routing in heuristics) ─────
175
208
 
176
209
  - id: "DUMMY-DOMAIN-DENY-001"
210
+ version: 1
211
+ detection_name: "FN:SageTestDomainDeny-A [Tst]"
177
212
  category: testing
178
213
  severity: critical
179
214
  confidence: 0.95
180
- pattern: "sage-canary-domain-0c82eb16\\.test"
215
+ pattern: "diaghost-0c82eb16\\.test"
181
216
  match_on: domain
182
217
  title: "[TEST] Canary deny domain"
183
218
  expires_at: null
@@ -5,6 +5,8 @@
5
5
 
6
6
  # --- System auth files ---
7
7
  - id: "CLT-FILE-001"
8
+ version: 1
9
+ detection_name: "FN:SageFile-A [Heur]"
8
10
  category: secrets
9
11
  severity: critical
10
12
  confidence: 0.95
@@ -16,6 +18,8 @@
16
18
 
17
19
  # --- SSH authorized_keys ---
18
20
  - id: "CLT-FILE-002"
21
+ version: 1
22
+ detection_name: "FN:SageFile-B [Heur]"
19
23
  category: secrets
20
24
  severity: critical
21
25
  confidence: 0.95
@@ -27,6 +31,8 @@
27
31
 
28
32
  # --- SSH private keys and config ---
29
33
  - id: "CLT-FILE-003"
34
+ version: 1
35
+ detection_name: "FN:SageFile-C [Heur]"
30
36
  category: secrets
31
37
  severity: warning
32
38
  confidence: 0.60
@@ -38,6 +44,8 @@
38
44
 
39
45
  # --- Shell RC files ---
40
46
  - id: "CLT-FILE-004"
47
+ version: 1
48
+ detection_name: "FN:SageFile-D [Heur]"
41
49
  category: tool
42
50
  severity: warning
43
51
  confidence: 0.60
@@ -49,6 +57,8 @@
49
57
 
50
58
  # --- Cron directories ---
51
59
  - id: "CLT-FILE-006"
60
+ version: 1
61
+ detection_name: "FN:SageFile-F [Heur]"
52
62
  category: tool
53
63
  severity: warning
54
64
  confidence: 0.60
@@ -60,6 +70,8 @@
60
70
 
61
71
  # --- systemd unit files ---
62
72
  - id: "CLT-FILE-007"
73
+ version: 1
74
+ detection_name: "FN:SageFile-G [Heur]"
63
75
  category: tool
64
76
  severity: warning
65
77
  confidence: 0.60
@@ -75,6 +87,8 @@
75
87
  # match CRED-003 but not FILE-008 — intentional, since file_path matching is more
76
88
  # targeted than command-string matching.
77
89
  - id: "CLT-FILE-008"
90
+ version: 1
91
+ detection_name: "FN:SageFile-H [Heur]"
78
92
  category: secrets
79
93
  severity: warning
80
94
  confidence: 0.60
@@ -86,6 +100,8 @@
86
100
 
87
101
  # --- Git hooks ---
88
102
  - id: "CLT-FILE-009"
103
+ version: 1
104
+ detection_name: "FN:SageFile-I [Heur]"
89
105
  category: tool
90
106
  severity: warning
91
107
  confidence: 0.60
@@ -97,6 +113,8 @@
97
113
 
98
114
  # --- Android signing files ---
99
115
  - id: "CLT-FILE-010"
116
+ version: 1
117
+ detection_name: "FN:SageFile-J [Heur]"
100
118
  category: secrets
101
119
  severity: warning
102
120
  confidence: 0.60
@@ -108,6 +126,8 @@
108
126
 
109
127
  # --- Firebase config files ---
110
128
  - id: "CLT-FILE-011"
129
+ version: 1
130
+ detection_name: "FN:SageFile-K [Heur]"
111
131
  category: secrets
112
132
  severity: warning
113
133
  confidence: 0.60
@@ -119,6 +139,8 @@
119
139
 
120
140
  # --- Cloud provider credential files ---
121
141
  - id: "CLT-FILE-012"
142
+ version: 1
143
+ detection_name: "FN:SageFile-L [Heur]"
122
144
  category: secrets
123
145
  severity: warning
124
146
  confidence: 0.60
@@ -130,6 +152,8 @@
130
152
 
131
153
  # --- Package manager tokens ---
132
154
  - id: "CLT-FILE-013"
155
+ version: 1
156
+ detection_name: "FN:SageFile-M [Heur]"
133
157
  category: secrets
134
158
  severity: warning
135
159
  confidence: 0.60
@@ -141,6 +165,8 @@
141
165
 
142
166
  # --- Terraform state files ---
143
167
  - id: "CLT-FILE-014"
168
+ version: 1
169
+ detection_name: "FN:SageFile-N [Heur]"
144
170
  category: secrets
145
171
  severity: warning
146
172
  confidence: 0.60
@@ -152,6 +178,8 @@
152
178
 
153
179
  # --- Secrets/vault files ---
154
180
  - id: "CLT-FILE-015"
181
+ version: 1
182
+ detection_name: "FN:SageFile-O [Heur]"
155
183
  category: secrets
156
184
  severity: warning
157
185
  confidence: 0.60
@@ -166,6 +194,8 @@
166
194
  # Accepted trade-off: require_approval keeps noise bounded, and excluding .pem
167
195
  # would miss private key exfiltration.
168
196
  - id: "CLT-FILE-016"
197
+ version: 1
198
+ detection_name: "FN:SageFile-P [Heur]"
169
199
  category: secrets
170
200
  severity: warning
171
201
  confidence: 0.60
@@ -177,6 +207,8 @@
177
207
 
178
208
  # --- Kubeconfig ---
179
209
  - id: "CLT-FILE-017"
210
+ version: 1
211
+ detection_name: "FN:SageFile-Q [Heur]"
180
212
  category: secrets
181
213
  severity: warning
182
214
  confidence: 0.60
@@ -188,6 +220,8 @@
188
220
 
189
221
  # --- Build system credential files ---
190
222
  - id: "CLT-FILE-018"
223
+ version: 1
224
+ detection_name: "FN:SageFile-R [Heur]"
191
225
  category: secrets
192
226
  severity: warning
193
227
  confidence: 0.60
@@ -199,6 +233,8 @@
199
233
 
200
234
  # --- Shell/REPL history files ---
201
235
  - id: "CLT-FILE-019"
236
+ version: 1
237
+ detection_name: "FN:SageFile-S [Heur]"
202
238
  category: secrets
203
239
  severity: warning
204
240
  confidence: 0.60
@@ -210,6 +246,8 @@
210
246
 
211
247
  # --- JetBrains IDE database credentials ---
212
248
  - id: "CLT-FILE-020"
249
+ version: 1
250
+ detection_name: "FN:SageFile-T [Heur]"
213
251
  category: secrets
214
252
  severity: warning
215
253
  confidence: 0.60