@rafter-security/cli 0.10.5 → 0.11.1
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/dist/commands/agent/exec.js +26 -9
- package/dist/commands/agent/init.js +286 -225
- package/dist/commands/agent/install-hook.js +19 -8
- package/dist/commands/agent/scan.js +270 -70
- package/dist/commands/agent/status.js +2 -2
- package/dist/commands/agent/update-skill-scanner.js +1 -1
- package/dist/commands/agent/verify.js +39 -15
- package/dist/commands/backend/get.js +6 -2
- package/dist/commands/backend/run.js +25 -2
- package/dist/commands/backend/scan-status.js +34 -4
- package/dist/commands/hook/pretool.js +124 -36
- package/dist/commands/mcp/server.js +184 -129
- package/dist/commands/report.js +6 -2
- package/dist/core/audit-logger.js +47 -17
- package/dist/core/config-manager.js +46 -8
- package/dist/core/custom-patterns.js +28 -8
- package/dist/core/docs-loader.js +33 -3
- package/dist/core/pattern-engine.js +23 -5
- package/dist/core/policy-loader.js +15 -4
- package/dist/core/risk-rules.js +391 -9
- package/dist/index.js +7 -1
- package/dist/scanners/betterleaks.js +127 -14
- package/dist/scanners/git-history-scan.js +75 -0
- package/dist/scanners/regex-scanner.js +16 -2
- package/dist/scanners/secret-patterns.js +5 -1
- package/dist/scanners/union.js +31 -19
- package/dist/utils/api.js +35 -1
- package/dist/utils/env-guard.js +14 -14
- package/dist/utils/git-diff.js +36 -20
- package/dist/utils/git.js +164 -52
- package/dist/utils/skill-manager.js +4 -3
- package/package.json +16 -15
- package/resources/continue-rules/rafter.md +1 -1
- package/resources/cursor-rules/rafter.mdc +1 -1
- package/resources/rafter-security-skill.md +3 -1
- package/resources/skills/rafter/SKILL.md +1 -2
- package/resources/skills/rafter/docs/guardrails.md +1 -1
- package/resources/skills/rafter-code-review/SKILL.md +0 -1
- package/resources/skills/rafter-secure-design/SKILL.md +0 -1
- package/resources/skills/rafter-skill-review/SKILL.md +0 -1
- package/resources/windsurf-rules/rafter.md +1 -1
package/dist/utils/git.js
CHANGED
|
@@ -1,30 +1,113 @@
|
|
|
1
|
-
import { execSync } from "child_process";
|
|
1
|
+
import { execFileSync, execSync } from "child_process";
|
|
2
2
|
export function git(cmd) {
|
|
3
3
|
return execSync(`git ${cmd}`, { stdio: ["ignore", "pipe", "ignore"] })
|
|
4
4
|
.toString()
|
|
5
5
|
.trim();
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Look up `branch` on the `origin` remote.
|
|
9
|
+
*
|
|
10
|
+
* Returns the remote commit SHA, `null` when the remote answered and has no
|
|
11
|
+
* such branch, or `undefined` when it could not be asked (offline, auth
|
|
12
|
+
* failure, timeout). Callers treat `undefined` as unknown and carry on.
|
|
13
|
+
*/
|
|
14
|
+
export function remoteBranchSha(branch, cwd) {
|
|
15
|
+
try {
|
|
16
|
+
const out = execFileSync("git", ["ls-remote", "--exit-code", "--heads", "origin", `refs/heads/${branch}`], {
|
|
17
|
+
cwd,
|
|
18
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
19
|
+
timeout: 15000,
|
|
20
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
21
|
+
}).toString();
|
|
22
|
+
return out.split(/\s+/)[0] || undefined;
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
// --exit-code: status 2 means the remote has no matching ref.
|
|
26
|
+
return e?.status === 2 ? null : undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Return the current branch name.
|
|
31
|
+
*
|
|
32
|
+
* Throws on a detached HEAD (or when there is no HEAD at all, e.g. an
|
|
33
|
+
* empty repo) instead of falling back to a commit SHA or a hardcoded
|
|
34
|
+
* default branch. Neither is a real branch: a SHA is guaranteed to 404 as
|
|
35
|
+
* a "branch" on the backend, and a hardcoded default is a guess that is
|
|
36
|
+
* often wrong and, even when right, doesn't reflect what is actually
|
|
37
|
+
* checked out.
|
|
38
|
+
*/
|
|
7
39
|
export function safeBranch(gitFn) {
|
|
8
40
|
try {
|
|
9
41
|
return gitFn("symbolic-ref --quiet --short HEAD");
|
|
10
42
|
}
|
|
11
43
|
catch {
|
|
12
|
-
|
|
44
|
+
throw new Error("Could not determine the current branch (detached HEAD or no commits yet). " +
|
|
45
|
+
"Please pass --branch explicitly.");
|
|
13
46
|
}
|
|
14
47
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
48
|
+
const SCHEME_RE = /^(https?|ssh):\/\//i;
|
|
49
|
+
/**
|
|
50
|
+
* Split a git remote URL into its host + owner/repo slug, handling
|
|
51
|
+
* `https://[user[:token]@]host[:port]/owner/repo(.git)` (and http, ssh),
|
|
52
|
+
* and the scp-like `[user@]host:owner/repo(.git)`. Returns null when the
|
|
53
|
+
* URL can't be parsed into host + slug.
|
|
54
|
+
*
|
|
55
|
+
* Uses the URL parser (not a blanket ":" -> "/" substitution) so a colon
|
|
56
|
+
* inside userinfo — `https://user:token@host/...`, a real shape for
|
|
57
|
+
* CI-embedded credentials — is never mistaken for the scp host:path
|
|
58
|
+
* separator. Getting this wrong is a security bug, not just a parsing
|
|
59
|
+
* one: the naive substitution let `https://github.com:x@evil.com/a/b`
|
|
60
|
+
* read as host `github.com` (an allowed host) with the real host,
|
|
61
|
+
* evil.com, silently discarded.
|
|
62
|
+
*/
|
|
63
|
+
function splitRemote(url) {
|
|
64
|
+
let rest;
|
|
65
|
+
if (SCHEME_RE.test(url)) {
|
|
66
|
+
let parsed;
|
|
67
|
+
try {
|
|
68
|
+
parsed = new URL(url);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
if (!parsed.hostname)
|
|
74
|
+
return null;
|
|
75
|
+
rest = `${parsed.hostname}${parsed.pathname}`;
|
|
76
|
+
}
|
|
77
|
+
else if (url.includes(":")) {
|
|
78
|
+
// scp-like: "[user@]host:owner/repo(.git)". The user (if any) is
|
|
79
|
+
// whatever precedes the LAST "@" before this colon.
|
|
80
|
+
const colonIdx = url.indexOf(":");
|
|
81
|
+
const head = url.slice(0, colonIdx);
|
|
82
|
+
const path = url.slice(colonIdx + 1);
|
|
83
|
+
const atIdx = head.lastIndexOf("@");
|
|
84
|
+
const host = atIdx === -1 ? head : head.slice(atIdx + 1);
|
|
85
|
+
if (!host || host.includes("/"))
|
|
86
|
+
return null;
|
|
87
|
+
rest = `${host}/${path}`;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// No scheme, no ":" -- e.g. a bare filesystem path. Treated opaquely:
|
|
91
|
+
// the leading segment stands in for "host" below, so it is rejected
|
|
92
|
+
// unless it happens to equal a real host (it never will for a real
|
|
93
|
+
// filesystem path).
|
|
94
|
+
rest = url;
|
|
95
|
+
}
|
|
96
|
+
if (rest.endsWith(".git"))
|
|
97
|
+
rest = rest.slice(0, -4);
|
|
98
|
+
const parts = rest.split("/").filter((p) => p.length > 0);
|
|
99
|
+
if (parts.length < 3)
|
|
100
|
+
return null; // need host + owner + repo
|
|
101
|
+
const host = parts[0];
|
|
102
|
+
const slug = parts.slice(-2).join("/");
|
|
103
|
+
return { host, slug };
|
|
21
104
|
}
|
|
22
105
|
/**
|
|
23
|
-
* Map a git remote host to a provider
|
|
24
|
-
*
|
|
25
|
-
*
|
|
106
|
+
* Map a git remote host to a provider we actually recognize. Unlike
|
|
107
|
+
* providerForHost, returns null for a host we don't recognize instead of
|
|
108
|
+
* defaulting to "github" — used where guessing is not safe.
|
|
26
109
|
*/
|
|
27
|
-
|
|
110
|
+
function knownProviderForHost(host) {
|
|
28
111
|
host = host.toLowerCase();
|
|
29
112
|
if (host === "github.com")
|
|
30
113
|
return "github";
|
|
@@ -34,23 +117,41 @@ export function providerForHost(host) {
|
|
|
34
117
|
return "bitbucket";
|
|
35
118
|
if (host === "codeberg.org" || host.endsWith(".gitea.io"))
|
|
36
119
|
return "gitea";
|
|
37
|
-
return
|
|
120
|
+
return null;
|
|
38
121
|
}
|
|
39
122
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
123
|
+
* Parse a git remote URL into "owner/repo" format.
|
|
124
|
+
*
|
|
125
|
+
* Throws when the remote's host isn't one we recognize. Blindly slicing
|
|
126
|
+
* the last two path segments of an arbitrary URL (the old behavior)
|
|
127
|
+
* manufactures a wrong slug for anything that isn't GitHub/GitLab/
|
|
128
|
+
* Bitbucket/Gitea shaped — e.g. an Azure DevOps remote
|
|
129
|
+
* (`.../org/proj/_git/repo`) becomes `_git/repo`, and a bare filesystem
|
|
130
|
+
* remote becomes `<parent-dir>/<repo>`. The backend turns that slug into
|
|
131
|
+
* an invalid clone URL and 404s, burning a paid scan.
|
|
43
132
|
*/
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
133
|
+
export function parseRemote(url) {
|
|
134
|
+
const parts = splitRemote(url);
|
|
135
|
+
if (!parts) {
|
|
136
|
+
throw new Error(`Could not determine owner/repo from git remote "${url}". ` +
|
|
137
|
+
"Please pass --repo and --branch explicitly.");
|
|
138
|
+
}
|
|
139
|
+
if (!knownProviderForHost(parts.host)) {
|
|
140
|
+
throw new Error(`Unsupported git remote host "${parts.host}" (from "${url}"). ` +
|
|
141
|
+
"Only GitHub, GitLab, Bitbucket, and Gitea remotes are auto-detected. " +
|
|
142
|
+
"Please pass --repo and --branch explicitly.");
|
|
143
|
+
}
|
|
144
|
+
return parts.slug; // owner/repo
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Map a git remote host to a provider. `github` is the backward-compatible
|
|
148
|
+
* default for any host we don't recognize — a GitHub user's request is
|
|
149
|
+
* unaffected, and unknown self-hosted hosts fall back to the legacy behavior.
|
|
150
|
+
* (Only used for the additive provider/repoUrl fields; parseRemote uses the
|
|
151
|
+
* stricter knownProviderForHost and rejects what this would silently default.)
|
|
152
|
+
*/
|
|
153
|
+
export function providerForHost(host) {
|
|
154
|
+
return knownProviderForHost(host) ?? "github";
|
|
54
155
|
}
|
|
55
156
|
/**
|
|
56
157
|
* Infer the provider and a canonical `https://<host>/<owner>/<repo>` clone URL
|
|
@@ -66,6 +167,7 @@ export function inferRemote(url) {
|
|
|
66
167
|
repoUrl: `https://${parts.host}/${parts.slug}`,
|
|
67
168
|
};
|
|
68
169
|
}
|
|
170
|
+
const AUTO_DETECT_FAILURE = "Could not auto-detect Git repository. Please pass --repo and --branch explicitly.";
|
|
69
171
|
export function detectRepo(opts) {
|
|
70
172
|
// Both explicit — return them as-is. No provider/repo_url is inferred here;
|
|
71
173
|
// the caller's --provider/--repo-url flags fill that in when needed.
|
|
@@ -77,35 +179,45 @@ export function detectRepo(opts) {
|
|
|
77
179
|
let branch = opts.branch || branchEnv;
|
|
78
180
|
let provider;
|
|
79
181
|
let repoUrl;
|
|
182
|
+
if (repoSlug && branch) {
|
|
183
|
+
return { repo: repoSlug, branch, provider, repo_url: repoUrl };
|
|
184
|
+
}
|
|
185
|
+
let insideRepo;
|
|
80
186
|
try {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
}
|
|
187
|
+
insideRepo = git("rev-parse --is-inside-work-tree") === "true";
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
insideRepo = false;
|
|
191
|
+
}
|
|
192
|
+
if (!insideRepo) {
|
|
193
|
+
throw new Error(AUTO_DETECT_FAILURE);
|
|
194
|
+
}
|
|
195
|
+
// Read the remote once when we need to detect the slug, and reuse it to
|
|
196
|
+
// infer the provider + canonical clone URL. When repo/branch come from
|
|
197
|
+
// env (CI), we never touch git here — behavior is byte-identical.
|
|
198
|
+
// A rejection from parseRemote (unrecognized host) is deliberately NOT
|
|
199
|
+
// swallowed into the generic message below — it names the offending
|
|
200
|
+
// remote, which is the actionable part.
|
|
201
|
+
const repoFromOrigin = !repoSlug;
|
|
202
|
+
if (!repoSlug) {
|
|
203
|
+
let remoteUrl;
|
|
204
|
+
try {
|
|
205
|
+
remoteUrl = git("remote get-url origin");
|
|
102
206
|
}
|
|
103
|
-
|
|
104
|
-
|
|
207
|
+
catch {
|
|
208
|
+
throw new Error(AUTO_DETECT_FAILURE);
|
|
105
209
|
}
|
|
106
|
-
|
|
210
|
+
repoSlug = parseRemote(remoteUrl);
|
|
211
|
+
const inferred = inferRemote(remoteUrl);
|
|
212
|
+
provider = inferred.provider;
|
|
213
|
+
repoUrl = inferred.repoUrl;
|
|
107
214
|
}
|
|
108
|
-
|
|
109
|
-
|
|
215
|
+
const localBranch = repoFromOrigin && !branch;
|
|
216
|
+
if (!branch) {
|
|
217
|
+
branch = safeBranch(git);
|
|
218
|
+
}
|
|
219
|
+
if ((!opts.repo || !opts.branch) && !opts.quiet) {
|
|
220
|
+
console.error(`Repo auto-detected: ${repoSlug} @ ${branch} (note: scanning remote)`);
|
|
110
221
|
}
|
|
222
|
+
return { repo: repoSlug, branch, provider, repo_url: repoUrl, local_branch: localBranch };
|
|
111
223
|
}
|
|
@@ -7,8 +7,9 @@ import { fileURLToPath } from 'url';
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = path.dirname(__filename);
|
|
9
9
|
export class SkillManager {
|
|
10
|
-
constructor() {
|
|
10
|
+
constructor(options = {}) {
|
|
11
11
|
this.configManager = new ConfigManager();
|
|
12
|
+
this.log = options.log ?? ((message) => console.log(message));
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Path to the OpenClaw root directory.
|
|
@@ -187,7 +188,7 @@ export class SkillManager {
|
|
|
187
188
|
return;
|
|
188
189
|
try {
|
|
189
190
|
fs.unlinkSync(legacy);
|
|
190
|
-
|
|
191
|
+
this.log(`✓ Removed legacy ${legacy} (superseded by ClawHub-shaped skill at ${this.getRafterSkillPath()})`);
|
|
191
192
|
}
|
|
192
193
|
catch {
|
|
193
194
|
/* best-effort */
|
|
@@ -213,7 +214,7 @@ export class SkillManager {
|
|
|
213
214
|
try {
|
|
214
215
|
// Remove old skill-auditor file
|
|
215
216
|
fs.unlinkSync(this.getOldSkillAuditorPath());
|
|
216
|
-
|
|
217
|
+
this.log("✓ Migrated from separate skill-auditor to combined Rafter Security skill");
|
|
217
218
|
}
|
|
218
219
|
catch (e) {
|
|
219
220
|
// Ignore migration errors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rafter-security/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,33 +23,34 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsc -p tsconfig.json",
|
|
25
25
|
"prepublishOnly": "pnpm run build",
|
|
26
|
-
"postinstall": "echo '\n Run: rafter agent init --all\n Sets up secret scanning for Claude Code, Codex CLI,
|
|
26
|
+
"postinstall": "echo '\n Run: rafter agent init --all\n Sets up secret scanning for detected agents (Claude Code, Codex CLI, ...).\n Git pre-commit hook: rafter agent install-hook\n'",
|
|
27
27
|
"test": "vitest run",
|
|
28
28
|
"test:watch": "vitest",
|
|
29
29
|
"test:coverage": "vitest run --coverage",
|
|
30
30
|
"clean": "rm -rf dist/ node_modules/.cache/"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
33
|
+
"node": ">=22"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
37
|
-
"axios": "^1.
|
|
38
|
-
"chalk": "^5.
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
37
|
+
"axios": "^1.20.0",
|
|
38
|
+
"chalk": "^5.6.2",
|
|
39
39
|
"chokidar": "^5.0.0",
|
|
40
40
|
"commander": "^11.1.0",
|
|
41
|
-
"dotenv": "^16.
|
|
42
|
-
"js-yaml": "^4.2
|
|
43
|
-
"minimatch": "^10.2.
|
|
41
|
+
"dotenv": "^16.6.1",
|
|
42
|
+
"js-yaml": "^4.3.2",
|
|
43
|
+
"minimatch": "^10.2.6",
|
|
44
44
|
"ora": "^7.0.1",
|
|
45
|
-
"tar": "^7.5.
|
|
45
|
+
"tar": "^7.5.22"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/js-yaml": "^4.0.9",
|
|
49
|
-
"@types/node": "^20.
|
|
50
|
-
"@vitest/coverage-v8": "4.1.
|
|
51
|
-
"tsx": "^4.
|
|
52
|
-
"typescript": "^5.
|
|
53
|
-
"
|
|
49
|
+
"@types/node": "^22.20.5",
|
|
50
|
+
"@vitest/coverage-v8": "^4.1.12",
|
|
51
|
+
"tsx": "^4.23.15",
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
|
+
"vite": "^7.3.7",
|
|
54
|
+
"vitest": "^4.1.12"
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rafter
|
|
3
|
-
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter audit`, policy checks, or command-risk evaluation. If a task is security-relevant and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on security-relevant work is not done."
|
|
3
|
+
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter agent audit`, policy checks, or command-risk evaluation. If a task is security-relevant and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on security-relevant work is not done."
|
|
4
4
|
alwaysApply: false
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter audit`, policy checks, or command-risk evaluation. If a task is security-relevant and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on security-relevant work is not done."
|
|
2
|
+
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter agent audit`, policy checks, or command-risk evaluation. If a task is security-relevant and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on security-relevant work is not done."
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -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.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
homepage: https://rafter.so
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -98,6 +98,8 @@ rafter agent exec <command>
|
|
|
98
98
|
- **Medium** (approval on moderate+): sudo, chmod, kill -9
|
|
99
99
|
- **Low** (allowed): npm install, git commit, ls
|
|
100
100
|
|
|
101
|
+
Under the PreToolUse hook, "approval required" means the call is denied: the hook cannot prompt, so `curl | bash` is refused, not asked. Do not retry it in another form; tell the user, who can approve it by running `rafter agent exec '<command>'` at an interactive terminal.
|
|
102
|
+
|
|
101
103
|
---
|
|
102
104
|
|
|
103
105
|
### /rafter-audit-skill
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rafter
|
|
3
|
-
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter audit`, policy checks, or command-risk evaluation. Scope by security surface, not task label: engage when the diff touches auth, credentials/secrets/tokens, untrusted input, SQL, shell/exec, file paths, deserialization, crypto, network endpoints, data deletion, or dependencies; for research/experimental/local-only code with none of that, a quick surface check is enough. When such surface IS present and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on genuine security surface is not done."
|
|
3
|
+
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter agent audit`, policy checks, or command-risk evaluation. Scope by security surface, not task label: engage when the diff touches auth, credentials/secrets/tokens, untrusted input, SQL, shell/exec, file paths, deserialization, crypto, network endpoints, data deletion, or dependencies; for research/experimental/local-only code with none of that, a quick surface check is enough. When such surface IS present and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on genuine security surface is not done."
|
|
4
4
|
version: 0.7.0
|
|
5
|
-
allowed-tools: [Bash, Read]
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# Rafter — Security Toolkit for AI Workflows
|
|
@@ -21,7 +21,7 @@ Every command (Bash-like tool call) gets classified into one of four tiers by `s
|
|
|
21
21
|
|---|---|---|
|
|
22
22
|
| `low` | Read-only, safe prefix (`ls`, `cat`, `grep`, `git status` …), no chaining | **approve** silently |
|
|
23
23
|
| `medium` | State-changing but recoverable (package installs, git commits on current branch) | **approve with note** in audit log |
|
|
24
|
-
| `high` | Destructive or privileged (force push, `sudo`, broad file deletion, curl
|
|
24
|
+
| `high` | Destructive or privileged (force push, `sudo`, broad file deletion, curl \| sh) | **deny**; the reason says a person must approve it with `rafter agent exec` at a terminal |
|
|
25
25
|
| `critical` | Likely irreversible damage (`rm -rf /`, DB drop, wiping .git, repo-wide chmod) | **block** hard |
|
|
26
26
|
|
|
27
27
|
Tiers are derived from regex patterns in `risk-rules.ts` (`CRITICAL_PATTERNS`, `HIGH_PATTERNS`, `MEDIUM_PATTERNS`) plus a `SAFE_PREFIX` allowlist. A command holding more than one statement disqualifies the safe-prefix shortcut. Statement separators are whatever the tokenizer treats as one — `&&`, `||`, `;`, `|`, `&`, and a NEWLINE — rather than a hand-kept list; the newline was missing from an earlier hand-kept copy and that was a live bypass.
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
name: rafter-code-review
|
|
3
3
|
description: "REQUIRED before declaring a task done when the diff touches user input, SQL, shell, auth, credentials, file paths, serialization, crypto, network endpoints, data deletion, or dependency surface. Judge by that surface, not the task label — research/experimental/local-only code with none of it can skip this. Walks OWASP/ASVS/MITRE questions the compiler and the test suite won't catch. Pair with `rafter run` on the same diff. When the diff has that surface, marking it complete without both has been under-delivered — do not claim done."
|
|
4
4
|
version: 0.7.0
|
|
5
|
-
allowed-tools: [Bash, Read, Glob, Grep]
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# Rafter Code Review — Structured Security Walkthroughs
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
name: rafter-secure-design
|
|
3
3
|
description: "REQUIRED before writing code for any feature touching auth, payments, credentials, tokens, sessions, file upload, user data, untrusted input, deserialization, network endpoints, or data deletion. Scope by that surface, not the task label — a research/experimental/local-only feature with none of it doesn't need this. Invoke it, record answers inline in the design doc or PR description, then write the code. Skipping this is how auth bypass, token leakage, and delete-the-wrong-record bugs ship. If the feature touches any of those surfaces and this hasn't run, the design is incomplete — do not proceed to implementation."
|
|
4
4
|
version: 0.1.0
|
|
5
|
-
allowed-tools: [Read, Glob, Grep]
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# Rafter Secure Design — Designing It Right The First Time
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
name: rafter-skill-review
|
|
3
3
|
description: "REQUIRED before copying any third-party SKILL.md, MCP manifest, Cursor rule, or agent config into this machine or forwarding one to a user. Installing a skill grants Read/Bash/network under your identity — this is `curl | sh` in a different costume. Do not install, load, recommend, or forward any third-party agent asset until this skill has vetted it. Bypassing this turns the agent into a delivery vector."
|
|
4
4
|
version: 0.1.0
|
|
5
|
-
allowed-tools: [Bash, Read, Grep, Glob, WebFetch]
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# Rafter Skill Review — Vet Before You Install
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
trigger: model_decision
|
|
3
|
-
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter audit`, policy checks, or command-risk evaluation. If a task is security-relevant and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on security-relevant work is not done."
|
|
3
|
+
description: "Entry point for rafter. Invoke when a sub-skill is unclear, or when the task needs `rafter run` (remote SAST+SCA), `rafter secrets` (local secrets-only), `rafter agent audit`, policy checks, or command-risk evaluation. If a task is security-relevant and no rafter skill or CLI call has been made, invoke this before handing the task off — an un-evaluated \"done\" on security-relevant work is not done."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# rafter — security toolkit router
|