@rafter-security/cli 0.11.3 → 0.11.5

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.
@@ -111,7 +111,7 @@ function claudeCodeHooks() {
111
111
  if (settings.hooks.SessionStart.length === 0)
112
112
  delete settings.hooks.SessionStart;
113
113
  }
114
- settings.hooks.PreToolUse.push({ matcher: "Bash", hooks: [pre] }, { matcher: "Write|Edit", hooks: [pre] });
114
+ settings.hooks.PreToolUse.push({ matcher: "Bash", hooks: [pre] }, { matcher: "Write|Edit|MultiEdit", hooks: [pre] });
115
115
  // Narrow to tools that produce scannable output (shell output + file
116
116
  // writes); avoids firing posttool on every Read/MCP call (latency).
117
117
  settings.hooks.PostToolUse.push({ matcher: "Bash|Write|Edit|MultiEdit", hooks: [post] });
@@ -549,8 +549,9 @@ function geminiHooks() {
549
549
  s.hooks.AfterTool = filterOutRafter(s.hooks.AfterTool, (e) => hookEntryMatchesRafter(e, "rafter hook posttool"));
550
550
  // Explicit Gemini built-in tool names per geminicli.com/docs/hooks/reference
551
551
  // (rf-044o verification).
552
+ // No tool is named `edit`: Gemini's edit tool is `replace`.
552
553
  s.hooks.BeforeTool.push({
553
- matcher: "run_shell_command|write_file|replace|edit",
554
+ matcher: "run_shell_command|write_file|replace",
554
555
  hooks: [{ type: "command", command: "rafter hook pretool --format gemini", timeout: 5000 }],
555
556
  });
556
557
  s.hooks.AfterTool.push({
@@ -374,7 +374,7 @@ function installClaudeCodeHooks(root, out) {
374
374
  delete settings.hooks.SessionStart;
375
375
  }
376
376
  // Add Rafter hooks
377
- settings.hooks.PreToolUse.push({ matcher: "Bash", hooks: [preHook] }, { matcher: "Write|Edit", hooks: [preHook] });
377
+ settings.hooks.PreToolUse.push({ matcher: "Bash", hooks: [preHook] }, { matcher: "Write|Edit|MultiEdit", hooks: [preHook] });
378
378
  // Narrow to tools that produce scannable output (shell output + file
379
379
  // writes). Firing posttool on every tool — including Read and MCP calls —
380
380
  // added latency to operations that never produce secrets to redact.
@@ -590,10 +590,12 @@ function installGeminiHooks(root, out) {
590
590
  settings.hooks.AfterTool = settings.hooks.AfterTool.filter((entry) => !(entry.hooks || []).some((h) => String(h.command ?? "").includes("hook posttool")));
591
591
  // Gemini matchers are regexes against built-in tool names per
592
592
  // geminicli.com/docs/hooks/reference. Match the mutating tools by name
593
- // explicitly: run_shell_command, write_file, replace, edit. (rf-044o
594
- // verification 2026-05-03 — schema confirmed against current Gemini docs.)
593
+ // explicitly: run_shell_command, write_file, replace. (rf-044o
594
+ // verification 2026-05-03 — schema confirmed against current Gemini docs.
595
+ // Gemini has no tool named `edit`; its edit tool is `replace` per
596
+ // geminicli.com/docs/reference/tools.)
595
597
  settings.hooks.BeforeTool.push({
596
- matcher: "run_shell_command|write_file|replace|edit",
598
+ matcher: "run_shell_command|write_file|replace",
597
599
  hooks: [{ type: "command", command: absoluteHookCommand("pretool --format gemini"), timeout: 5000 }],
598
600
  });
599
601
  settings.hooks.AfterTool.push({
@@ -23,6 +23,59 @@ export const MAX_TRANSIENT_POLL_FAILURES = 5;
23
23
  * stop it. This is the backstop for that.
24
24
  */
25
25
  export const MAX_TOTAL_TRANSIENT_POLL_FAILURES = 20;
26
+ /**
27
+ * sable-96ex — a 429 during polling is ambiguous in this API: on scan SUBMIT it
28
+ * means "you are out of credits" (exit 3), and on the poll endpoint it would
29
+ * mean "you are going too fast". `Retry-After` is the disambiguator — a quota
30
+ * rejection does not carry one, a rate limiter does — so a 429 is retried here
31
+ * only when the server tells us how long to wait, and fails fast otherwise.
32
+ *
33
+ * Longest Retry-After we honor. A limiter is free to answer "come back in an
34
+ * hour"; a CI job cannot sit there for it, and the failure budget still bounds
35
+ * the total wait either way.
36
+ */
37
+ export const MAX_RETRY_AFTER_MS = 60000;
38
+ /**
39
+ * `Retry-After` in milliseconds, or null when it is absent or unusable.
40
+ *
41
+ * Only the delay-seconds form is honored. The HTTP-date form is deliberately
42
+ * not parsed: the composite action has to make the same decision in bash on
43
+ * whatever `date` the runner ships, and a rule the three surfaces cannot state
44
+ * identically is worse than a narrow one they can. An unparseable header is
45
+ * treated as absent — which means fail fast, the conservative direction.
46
+ */
47
+ export function retryAfterMs(e) {
48
+ const headers = e?.response?.headers;
49
+ if (!headers)
50
+ return null;
51
+ let raw;
52
+ if (typeof headers.get === "function")
53
+ raw = headers.get("retry-after");
54
+ if (raw === undefined || raw === null) {
55
+ for (const k of Object.keys(headers)) {
56
+ if (k.toLowerCase() === "retry-after") {
57
+ raw = headers[k];
58
+ break;
59
+ }
60
+ }
61
+ }
62
+ // Two Retry-Afters — an origin's and a proxy's, say — is not a delay we can
63
+ // act on, so it counts as absent like any other unusable value. Python gets
64
+ // this for free (requests joins duplicates as "5, 900", which fails the digit
65
+ // test) and bash counts the header lines; all three must answer the same.
66
+ if (Array.isArray(raw)) {
67
+ if (raw.length !== 1)
68
+ return null;
69
+ raw = raw[0];
70
+ }
71
+ if (raw === undefined || raw === null)
72
+ return null;
73
+ const text = String(raw).trim();
74
+ if (!/^\d+$/.test(text))
75
+ return null;
76
+ // A 400-digit header parses to Infinity; the clamp is what makes that safe.
77
+ return Math.min(Number(text) * 1000, MAX_RETRY_AFTER_MS);
78
+ }
26
79
  /** Longest single error detail we will echo back. Servers can be verbose. */
27
80
  const MAX_ERROR_DETAIL_CHARS = 200;
28
81
  /**
@@ -42,6 +95,12 @@ function isTransientPollError(e, scanExists) {
42
95
  }
43
96
  if (status === 404)
44
97
  return scanExists;
98
+ // 429 is transient only when the server said when to come back. See
99
+ // MAX_RETRY_AFTER_MS: without that header a 429 here is a quota rejection,
100
+ // and retrying one for half a minute before failing anyway is worse than
101
+ // failing now.
102
+ if (status === 429)
103
+ return retryAfterMs(e) !== null;
45
104
  return status >= 500 || status === 408;
46
105
  }
47
106
  function truncate(value) {
@@ -90,6 +149,19 @@ export function unreadableReportMessage(scan_id, lastError, attempts = MAX_TRANS
90
149
  `or open the scan in your dashboard at https://rafter.so/dashboard\n` +
91
150
  `Last response from the server: ${lastError}`);
92
151
  }
152
+ /**
153
+ * The give-up message when polling was throttled rather than blocked on an
154
+ * unreadable report. Telling a customer their report could not be read, when
155
+ * what actually happened is that we were rate limited, points them at the
156
+ * wrong thing — and at a `rafter get` that will be throttled too.
157
+ */
158
+ export function rateLimitedMessage(scan_id, lastError, attempts = MAX_TRANSIENT_POLL_FAILURES) {
159
+ return (`Rafter was rate limited by the API while polling scan ${scan_id} ` +
160
+ `(${attempts} attempts).\n` +
161
+ `The scan itself may still be running — retry with: rafter get ${scan_id}\n` +
162
+ `or open the scan in your dashboard at https://rafter.so/dashboard\n` +
163
+ `Last response from the server: ${lastError}`);
164
+ }
93
165
  export const BASE_BACKOFF_MS = 2000;
94
166
  /** 2s, 4s, 8s, 16s — the 5th failure gives up rather than sleeping again. */
95
167
  export function backoffMs(consecutiveFailures) {
@@ -115,12 +187,15 @@ class FailureBudget {
115
187
  this.last = "";
116
188
  /** False once any failure carried no HTTP response at all. */
117
189
  this.lastReachedServer = true;
190
+ /** True when the failure we gave up on was a throttled 429, not a bad read. */
191
+ this.lastRateLimited = false;
118
192
  }
119
- record(detail, reachedServer) {
193
+ record(detail, reachedServer, rateLimited = false) {
120
194
  this.consecutive += 1;
121
195
  this.total += 1;
122
196
  this.last = detail;
123
197
  this.lastReachedServer = reachedServer;
198
+ this.lastRateLimited = rateLimited;
124
199
  return this.consecutive;
125
200
  }
126
201
  /** A success clears the consecutive run, but never refunds the total. */
@@ -132,6 +207,21 @@ class FailureBudget {
132
207
  this.total >= MAX_TOTAL_TRANSIENT_POLL_FAILURES);
133
208
  }
134
209
  }
210
+ /**
211
+ * Retries are printed to stderr, not just into the spinner: ora renders
212
+ * nothing on a non-TTY, and CI is exactly where this diagnostic matters.
213
+ */
214
+ function makeRetryNotice(quiet) {
215
+ if (quiet)
216
+ return undefined;
217
+ return (attempt, waitMs, detail, rateLimited) => {
218
+ const what = rateLimited
219
+ ? `Rate limited by the API (${detail})`
220
+ : `Report not readable yet (${detail})`;
221
+ console.error(`${what}; retrying in ${Math.round(waitMs / 1000)}s ` +
222
+ `(${attempt}/${MAX_TRANSIENT_POLL_FAILURES})`);
223
+ };
224
+ }
135
225
  /**
136
226
  * One poll, with retry/backoff over transient failures.
137
227
  * Non-transient errors are rethrown for the caller to classify.
@@ -152,12 +242,20 @@ async function pollUntilReadable(scan_id, headers, fmt, budget, scanExists, onRe
152
242
  catch (e) {
153
243
  if (!isTransientPollError(e, scanExists))
154
244
  throw e;
155
- const attempt = budget.record(describeHttpError(e), e?.response?.status !== undefined);
245
+ // Non-null only for a 429 that carried a usable Retry-After — the sole
246
+ // reason such a 429 got past the classifier above.
247
+ const retryAfter = e?.response?.status === 429 ? retryAfterMs(e) : null;
248
+ const attempt = budget.record(describeHttpError(e), e?.response?.status !== undefined, retryAfter !== null);
156
249
  if (budget.exhausted) {
157
- throw new PollGaveUpError(unreadableReportMessage(scan_id, budget.last, budget.total, budget.lastReachedServer));
250
+ throw new PollGaveUpError(budget.lastRateLimited
251
+ ? rateLimitedMessage(scan_id, budget.last, budget.total)
252
+ : unreadableReportMessage(scan_id, budget.last, budget.total, budget.lastReachedServer));
158
253
  }
159
- const waitMs = backoffMs(attempt);
160
- onRetry?.(attempt, waitMs, budget.last);
254
+ // The server named the delay; obey it instead of our own schedule. It
255
+ // still spends a failure from the budget, so an endlessly-throttling
256
+ // API cannot keep the loop alive.
257
+ const waitMs = retryAfter ?? backoffMs(attempt);
258
+ onRetry?.(attempt, waitMs, budget.last, retryAfter !== null);
161
259
  await new Promise((r) => setTimeout(r, waitMs));
162
260
  }
163
261
  }
@@ -171,25 +269,12 @@ async function pollUntilReadable(scan_id, headers, fmt, budget, scanExists, onRe
171
269
  */
172
270
  export async function fetchScanWithRetry(scan_id, headers, fmt, quiet) {
173
271
  const budget = new FailureBudget();
174
- const onRetry = quiet
175
- ? undefined
176
- : (attempt, waitMs, detail) => {
177
- console.error(`Report not readable yet (${detail}); retrying in ${Math.round(waitMs / 1000)}s ` +
178
- `(${attempt}/${MAX_TRANSIENT_POLL_FAILURES})`);
179
- };
180
- return pollUntilReadable(scan_id, headers, fmt, budget, false, onRetry);
272
+ return pollUntilReadable(scan_id, headers, fmt, budget, false, makeRetryNotice(quiet));
181
273
  }
182
274
  const IN_PROGRESS = ["queued", "pending", "processing"];
183
275
  export async function handleScanStatus(scan_id, headers, fmt, quiet) {
184
276
  const budget = new FailureBudget();
185
- // Retries are printed to stderr, not just into the spinner: ora renders
186
- // nothing on a non-TTY, and CI is exactly where this diagnostic matters.
187
- const onRetry = quiet
188
- ? undefined
189
- : (attempt, waitMs, detail) => {
190
- console.error(`Report not readable yet (${detail}); retrying in ${Math.round(waitMs / 1000)}s ` +
191
- `(${attempt}/${MAX_TRANSIENT_POLL_FAILURES})`);
192
- };
277
+ const onRetry = makeRetryNotice(quiet);
193
278
  // First poll. A 404 here really does mean "no such scan" — do not retry it.
194
279
  // Transient 5xx IS retried, so that the `rafter get <id>` this command
195
280
  // recommends on failure is not itself defeated by one bad read.
@@ -13,6 +13,7 @@ import { shellQuote } from "../agent/exec.js";
13
13
  import { scanAddedDiffLines } from "../../scanners/git-diff-scan.js";
14
14
  import { parseUnifiedDiffAddedLines, gitDiffMaxBuffer } from "../../utils/git-diff.js";
15
15
  import { execSync } from "child_process";
16
+ import fs from "fs";
16
17
  import path from "path";
17
18
  /**
18
19
  * Load the policy-merged scan config + suppression list the same way scan.ts
@@ -211,7 +212,8 @@ const WRITE_TOOLS = new Set(["Write", "Edit", "MultiEdit", "write_file", "replac
211
212
  * Map each write tool's input onto the { file_path, content } shape that
212
213
  * evaluateWrite reads: Continue's Write names its path `filepath`; MultiEdit
213
214
  * and Windsurf's pre_write_code carry `edits[].new_string`; Codex's
214
- * apply_patch carries the whole patch in `command`.
215
+ * apply_patch carries the whole patch in `command`, with its target paths
216
+ * in the patch headers (`patch_paths`).
215
217
  */
216
218
  function normalizeWriteInput(toolName, input) {
217
219
  const out = { ...input };
@@ -225,8 +227,28 @@ function normalizeWriteInput(toolName, input) {
225
227
  out.content = input.command;
226
228
  }
227
229
  }
230
+ if (toolName === "apply_patch" && typeof input.command === "string") {
231
+ out.patch_paths = applyPatchPaths(input.command);
232
+ }
228
233
  return out;
229
234
  }
235
+ /**
236
+ * Every path an apply_patch names. The patch format carries its targets only
237
+ * in hunk headers, which Codex matches on the trimmed line:
238
+ * `*** Add File: <path>`, `*** Update File: <path>`, `*** Delete File: <path>`
239
+ * and `*** Move to: <path>` (codex-rs/apply-patch, apply_patch.lark).
240
+ */
241
+ const APPLY_PATCH_HEADERS = ["*** Add File: ", "*** Update File: ", "*** Delete File: ", "*** Move to: "];
242
+ function applyPatchPaths(patch) {
243
+ const paths = [];
244
+ for (const raw of patch.split("\n")) {
245
+ const line = raw.trim();
246
+ const header = APPLY_PATCH_HEADERS.find((h) => line.startsWith(h));
247
+ if (header)
248
+ paths.push(line.slice(header.length).trim());
249
+ }
250
+ return paths;
251
+ }
230
252
  function evaluateBash(command, control) {
231
253
  const audit = new AuditLogger();
232
254
  // Command-risk interception — gated by commandPolicy. When disabled, skip the
@@ -297,19 +319,35 @@ function writesRafterSecurityConfig(filePath) {
297
319
  const expanded = filePath.startsWith("~")
298
320
  ? path.join(os.homedir(), filePath.slice(1))
299
321
  : filePath;
300
- const target = path.resolve(expanded);
301
- const rafterDir = path.resolve(getRafterDir());
322
+ // Compare real paths, as Python's Path.resolve() does: a symlink into the
323
+ // rafter dir must not be a way around this check (sable-rxqr).
324
+ const target = realpathNearest(path.resolve(expanded));
325
+ const rafterDir = realpathNearest(path.resolve(getRafterDir()));
302
326
  return target === rafterDir || target.startsWith(rafterDir + path.sep);
303
327
  }
304
328
  catch {
305
329
  return false;
306
330
  }
307
331
  }
332
+ /** Real path of `p`, resolving symlinks in its longest existing prefix. */
333
+ function realpathNearest(p) {
334
+ let head = p;
335
+ const tail = [];
336
+ while (!fs.existsSync(head)) {
337
+ const parent = path.dirname(head);
338
+ if (parent === head)
339
+ return p;
340
+ tail.unshift(path.basename(head));
341
+ head = parent;
342
+ }
343
+ return path.join(fs.realpathSync(head), ...tail);
344
+ }
308
345
  function evaluateWrite(toolInput) {
309
346
  // rf-vnxs: checked FIRST, and before the no-content early return, because a
310
347
  // truncating write with empty content disables the hook just as well as one
311
- // carrying JSON.
312
- if (writesRafterSecurityConfig(toolInput.file_path ?? "")) {
348
+ // carrying JSON. apply_patch names its targets only in the patch headers.
349
+ const targets = [toolInput.file_path ?? "", ...(toolInput.patch_paths ?? [])];
350
+ if (targets.some(writesRafterSecurityConfig)) {
313
351
  return {
314
352
  decision: "deny",
315
353
  reason: "\u2717 Rafter blocked: write to rafter's own configuration\n" +
@@ -29,24 +29,30 @@ function severityEmoji(level) {
29
29
  return emojis[sev] || "🟡";
30
30
  }
31
31
  export function buildFromBackendVulnerability(vuln) {
32
- const sev = severityLabel(vuln.level);
33
- const emoji = severityEmoji(vuln.level);
34
- const fp = fingerprint(vuln.file, vuln.ruleId);
35
- const title = `${emoji} [${sev.toUpperCase()}] ${vuln.ruleId}: ${truncate(vuln.message, 80)}`;
32
+ const ruleId = vuln.rule_id ?? vuln.ruleId ?? "unknown-rule";
33
+ const level = vuln.severity ?? vuln.level ?? "note";
34
+ const summary = vuln.title ?? vuln.message ?? "Security finding";
35
+ const details = vuln.description ?? vuln.message ?? summary;
36
+ const file = vuln.file_path ?? vuln.file ?? "unknown file";
37
+ const line = vuln.line_start ?? vuln.line;
38
+ const sev = severityLabel(level);
39
+ const emoji = severityEmoji(level);
40
+ const fp = fingerprint(file, ruleId);
41
+ const title = `${emoji} [${sev.toUpperCase()}] ${ruleId}: ${truncate(summary, 80)}`;
36
42
  let body = `## Security Finding\n\n`;
37
- body += `**Rule:** \`${vuln.ruleId}\`\n`;
43
+ body += `**Rule:** \`${ruleId}\`\n`;
38
44
  body += `**Severity:** ${sev}\n`;
39
- body += `**File:** \`${vuln.file}\``;
40
- if (vuln.line)
41
- body += ` (line ${vuln.line})`;
45
+ body += `**File:** \`${file}\``;
46
+ if (line)
47
+ body += ` (line ${line})`;
42
48
  body += `\n\n`;
43
- body += `### Description\n\n${vuln.message}\n\n`;
44
- body += `### Remediation\n\nReview and fix the finding in \`${vuln.file}\`.\n`;
49
+ body += `### Description\n\n${details}\n\n`;
50
+ body += `### Remediation\n\nReview and fix the finding in \`${file}\`.\n`;
45
51
  body += `\n---\n*Created by [Rafter CLI](https://rafter.so) — security for AI builders*\n`;
46
52
  const labels = [
47
53
  "security",
48
54
  `severity:${sev}`,
49
- `rule:${vuln.ruleId}`,
55
+ `rule:${ruleId}`,
50
56
  ];
51
57
  return {
52
58
  title,
@@ -3,6 +3,62 @@ import { resolveKey, EXIT_GENERAL_ERROR, EXIT_SCAN_NOT_FOUND, apiClient, apiUrl
3
3
  import { validateWebhookUrl } from "../core/audit-logger.js";
4
4
  import { ConfigManager } from "../core/config-manager.js";
5
5
  import { fmt } from "../utils/formatter.js";
6
+ // Map a raw severity/level to a display tier, using the same rules as the
7
+ // GitHub Action (github-action/action.yml) and `rafter get`, so notify agrees
8
+ // with both. A value outside the known set is kept verbatim so a finding is
9
+ // never silently dropped.
10
+ function severityTier(raw) {
11
+ switch ((raw ?? "").toLowerCase()) {
12
+ case "critical":
13
+ return "critical";
14
+ case "error":
15
+ case "high":
16
+ return "high";
17
+ case "warning":
18
+ case "medium":
19
+ return "medium";
20
+ case "note":
21
+ case "low":
22
+ return "low";
23
+ default:
24
+ return (raw ?? "unknown").toLowerCase();
25
+ }
26
+ }
27
+ // Read findings from the real scan shape (`vulnerabilities[]`), falling back to
28
+ // the legacy `findings[]` for old cached payloads. Counts are derived from each
29
+ // finding's own severity — never from `summary` — so a finding cannot be lost
30
+ // to a summary field this code does not read. "Clean" is therefore reported
31
+ // only when there are genuinely zero findings.
32
+ function normalizeScan(scan) {
33
+ const raw = Array.isArray(scan.vulnerabilities)
34
+ ? scan.vulnerabilities
35
+ : Array.isArray(scan.findings)
36
+ ? scan.findings
37
+ : [];
38
+ let critical = 0;
39
+ let high = 0;
40
+ let medium = 0;
41
+ let low = 0;
42
+ const findings = raw.map((v) => {
43
+ const tier = severityTier(v.severity ?? v.level);
44
+ if (tier === "critical")
45
+ critical++;
46
+ else if (tier === "high")
47
+ high++;
48
+ else if (tier === "medium")
49
+ medium++;
50
+ else if (tier === "low")
51
+ low++;
52
+ const title = v.title ?? v.rule_id ?? v.ruleId ?? v.message ?? "Unknown";
53
+ const file = v.file_path ?? v.file;
54
+ const line = v.line_start ?? v.line;
55
+ let location = v.location ?? file ?? "";
56
+ if (!v.location && file && line != null)
57
+ location = `${file}:${line}`;
58
+ return { severity: tier, title, location };
59
+ });
60
+ return { findings, critical, high, medium, low, total: findings.length };
61
+ }
6
62
  function resolveWebhook(cliOpt) {
7
63
  if (cliOpt)
8
64
  return cliOpt;
@@ -29,17 +85,11 @@ function detectPlatform(url) {
29
85
  return "discord";
30
86
  return "generic";
31
87
  }
32
- function formatSlackPayload(scan) {
88
+ export function formatSlackPayload(scan) {
33
89
  const status = scan.status ?? "unknown";
34
90
  const repo = scan.repository_name ?? "unknown";
35
91
  const scanId = scan.scan_id ?? "";
36
- const findings = scan.findings ?? [];
37
- const summary = scan.summary ?? {};
38
- const critical = summary.critical ?? 0;
39
- const high = summary.high ?? 0;
40
- const medium = summary.medium ?? 0;
41
- const low = summary.low ?? 0;
42
- const total = critical + high + medium + low;
92
+ const { findings, critical, high, medium, low, total } = normalizeScan(scan);
43
93
  let statusIcon;
44
94
  let statusText;
45
95
  if (status === "completed" && total === 0) {
@@ -88,12 +138,9 @@ function formatSlackPayload(scan) {
88
138
  }
89
139
  if (findings.length > 0) {
90
140
  const lines = findings.slice(0, 5).map((f) => {
91
- const sev = (f.severity ?? "unknown").toUpperCase();
92
- const title = f.title ?? f.rule_id ?? "Unknown";
93
- const loc = f.location ?? f.file ?? "";
94
- let line = `• \`[${sev}]\` ${title}`;
95
- if (loc)
96
- line += ` — ${loc}`;
141
+ let line = `• \`[${f.severity.toUpperCase()}]\` ${f.title}`;
142
+ if (f.location)
143
+ line += ` — ${f.location}`;
97
144
  return line;
98
145
  });
99
146
  if (findings.length > 5)
@@ -107,17 +154,11 @@ function formatSlackPayload(scan) {
107
154
  });
108
155
  return { text: `[rafter] ${repo}: ${statusText}`, blocks };
109
156
  }
110
- function formatDiscordPayload(scan) {
157
+ export function formatDiscordPayload(scan) {
111
158
  const status = scan.status ?? "unknown";
112
159
  const repo = scan.repository_name ?? "unknown";
113
160
  const scanId = scan.scan_id ?? "";
114
- const findings = scan.findings ?? [];
115
- const summary = scan.summary ?? {};
116
- const critical = summary.critical ?? 0;
117
- const high = summary.high ?? 0;
118
- const medium = summary.medium ?? 0;
119
- const low = summary.low ?? 0;
120
- const total = critical + high + medium + low;
161
+ const { findings, critical, high, medium, low, total } = normalizeScan(scan);
121
162
  let color;
122
163
  let statusText;
123
164
  if (status === "completed" && total === 0) {
@@ -162,12 +203,9 @@ function formatDiscordPayload(scan) {
162
203
  }
163
204
  if (findings.length > 0) {
164
205
  const lines = findings.slice(0, 5).map((f) => {
165
- const sev = (f.severity ?? "unknown").toUpperCase();
166
- const title = f.title ?? f.rule_id ?? "Unknown";
167
- const loc = f.location ?? f.file ?? "";
168
- let line = `• \`[${sev}]\` ${title}`;
169
- if (loc)
170
- line += ` — ${loc}`;
206
+ let line = `• \`[${f.severity.toUpperCase()}]\` ${f.title}`;
207
+ if (f.location)
208
+ line += ` — ${f.location}`;
171
209
  return line;
172
210
  });
173
211
  if (findings.length > 5)
@@ -179,11 +217,10 @@ function formatDiscordPayload(scan) {
179
217
  embeds: [{ title: "\u{1f6e1}\ufe0f Rafter Security Scan", color, fields, footer: { text: "rafter-bot | rafter.so" } }],
180
218
  };
181
219
  }
182
- function formatGenericPayload(scan) {
220
+ export function formatGenericPayload(scan) {
183
221
  const status = scan.status ?? "unknown";
184
222
  const repo = scan.repository_name ?? "unknown";
185
- const summary = scan.summary ?? {};
186
- const total = (summary.critical ?? 0) + (summary.high ?? 0) + (summary.medium ?? 0) + (summary.low ?? 0);
223
+ const { total } = normalizeScan(scan);
187
224
  let statusText;
188
225
  if (status === "completed" && total === 0)
189
226
  statusText = "Clean — no issues found";
@@ -40,7 +40,7 @@ function generateClaudeConfig() {
40
40
  hooks: [{ type: "command", command: "rafter hook pretool" }],
41
41
  },
42
42
  {
43
- matcher: "Write|Edit",
43
+ matcher: "Write|Edit|MultiEdit",
44
44
  hooks: [{ type: "command", command: "rafter hook pretool" }],
45
45
  },
46
46
  ],
@@ -41,8 +41,9 @@ const CRITICAL_DIRS = "home|etc|usr|boot|root|sys|proc|lib|lib64|bin|sbin|opt";
41
41
  * whose stdin the sanitizer redacts (the broadest gap);
42
42
  * - a payload split across shell variables (`a=/dev/tc;b=p/…`) or hidden in an
43
43
  * unreadable `$(…)`/base64 blob;
44
- * - the quoted-operand forms of `php -r`, `socat exec:'/bin/sh'` (the program
45
- * half quoted), `gawk /inet/`, `telnet`, and the non-standard `rcat`.
44
+ * - the quoted-operand forms of `php -r`, `gawk /inet/`, `telnet`, and the
45
+ * non-standard `rcat`. (socat's quoted `EXEC:`/`SYSTEM:` program is read:
46
+ * socat is code-carrying, sable-gmgh.)
46
47
  * `… | sh` and base64-into-shell still degrade to high via shellProgramFromStream.
47
48
  */
48
49
  const REVERSE_SHELL_PATTERN_SOURCES = [
@@ -102,6 +103,19 @@ const CRITICAL_PATTERN_SOURCES = [
102
103
  ];
103
104
  export const CRITICAL_PATTERNS = CRITICAL_PATTERN_SOURCES.map((s) => new RegExp(s));
104
105
  export const HIGH_PATTERNS = [
106
+ // sable-lbyp: a pseudo-terminal wrapper around rafter's own approval prompt.
107
+ // `rafter agent exec` grants approval only to a person at a TTY; `script`,
108
+ // `expect`, `unbuffer`, `socat` and Python's pty module manufacture one and
109
+ // can type "yes". Wrapping rafter in any of them is itself the signal.
110
+ /\b(?:script|expect|unbuffer|socat)\b.*\brafter(?:-cli)?\s+agent\s+exec\b/,
111
+ // Scoped to `agent exec` exactly as the sibling above is. Without the
112
+ // subcommand this matched ANY rafter invocation wrapped in Python's pty
113
+ // module -- `rafter --version`, `rafter audit`, `rafter secrets scan` all
114
+ // went low -> high. That contradicts this patch's own principle that only
115
+ // `agent exec` carries a command, and in headless CI a HIGH with stdin not
116
+ // a TTY is DENIED outright (exit 1), turning a previously-succeeding call
117
+ // into a hard failure.
118
+ /\bpty\.(?:spawn|fork|openpty)\b.*\brafter(?:-cli)?['",\s]+agent['",\s]+exec\b/,
105
119
  /rm\s+(-[a-z]*r[a-z]*\s+)*-[a-z]*f[a-z]*/, // rm -rf, -fr, -r -f, -f -r (any path)
106
120
  /rm\s+(-[a-z]*f[a-z]*\s+)*-[a-z]*r[a-z]*/, // rm -fr, reversed
107
121
  /sudo\s+rm/,
@@ -194,6 +208,7 @@ const EVAL_FLAGS = new Set(["-c", "-e", "--command", "--execute", "--eval", "-ex
194
208
  const TAIL_WRAPPERS = new Set([
195
209
  "sudo", "doas", "env", "nohup", "timeout", "nice", "ionice",
196
210
  "time", "watch", "setsid", "stdbuf", "chrt", "command",
211
+ "unbuffer", // expect's pty wrapper: delegates to the command that follows (sable-lbyp)
197
212
  ]);
198
213
  /** Commands whose operands are pure text data — searching or printing, never executing. */
199
214
  const TEXT_EXECS = new Set(["echo", "printf", "grep", "egrep", "fgrep", "rg", "ag", "ack"]);
@@ -538,7 +553,12 @@ function processSegment(pieces, depth, out, pipedIntoShell = false, outputExecut
538
553
  if (!p.quoted && EVAL_FLAGS.has(p.text.toLowerCase()))
539
554
  hasEvalFlag = true;
540
555
  }
541
- const codeCarrying = hasShellExec || hasEvalFlag || EVAL_EXECS.has(exec);
556
+ // sable-lbyp: rafter's own `agent exec` runs its operand, so the hook must
557
+ // see through its own binary the way it sees through `bash -c`.
558
+ // sable-gmgh: socat's EXEC:/SYSTEM: addresses run a program, so a quoted one
559
+ // (`EXEC:"bash -li",pty`) is a command, not prose.
560
+ const codeCarrying = hasShellExec || hasEvalFlag || EVAL_EXECS.has(exec) || exec === "socat" ||
561
+ rafterExecRunsOperand(pieces, execIdx);
542
562
  // sable-c6an. Two questions the code conflated, and conflating them gets one
543
563
  // of them wrong:
544
564
  // codeCarrying — this segment RUNS a command string it was handed
@@ -912,6 +932,60 @@ const PACKAGE_RUNNERS = new Set(["npx", "bunx", "pnpx", "dlx", "pnpm", "yarn", "
912
932
  const RAFTER_PACKAGE = /^(?:@rafter-security\/cli|rafter-cli|rafter)(?:@[\w.^~*-]+)?$/;
913
933
  /** Config keys that gate the hook. Namespace, not a leaf — see hook-control. */
914
934
  const PROTECTED_CONFIG_KEY = /^(?:agent\.)?(?:hooks|commandpolicy)\b|^agent\.risklevel$/;
935
+ /**
936
+ * sable-lbyp (from rf-ss67) — `rafter agent exec <operand>` RUNS its operand,
937
+ * so a segment whose exec is rafter's own binary is code-carrying: the quoted
938
+ * operand is a command string, not prose, and must reach the patterns.
939
+ *
940
+ * Before this, `rafter agent exec --force "rm -rf /tmp/x"` was the one shape
941
+ * the hook could not see: an unrecognised evaluator with a quoted multi-word
942
+ * argument is data by the sanitizer's rule, so the hook said `low` while exec
943
+ * ran a HIGH-tier command. rf-ss67 closed the bypass at the other end (exec no
944
+ * longer skips approval and only a person at a TTY can grant it); this makes
945
+ * the hook itself classify the operand, so the audit trail and the block land
946
+ * where the agent's tool call is, not two processes later.
947
+ *
948
+ * Resolution is the same as the rf-vnxs disarm check: the segment's resolved
949
+ * exec (wrappers such as `sudo -E`, `env`, `unbuffer` already skipped by the
950
+ * caller), an absolute path (`execName` keeps the basename, so
951
+ * `/usr/local/bin/rafter` is `rafter`), or a package runner
952
+ * (`npx @rafter-security/cli`, `pnpm dlx rafter-cli`, `bunx rafter`).
953
+ *
954
+ * `--dry-run` is the one exemption: exec then prints the classification and
955
+ * runs nothing, and that flow is what the shipped docs tell agents to use to
956
+ * check a command BEFORE running it. Treating its operand as executed would
957
+ * block the very check. A flag an old CLI does not know makes it error out,
958
+ * never execute, so the exemption cannot be abused by version skew.
959
+ */
960
+ function rafterExecRunsOperand(pieces, execIdx) {
961
+ if (execIdx === -1)
962
+ return false;
963
+ let k = execIdx;
964
+ let exec = execName(pieces[k].text);
965
+ if (pieces[k].quoted)
966
+ return false;
967
+ k++;
968
+ if (PACKAGE_RUNNERS.has(exec)) {
969
+ while (k < pieces.length && !pieces[k].op && (pieces[k].text.startsWith("-") || ["dlx", "exec"].includes(pieces[k].text.toLowerCase())))
970
+ k++;
971
+ if (k >= pieces.length || pieces[k].op || !RAFTER_PACKAGE.test(pieces[k].text.toLowerCase()))
972
+ return false;
973
+ k++;
974
+ exec = "rafter";
975
+ }
976
+ if (!RAFTER_EXECS.has(exec))
977
+ return false;
978
+ const rest = pieces.slice(k).filter((p) => !p.op);
979
+ const args = rest.filter((p) => !p.text.startsWith("-")).map((p) => p.text.toLowerCase());
980
+ if (args[0] !== "agent" || args[1] !== "exec")
981
+ return false;
982
+ // Only a --dry-run before an unquoted `--` is the flag: after it, exec
983
+ // takes every token as part of the command and runs it.
984
+ const end = rest.findIndex((p) => !p.quoted && p.text === "--");
985
+ const flags = end === -1 ? rest : rest.slice(0, end);
986
+ const dryRun = flags.some((p) => !p.quoted && p.text.toLowerCase() === "--dry-run");
987
+ return !dryRun;
988
+ }
915
989
  /**
916
990
  * True if this statement's argv reconfigures or removes a rafter security
917
991
  * control.
@@ -969,9 +1043,226 @@ function statementDisarmsRafter(words) {
969
1043
  export function modifiesRafterSecurityConfig(command) {
970
1044
  if (disarmsRafter(command, 0))
971
1045
  return true;
1046
+ if (writesRafterDir(command))
1047
+ return true;
972
1048
  const sanitized = sanitizeCommandForMatching(command);
973
1049
  return sanitized !== command && disarmsRafter(sanitized, 0);
974
1050
  }
1051
+ /**
1052
+ * sable-36oe: the SHELL route to rafter's own directory (`~/.rafter`), which
1053
+ * the Write/Edit route already refuses (rf-vnxs, `writesRafterSecurityConfig`
1054
+ * in hook/pretool). `rm ~/.rafter/config.json` disarms the gate exactly as
1055
+ * `rafter agent config set agent.hooks.enabled false` does.
1056
+ *
1057
+ * Deny-by-default scoped to the path, NOT a blocklist of write verbs: the
1058
+ * verbs are unbounded (`>`, sed -i, cp, tee, dd, install, rsync, perl -i,
1059
+ * python -c …). A command is protected when a statement that NAMES the
1060
+ * rafter dir is not a known read-only command without an output redirect.
1061
+ * Statements that do not name it are not constrained, so
1062
+ * `cat ~/.rafter/x && npm test` stays allowed; a cd INTO the dir is itself
1063
+ * not read-only, which keeps `cd ~/.rafter && echo x > config.json` blocked.
1064
+ *
1065
+ * Checked on the raw text (a reference inside quotes counts — python -c
1066
+ * code, heredoc bodies) and on the normalized view, which expands brace
1067
+ * lists and ANSI-C quotes (`~/.{rafter,x}`, `$'\x2erafter'`).
1068
+ */
1069
+ function writesRafterDir(command) {
1070
+ if (rafterDirScan(command))
1071
+ return true;
1072
+ const normalized = normalizeForMatching(command);
1073
+ return normalized !== command && rafterDirScan(normalized);
1074
+ }
1075
+ const RAFTER_DIR_NAME = ".rafter";
1076
+ /** Characters that continue a file name: `.rafter.yml` and `.rafterignore` are not `.rafter`. */
1077
+ function isNameChar(c) {
1078
+ return /[a-z0-9_.-]/i.test(c);
1079
+ }
1080
+ /**
1081
+ * True if `text` names the rafter dir: `.rafter` as a whole path component
1082
+ * (so `~/.rafter`, `$HOME/.rafter`, `${HOME}/.rafter`, `/home/u/.rafter`,
1083
+ * `./.rafter/x`, `'.rafter'` inside code), case-insensitively because macOS
1084
+ * file systems are. An unquoted glob component that could expand to it
1085
+ * (`~/.raf*`, `.r?fter`, `.*`) counts too. Linear: one indexOf walk plus one
1086
+ * pass over components.
1087
+ */
1088
+ function namesRafterDir(text, globs) {
1089
+ const t = text.toLowerCase();
1090
+ for (let i = t.indexOf(RAFTER_DIR_NAME); i !== -1; i = t.indexOf(RAFTER_DIR_NAME, i + 1)) {
1091
+ const before = i === 0 ? "" : t[i - 1];
1092
+ const after = t[i + RAFTER_DIR_NAME.length] ?? "";
1093
+ if ((before === "" || !isNameChar(before)) && (after === "" || !isNameChar(after)))
1094
+ return true;
1095
+ }
1096
+ if (!globs)
1097
+ return false;
1098
+ // Bash never lets a wildcard match a leading dot, so only a component that
1099
+ // starts with a literal "." can glob to ".rafter". Over-approximate the
1100
+ // match: the literal characters outside brackets must appear in order in
1101
+ // "rafter"; `*`, `?` and a whole `[...]` are free.
1102
+ for (const comp of t.split("/")) {
1103
+ if (comp[0] !== "." || !/[*?[]/.test(comp))
1104
+ continue;
1105
+ const want = "rafter";
1106
+ let k = 0;
1107
+ let inBracket = false;
1108
+ let ok = true;
1109
+ for (let j = 1; j < comp.length; j++) {
1110
+ const c = comp[j];
1111
+ if (inBracket) {
1112
+ if (c === "]")
1113
+ inBracket = false;
1114
+ continue;
1115
+ }
1116
+ if (c === "[") {
1117
+ inBracket = true;
1118
+ continue;
1119
+ }
1120
+ if (c === "*" || c === "?")
1121
+ continue;
1122
+ while (k < want.length && want[k] !== c)
1123
+ k++;
1124
+ if (k === want.length) {
1125
+ ok = false;
1126
+ break;
1127
+ }
1128
+ k++;
1129
+ }
1130
+ if (ok)
1131
+ return true;
1132
+ }
1133
+ return false;
1134
+ }
1135
+ /**
1136
+ * Read-only commands: they can neither write a file nor run another program
1137
+ * when given no output redirect. Deliberately narrow. NOT here: sed (its `w`
1138
+ * and `e` commands write and execute without -i), less (`-o` writes a log),
1139
+ * tee/cp/mv/rm/ln/chmod/touch/truncate/dd, and anything that runs a program.
1140
+ */
1141
+ const READ_ONLY_EXECS = new Set([
1142
+ "cat", "more", "head", "tail", "ls", "stat", "file", "wc",
1143
+ "grep", "egrep", "fgrep", "rg", "jq", "diff", "cmp",
1144
+ "md5sum", "sha1sum", "sha224sum", "sha256sum", "sha384sum", "sha512sum",
1145
+ "shasum", "b2sum", "cksum",
1146
+ "find", "test", "[", "realpath", "readlink", "du",
1147
+ "cd", "pushd", "popd",
1148
+ ]);
1149
+ /** find actions that delete, run a program, or write a file. */
1150
+ const FIND_WRITE_ACTIONS = new Set([
1151
+ "-delete", "-exec", "-execdir", "-ok", "-okdir", "-fprint", "-fprint0", "-fprintf", "-fls",
1152
+ ]);
1153
+ /** Only a bare name or a system bin dir: `./cat` is whatever the agent wrote there. */
1154
+ const SYSTEM_BIN = /^(?:\/usr(?:\/local)?|\/opt\/homebrew)?\/s?bin\/[^/]+$/;
1155
+ const WRITE_REDIRECTS = new Set([">", ">>"]);
1156
+ /** True if some statement names the rafter dir and is not read-only. */
1157
+ function rafterDirScan(command) {
1158
+ const acc = { protected: false };
1159
+ scanRafterDirStatements(command, 0, acc);
1160
+ return acc.protected;
1161
+ }
1162
+ function scanRafterDirStatements(command, depth, acc) {
1163
+ // Past the recursion cap, or on a desynchronized parse, the structure is
1164
+ // unknown: FAIL CLOSED — a reference anywhere in the text protects it.
1165
+ if (depth > MAX_SANITIZE_DEPTH) {
1166
+ if (namesRafterDir(command, false))
1167
+ acc.protected = true;
1168
+ return;
1169
+ }
1170
+ const { pieces, unterminated } = tokenize(command);
1171
+ if (unterminated && namesRafterDir(command, false))
1172
+ acc.protected = true;
1173
+ let stmt = [];
1174
+ const flush = () => { scanRafterDirStatement(stmt, acc); stmt = []; };
1175
+ for (let i = 0; i < pieces.length; i++) {
1176
+ const p = pieces[i];
1177
+ for (const sub of p.substs)
1178
+ scanRafterDirStatements(sub, depth + 1, acc);
1179
+ if (p.op !== null && CHAIN_OPS.has(p.op)) {
1180
+ // `>|`, `>&`, `&>`, `&>>` are redirects spelled with a chain character;
1181
+ // splitting on them would orphan the target from its `>`.
1182
+ const prev = pieces[i - 1];
1183
+ const next = pieces[i + 1];
1184
+ const afterRedirect = p.op !== "&&" && p.op !== "||" && !!prev && prev.end === p.start && WRITE_REDIRECTS.has(prev.op ?? "");
1185
+ const beforeRedirect = p.op === "&" && !!next && next.start === p.end && WRITE_REDIRECTS.has(next.op ?? "");
1186
+ if (!afterRedirect && !beforeRedirect) {
1187
+ flush();
1188
+ continue;
1189
+ }
1190
+ }
1191
+ stmt.push(p);
1192
+ }
1193
+ flush();
1194
+ }
1195
+ function scanRafterDirStatement(stmt, acc) {
1196
+ let argv0 = -1;
1197
+ let redirect = false;
1198
+ let names = false;
1199
+ for (let i = 0; i < stmt.length; i++) {
1200
+ const p = stmt[i];
1201
+ if (p.op !== null) {
1202
+ if (WRITE_REDIRECTS.has(p.op) && !discardsOutput(stmt, i))
1203
+ redirect = true;
1204
+ continue;
1205
+ }
1206
+ const prevOp = i > 0 ? stmt[i - 1].op : null;
1207
+ const isRedirectTarget = prevOp !== null && REDIRECT_OPS.has(prevOp);
1208
+ // Executing a binary that lives in the dir (`~/.rafter/bin/betterleaks
1209
+ // version`) is not a reference; its arguments still are. Only an UNQUOTED
1210
+ // argv0 is a path the shell runs: a quoted one is a heredoc body line or
1211
+ // other code (`open('/home/u/.rafter/config.json','w')`), never a binary.
1212
+ if (argv0 === -1 && !isRedirectTarget) {
1213
+ argv0 = i;
1214
+ if (!p.quoted && !ENV_ASSIGNMENT.test(p.text))
1215
+ continue;
1216
+ }
1217
+ if (namesRafterDir(p.text, !p.quoted))
1218
+ names = true;
1219
+ }
1220
+ if (names && (redirect || !statementReadOnly(stmt, argv0)))
1221
+ acc.protected = true;
1222
+ }
1223
+ /** `2>/dev/null`, `2>&1`, `>&-`: an output redirect that writes no file. */
1224
+ function discardsOutput(stmt, i) {
1225
+ let j = i + 1;
1226
+ let dup = false;
1227
+ if (stmt[j]?.op === "&" && stmt[j].start === stmt[i].end) {
1228
+ dup = true;
1229
+ j++;
1230
+ }
1231
+ const target = stmt[j];
1232
+ if (!target || target.op !== null || target.substs.length > 0)
1233
+ return false;
1234
+ return dup ? /^(?:\d+|-)$/.test(target.text) : target.text === "/dev/null";
1235
+ }
1236
+ function statementReadOnly(stmt, argv0) {
1237
+ if (argv0 === -1)
1238
+ return true; // empty, or only an input redirect
1239
+ const head = stmt[argv0];
1240
+ if (!head.quoted && ENV_ASSIGNMENT.test(head.text))
1241
+ return false;
1242
+ if (head.text.includes("/") && !SYSTEM_BIN.test(head.text))
1243
+ return false;
1244
+ const exec = head.text.slice(head.text.lastIndexOf("/") + 1);
1245
+ if (!READ_ONLY_EXECS.has(exec))
1246
+ return false;
1247
+ const args = stmt.slice(argv0 + 1).filter((p) => p.op === null);
1248
+ switch (exec) {
1249
+ case "find":
1250
+ return !args.some((a) => FIND_WRITE_ACTIONS.has(a.text));
1251
+ case "rg": // --pre runs a program on every file searched
1252
+ return !args.some((a) => a.text.startsWith("--pre"));
1253
+ case "file": // -C compiles a magic file, writing it
1254
+ return !args.some((a) => a.text === "--compile" || /^-[A-Za-z]*C/.test(a.text));
1255
+ case "cd":
1256
+ case "pushd":
1257
+ case "popd":
1258
+ // Claude Code's Bash tool keeps its cwd between calls, so a cd INTO the
1259
+ // dir would make the next call's bare `config.json` a write there with
1260
+ // no reference left to catch. cd elsewhere stays read-only.
1261
+ return !args.some((a) => a.substs.length > 0 || namesRafterDir(a.text, !a.quoted));
1262
+ default:
1263
+ return true;
1264
+ }
1265
+ }
975
1266
  /** True if any statement (or any command substitution) disarms rafter. */
976
1267
  function disarmsRafter(command, depth = 0) {
977
1268
  if (depth > MAX_SANITIZE_DEPTH)
package/dist/utils/api.js CHANGED
@@ -106,7 +106,11 @@ export function handle403(e) {
106
106
  if (typeof body === "object" && body?.scan_mode) {
107
107
  const mode = body.scan_mode;
108
108
  const limit = body.limit ?? "?";
109
- const used = body.used ?? limit;
109
+ // The API sends `remaining`, not `used`; `used` is kept for older servers.
110
+ const used = body.used ??
111
+ (typeof body.limit === "number" && typeof body.remaining === "number"
112
+ ? body.limit - body.remaining
113
+ : limit);
110
114
  console.error(`Error: ${mode.charAt(0).toUpperCase() + mode.slice(1)} scan limit reached (${used}/${limit} used this billing period).\nUpgrade your plan or wait for your quota to reset.`);
111
115
  return EXIT_QUOTA_EXHAUSTED;
112
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rafter-security/cli",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rafter-security
3
3
  description: Security toolkit for AI workflows. Use when scanning code or repos for vulnerabilities, auditing third-party skills/MCPs/agent configs before installing, evaluating shell commands before running them, or generating secure design questions for new features. Provides `rafter run` (remote SAST + SCA, needs RAFTER_API_KEY), `rafter secrets` (offline secrets-only), `rafter agent exec --dry-run` (command-risk classification), and `rafter skill review`.
4
- version: 0.11.3
4
+ version: 0.11.5
5
5
  homepage: https://rafter.so
6
6
  metadata:
7
7
  openclaw: