@clawdstrike/openclaw 0.1.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/README.md +7 -0
- package/dist/audit/store.d.ts +26 -0
- package/dist/audit/store.d.ts.map +1 -0
- package/dist/audit/store.js +59 -0
- package/dist/audit/store.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +5 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/audit.d.ts +19 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +93 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/policy.d.ts +11 -0
- package/dist/cli/commands/policy.d.ts.map +1 -0
- package/dist/cli/commands/policy.js +101 -0
- package/dist/cli/commands/policy.js.map +1 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +91 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +88 -0
- package/dist/config.js.map +1 -0
- package/dist/e2e/openclaw-e2e.d.ts +2 -0
- package/dist/e2e/openclaw-e2e.d.ts.map +1 -0
- package/dist/e2e/openclaw-e2e.js +129 -0
- package/dist/e2e/openclaw-e2e.js.map +1 -0
- package/dist/guards/egress.d.ts +25 -0
- package/dist/guards/egress.d.ts.map +1 -0
- package/dist/guards/egress.js +146 -0
- package/dist/guards/egress.js.map +1 -0
- package/dist/guards/forbidden-path.d.ts +22 -0
- package/dist/guards/forbidden-path.d.ts.map +1 -0
- package/dist/guards/forbidden-path.js +132 -0
- package/dist/guards/forbidden-path.js.map +1 -0
- package/dist/guards/index.d.ts +12 -0
- package/dist/guards/index.d.ts.map +1 -0
- package/dist/guards/index.js +11 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/guards/patch-integrity.d.ts +27 -0
- package/dist/guards/patch-integrity.d.ts.map +1 -0
- package/dist/guards/patch-integrity.js +219 -0
- package/dist/guards/patch-integrity.js.map +1 -0
- package/dist/guards/secret-leak.d.ts +31 -0
- package/dist/guards/secret-leak.d.ts.map +1 -0
- package/dist/guards/secret-leak.js +235 -0
- package/dist/guards/secret-leak.js.map +1 -0
- package/dist/guards/types.d.ts +46 -0
- package/dist/guards/types.d.ts.map +1 -0
- package/dist/guards/types.js +36 -0
- package/dist/guards/types.js.map +1 -0
- package/dist/hooks/agent-bootstrap/handler.d.ts +10 -0
- package/dist/hooks/agent-bootstrap/handler.d.ts.map +1 -0
- package/dist/hooks/agent-bootstrap/handler.js +35 -0
- package/dist/hooks/agent-bootstrap/handler.js.map +1 -0
- package/dist/hooks/audit-logger/handler.d.ts +16 -0
- package/dist/hooks/audit-logger/handler.d.ts.map +1 -0
- package/dist/hooks/audit-logger/handler.js +70 -0
- package/dist/hooks/audit-logger/handler.js.map +1 -0
- package/dist/hooks/tool-guard/handler.d.ts +16 -0
- package/dist/hooks/tool-guard/handler.d.ts.map +1 -0
- package/dist/hooks/tool-guard/handler.js +335 -0
- package/dist/hooks/tool-guard/handler.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +234 -0
- package/dist/plugin.js.map +1 -0
- package/dist/policy/engine.d.ts +31 -0
- package/dist/policy/engine.d.ts.map +1 -0
- package/dist/policy/engine.js +282 -0
- package/dist/policy/engine.js.map +1 -0
- package/dist/policy/index.d.ts +4 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +4 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/loader.d.ts +10 -0
- package/dist/policy/loader.d.ts.map +1 -0
- package/dist/policy/loader.js +262 -0
- package/dist/policy/loader.js.map +1 -0
- package/dist/policy/validator.d.ts +4 -0
- package/dist/policy/validator.d.ts.map +1 -0
- package/dist/policy/validator.js +409 -0
- package/dist/policy/validator.js.map +1 -0
- package/dist/sanitizer/output-sanitizer.d.ts +15 -0
- package/dist/sanitizer/output-sanitizer.d.ts.map +1 -0
- package/dist/sanitizer/output-sanitizer.js +47 -0
- package/dist/sanitizer/output-sanitizer.js.map +1 -0
- package/dist/security-prompt.d.ts +3 -0
- package/dist/security-prompt.d.ts.map +1 -0
- package/dist/security-prompt.js +70 -0
- package/dist/security-prompt.js.map +1 -0
- package/dist/tools/policy-check.d.ts +10 -0
- package/dist/tools/policy-check.d.ts.map +1 -0
- package/dist/tools/policy-check.js +141 -0
- package/dist/tools/policy-check.js.map +1 -0
- package/dist/types.d.ts +413 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +85 -0
- package/rulesets/ai-agent-minimal.yaml +42 -0
- package/rulesets/ai-agent.yaml +70 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { PolicyEngine } from '../policy/engine.js';
|
|
2
|
+
function parseNetworkTarget(target) {
|
|
3
|
+
const trimmed = target.trim();
|
|
4
|
+
if (!trimmed)
|
|
5
|
+
return { host: '', port: 0 };
|
|
6
|
+
const tryParse = (value) => {
|
|
7
|
+
try {
|
|
8
|
+
const parsed = new URL(value);
|
|
9
|
+
const port = parsed.port ? Number.parseInt(parsed.port, 10) : parsed.protocol === 'http:' ? 80 : 443;
|
|
10
|
+
return { host: parsed.hostname, port, url: value };
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return (tryParse(trimmed) ??
|
|
17
|
+
tryParse(`https://${trimmed}`) ??
|
|
18
|
+
{ host: trimmed.split('/')[0] ?? trimmed, port: 443 });
|
|
19
|
+
}
|
|
20
|
+
function buildEvent(action, resource) {
|
|
21
|
+
const now = new Date();
|
|
22
|
+
const eventId = `policy-check-${now.getTime()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
23
|
+
const timestamp = now.toISOString();
|
|
24
|
+
switch (action) {
|
|
25
|
+
case 'file_read':
|
|
26
|
+
return {
|
|
27
|
+
eventId,
|
|
28
|
+
eventType: 'file_read',
|
|
29
|
+
timestamp,
|
|
30
|
+
data: { type: 'file', path: resource, operation: 'read' },
|
|
31
|
+
};
|
|
32
|
+
case 'file_write':
|
|
33
|
+
return {
|
|
34
|
+
eventId,
|
|
35
|
+
eventType: 'file_write',
|
|
36
|
+
timestamp,
|
|
37
|
+
data: { type: 'file', path: resource, operation: 'write' },
|
|
38
|
+
};
|
|
39
|
+
case 'network':
|
|
40
|
+
case 'network_egress': {
|
|
41
|
+
const { host, port, url } = parseNetworkTarget(resource);
|
|
42
|
+
return {
|
|
43
|
+
eventId,
|
|
44
|
+
eventType: 'network_egress',
|
|
45
|
+
timestamp,
|
|
46
|
+
data: { type: 'network', host, port, url },
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
case 'command':
|
|
50
|
+
case 'command_exec': {
|
|
51
|
+
const parts = resource.trim().split(/\s+/).filter(Boolean);
|
|
52
|
+
const [command, ...args] = parts;
|
|
53
|
+
return {
|
|
54
|
+
eventId,
|
|
55
|
+
eventType: 'command_exec',
|
|
56
|
+
timestamp,
|
|
57
|
+
data: { type: 'command', command: command ?? '', args },
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
case 'tool_call':
|
|
61
|
+
default:
|
|
62
|
+
return {
|
|
63
|
+
eventId,
|
|
64
|
+
eventType: 'tool_call',
|
|
65
|
+
timestamp,
|
|
66
|
+
data: { type: 'tool', toolName: resource, parameters: {} },
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function formatDecision(decision) {
|
|
71
|
+
const isDenied = decision.status === 'deny' || decision.denied;
|
|
72
|
+
const isWarn = decision.status === 'warn' || decision.warn;
|
|
73
|
+
if (isDenied) {
|
|
74
|
+
const guard = decision.guard ? ` by ${decision.guard}` : '';
|
|
75
|
+
const reason = decision.reason ? `: ${decision.reason}` : '';
|
|
76
|
+
return `Denied${guard}${reason}`;
|
|
77
|
+
}
|
|
78
|
+
if (isWarn) {
|
|
79
|
+
const msg = decision.message ?? decision.reason ?? 'Policy warning';
|
|
80
|
+
return `Warning: ${msg}`;
|
|
81
|
+
}
|
|
82
|
+
return 'Action allowed';
|
|
83
|
+
}
|
|
84
|
+
export async function checkPolicy(config, action, resource) {
|
|
85
|
+
const engine = new PolicyEngine(config);
|
|
86
|
+
const event = buildEvent(action, resource);
|
|
87
|
+
const decision = await engine.evaluate(event);
|
|
88
|
+
const isDenied = decision.status === 'deny' || decision.denied;
|
|
89
|
+
return { ...decision, message: formatDecision(decision), suggestion: isDenied ? getSuggestion(action, resource) : undefined };
|
|
90
|
+
}
|
|
91
|
+
export function policyCheckTool(engine) {
|
|
92
|
+
return {
|
|
93
|
+
name: 'policy_check',
|
|
94
|
+
description: 'Check if an action is allowed by the security policy. Use this BEFORE attempting potentially restricted operations.',
|
|
95
|
+
schema: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
action: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
enum: ['file_read', 'file_write', 'network', 'command', 'tool_call'],
|
|
101
|
+
description: 'The type of action to check',
|
|
102
|
+
},
|
|
103
|
+
resource: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
description: 'The resource to check (path, domain, command, or tool name)',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
required: ['action', 'resource'],
|
|
109
|
+
},
|
|
110
|
+
execute: async (params) => {
|
|
111
|
+
const action = params.action ?? 'tool_call';
|
|
112
|
+
const resource = typeof params.resource === 'string' ? params.resource : '';
|
|
113
|
+
const event = buildEvent(action, resource);
|
|
114
|
+
const decision = await engine.evaluate(event);
|
|
115
|
+
return {
|
|
116
|
+
...decision,
|
|
117
|
+
message: formatDecision(decision),
|
|
118
|
+
suggestion: (decision.status === 'deny' || decision.denied) ? getSuggestion(action, resource) : undefined,
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function getSuggestion(action, resource) {
|
|
124
|
+
if ((action === 'file_write' || action === 'file_read') && resource.includes('.ssh')) {
|
|
125
|
+
return 'SSH keys are protected. Consider using a different credential storage method.';
|
|
126
|
+
}
|
|
127
|
+
if ((action === 'file_write' || action === 'file_read') && resource.includes('.aws')) {
|
|
128
|
+
return 'AWS credentials are protected. Use environment variables or IAM roles instead.';
|
|
129
|
+
}
|
|
130
|
+
if (action === 'network_egress' || action === 'network') {
|
|
131
|
+
return 'Try using an allowed domain like api.github.com or pypi.org.';
|
|
132
|
+
}
|
|
133
|
+
if ((action === 'command_exec' || action === 'command') && resource.includes('sudo')) {
|
|
134
|
+
return 'Privileged commands are restricted. Try running without sudo.';
|
|
135
|
+
}
|
|
136
|
+
if ((action === 'command_exec' || action === 'command') && (resource.includes('rm -rf') || resource.includes('dd if='))) {
|
|
137
|
+
return 'Destructive commands are blocked. Consider safer alternatives.';
|
|
138
|
+
}
|
|
139
|
+
return 'Consider an alternative approach that works within the security policy.';
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=policy-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-check.js","sourceRoot":"","sources":["../../src/tools/policy-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAgBnD,SAAS,kBAAkB,CAAC,MAAc;IACxC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAE3C,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAuD,EAAE;QACtF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,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,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrF,OAAO,+EAA+E,CAAC;IACzF,CAAC;IACD,IAAI,CAAC,MAAM,KAAK,YAAY,IAAI,MAAM,KAAK,WAAW,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrF,OAAO,gFAAgF,CAAC;IAC1F,CAAC;IACD,IAAI,MAAM,KAAK,gBAAgB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACxD,OAAO,8DAA8D,CAAC;IACxE,CAAC;IACD,IAAI,CAAC,MAAM,KAAK,cAAc,IAAI,MAAM,KAAK,SAAS,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrF,OAAO,+DAA+D,CAAC;IACzE,CAAC;IACD,IAAI,CAAC,MAAM,KAAK,cAAc,IAAI,MAAM,KAAK,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QACxH,OAAO,gEAAgE,CAAC;IAC1E,CAAC;IACD,OAAO,yEAAyE,CAAC;AACnF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @clawdstrike/openclaw - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Core types for the Clawdstrike security plugin for OpenClaw.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Severity level for policy violations
|
|
8
|
+
*/
|
|
9
|
+
export type Severity = 'low' | 'medium' | 'high' | 'critical';
|
|
10
|
+
/**
|
|
11
|
+
* Enforcement mode for policy evaluation
|
|
12
|
+
*/
|
|
13
|
+
export type EvaluationMode = 'deterministic' | 'advisory' | 'audit';
|
|
14
|
+
/**
|
|
15
|
+
* Log level for plugin output
|
|
16
|
+
*/
|
|
17
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
18
|
+
/**
|
|
19
|
+
* Action to take on policy violation
|
|
20
|
+
*/
|
|
21
|
+
export type ViolationAction = 'cancel' | 'warn' | 'isolate' | 'escalate';
|
|
22
|
+
/**
|
|
23
|
+
* Network egress mode
|
|
24
|
+
*/
|
|
25
|
+
export type EgressMode = 'allowlist' | 'denylist' | 'open' | 'deny_all';
|
|
26
|
+
/**
|
|
27
|
+
* Event type discriminator for policy evaluation
|
|
28
|
+
*/
|
|
29
|
+
export type EventType = 'file_read' | 'file_write' | 'command_exec' | 'network_egress' | 'tool_call' | 'patch_apply' | 'secret_access';
|
|
30
|
+
/**
|
|
31
|
+
* Plugin configuration schema
|
|
32
|
+
*/
|
|
33
|
+
export interface ClawdstrikeConfig {
|
|
34
|
+
/** Path to policy YAML or built-in ruleset name */
|
|
35
|
+
policy?: string;
|
|
36
|
+
/** Enforcement mode */
|
|
37
|
+
mode?: EvaluationMode;
|
|
38
|
+
/** Logging level */
|
|
39
|
+
logLevel?: LogLevel;
|
|
40
|
+
/** Guard enable/disable toggles */
|
|
41
|
+
guards?: GuardToggles;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Guard enable/disable toggles
|
|
45
|
+
*/
|
|
46
|
+
export interface GuardToggles {
|
|
47
|
+
forbidden_path?: boolean;
|
|
48
|
+
egress?: boolean;
|
|
49
|
+
secret_leak?: boolean;
|
|
50
|
+
patch_integrity?: boolean;
|
|
51
|
+
mcp_tool?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Execution event to be evaluated by policy engine
|
|
55
|
+
*/
|
|
56
|
+
export interface PolicyEvent {
|
|
57
|
+
/** Unique event identifier */
|
|
58
|
+
eventId: string;
|
|
59
|
+
/** Event type */
|
|
60
|
+
eventType: EventType;
|
|
61
|
+
/** Event timestamp (ISO 8601) */
|
|
62
|
+
timestamp: string;
|
|
63
|
+
/** Associated session/run identifier */
|
|
64
|
+
sessionId?: string;
|
|
65
|
+
/** Event-specific data */
|
|
66
|
+
data: EventData;
|
|
67
|
+
/** Optional metadata */
|
|
68
|
+
metadata?: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Union type for event-specific data
|
|
72
|
+
*/
|
|
73
|
+
export type EventData = FileEventData | CommandEventData | NetworkEventData | ToolEventData | PatchEventData | SecretEventData;
|
|
74
|
+
/**
|
|
75
|
+
* File read/write event data
|
|
76
|
+
*/
|
|
77
|
+
export interface FileEventData {
|
|
78
|
+
type: 'file';
|
|
79
|
+
/** Absolute path to the file */
|
|
80
|
+
path: string;
|
|
81
|
+
/** Optional raw content (small files only; best-effort) */
|
|
82
|
+
content?: string;
|
|
83
|
+
/** Optional base64-encoded content */
|
|
84
|
+
contentBase64?: string;
|
|
85
|
+
/** Optional content hash (for write verification) */
|
|
86
|
+
contentHash?: string;
|
|
87
|
+
/** Operation type */
|
|
88
|
+
operation: 'read' | 'write';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Command execution event data
|
|
92
|
+
*/
|
|
93
|
+
export interface CommandEventData {
|
|
94
|
+
type: 'command';
|
|
95
|
+
/** Command name or path */
|
|
96
|
+
command: string;
|
|
97
|
+
/** Command arguments */
|
|
98
|
+
args: string[];
|
|
99
|
+
/** Working directory */
|
|
100
|
+
workingDir?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Network egress event data
|
|
104
|
+
*/
|
|
105
|
+
export interface NetworkEventData {
|
|
106
|
+
type: 'network';
|
|
107
|
+
/** Target hostname or IP */
|
|
108
|
+
host: string;
|
|
109
|
+
/** Target port */
|
|
110
|
+
port: number;
|
|
111
|
+
/** Protocol (tcp, udp, etc.) */
|
|
112
|
+
protocol?: string;
|
|
113
|
+
/** Full URL if available */
|
|
114
|
+
url?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Tool invocation event data
|
|
118
|
+
*/
|
|
119
|
+
export interface ToolEventData {
|
|
120
|
+
type: 'tool';
|
|
121
|
+
/** Tool name (e.g., "bash", "file_write", "web_search") */
|
|
122
|
+
toolName: string;
|
|
123
|
+
/** Tool parameters */
|
|
124
|
+
parameters: Record<string, unknown>;
|
|
125
|
+
/** Tool result (for post-execution checks) */
|
|
126
|
+
result?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Patch/diff application event data
|
|
130
|
+
*/
|
|
131
|
+
export interface PatchEventData {
|
|
132
|
+
type: 'patch';
|
|
133
|
+
/** Target file path */
|
|
134
|
+
filePath: string;
|
|
135
|
+
/** Patch content (diff or full content) */
|
|
136
|
+
patchContent: string;
|
|
137
|
+
/** Optional patch hash */
|
|
138
|
+
patchHash?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Secret access event data
|
|
142
|
+
*/
|
|
143
|
+
export interface SecretEventData {
|
|
144
|
+
type: 'secret';
|
|
145
|
+
/** Secret identifier or name */
|
|
146
|
+
secretName: string;
|
|
147
|
+
/** Scope (environment, file, etc.) */
|
|
148
|
+
scope: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Decision status for security checks.
|
|
152
|
+
* - 'allow': Operation is permitted
|
|
153
|
+
* - 'warn': Operation is permitted but flagged for review
|
|
154
|
+
* - 'deny': Operation is blocked
|
|
155
|
+
*/
|
|
156
|
+
export type DecisionStatus = 'allow' | 'warn' | 'deny';
|
|
157
|
+
/**
|
|
158
|
+
* Result of policy evaluation
|
|
159
|
+
*/
|
|
160
|
+
export interface Decision {
|
|
161
|
+
/** The decision status: 'allow', 'warn', or 'deny' */
|
|
162
|
+
status: DecisionStatus;
|
|
163
|
+
/** Whether the event is allowed @deprecated Use status === 'allow' || status === 'warn' */
|
|
164
|
+
allowed: boolean;
|
|
165
|
+
/** Whether the event is explicitly denied @deprecated Use status === 'deny' */
|
|
166
|
+
denied: boolean;
|
|
167
|
+
/** Whether to show a warning @deprecated Use status === 'warn' */
|
|
168
|
+
warn: boolean;
|
|
169
|
+
/** Reason for denial (if denied) */
|
|
170
|
+
reason?: string;
|
|
171
|
+
/** Guard that made the decision */
|
|
172
|
+
guard?: string;
|
|
173
|
+
/** Severity of the violation */
|
|
174
|
+
severity?: Severity;
|
|
175
|
+
/** Additional message */
|
|
176
|
+
message?: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Result from a single guard check
|
|
180
|
+
*/
|
|
181
|
+
export interface GuardResult {
|
|
182
|
+
/** Guard status */
|
|
183
|
+
status: 'allow' | 'deny' | 'warn';
|
|
184
|
+
/** Reason message */
|
|
185
|
+
reason?: string;
|
|
186
|
+
/** Severity (for deny) */
|
|
187
|
+
severity?: Severity;
|
|
188
|
+
/** Guard name */
|
|
189
|
+
guard: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Security policy configuration
|
|
193
|
+
*/
|
|
194
|
+
export interface Policy {
|
|
195
|
+
/** Policy version identifier */
|
|
196
|
+
version?: string;
|
|
197
|
+
/** Base policy to extend */
|
|
198
|
+
extends?: string;
|
|
199
|
+
/** Network egress configuration */
|
|
200
|
+
egress?: EgressPolicy;
|
|
201
|
+
/** Filesystem access configuration */
|
|
202
|
+
filesystem?: FilesystemPolicy;
|
|
203
|
+
/** Command execution configuration */
|
|
204
|
+
execution?: ExecutionPolicy;
|
|
205
|
+
/** Tool/MCP restrictions */
|
|
206
|
+
tools?: ToolPolicy;
|
|
207
|
+
/** Resource limits */
|
|
208
|
+
limits?: ResourceLimits;
|
|
209
|
+
/** Guard-level toggles */
|
|
210
|
+
guards?: GuardToggles & {
|
|
211
|
+
custom?: unknown;
|
|
212
|
+
};
|
|
213
|
+
/** Action to take on violation */
|
|
214
|
+
on_violation?: ViolationAction;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Network egress policy
|
|
218
|
+
*/
|
|
219
|
+
export interface EgressPolicy {
|
|
220
|
+
/** Egress mode */
|
|
221
|
+
mode: EgressMode;
|
|
222
|
+
/** Allowed domains (for allowlist mode) */
|
|
223
|
+
allowed_domains?: string[];
|
|
224
|
+
/** Allowed IP CIDRs */
|
|
225
|
+
allowed_cidrs?: string[];
|
|
226
|
+
/** Denied domains (takes precedence) */
|
|
227
|
+
denied_domains?: string[];
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Filesystem access policy
|
|
231
|
+
*/
|
|
232
|
+
export interface FilesystemPolicy {
|
|
233
|
+
/** Directories where writes are allowed */
|
|
234
|
+
allowed_write_roots?: string[];
|
|
235
|
+
/** Paths that must never be accessed */
|
|
236
|
+
forbidden_paths?: string[];
|
|
237
|
+
/** Allowed read paths (empty = all allowed) */
|
|
238
|
+
allowed_read_paths?: string[];
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Command execution policy
|
|
242
|
+
*/
|
|
243
|
+
export interface ExecutionPolicy {
|
|
244
|
+
/** Allowed commands (empty = all allowed) */
|
|
245
|
+
allowed_commands?: string[];
|
|
246
|
+
/** Denied command patterns (regex) */
|
|
247
|
+
denied_patterns?: string[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Tool access policy
|
|
251
|
+
*/
|
|
252
|
+
export interface ToolPolicy {
|
|
253
|
+
/** Allowed tools (empty = all allowed) */
|
|
254
|
+
allowed?: string[];
|
|
255
|
+
/** Denied tools */
|
|
256
|
+
denied?: string[];
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Resource limits
|
|
260
|
+
*/
|
|
261
|
+
export interface ResourceLimits {
|
|
262
|
+
/** Maximum execution time in seconds */
|
|
263
|
+
max_execution_seconds?: number;
|
|
264
|
+
/** Maximum memory in MB */
|
|
265
|
+
max_memory_mb?: number;
|
|
266
|
+
/** Maximum output size in bytes */
|
|
267
|
+
max_output_bytes?: number;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Policy lint result
|
|
271
|
+
*/
|
|
272
|
+
export interface PolicyLintResult {
|
|
273
|
+
/** Whether policy is valid */
|
|
274
|
+
valid: boolean;
|
|
275
|
+
/** Validation errors */
|
|
276
|
+
errors: string[];
|
|
277
|
+
/** Validation warnings */
|
|
278
|
+
warnings: string[];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Secret pattern for detection
|
|
282
|
+
*/
|
|
283
|
+
export interface SecretPattern {
|
|
284
|
+
/** Pattern name */
|
|
285
|
+
name: string;
|
|
286
|
+
/** Regex pattern */
|
|
287
|
+
pattern: RegExp;
|
|
288
|
+
/** Severity if detected */
|
|
289
|
+
severity: Severity;
|
|
290
|
+
/** Description */
|
|
291
|
+
description: string;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Dangerous pattern for patch integrity
|
|
295
|
+
*/
|
|
296
|
+
export interface DangerousPattern {
|
|
297
|
+
/** Pattern name */
|
|
298
|
+
name: string;
|
|
299
|
+
/** Regex pattern */
|
|
300
|
+
pattern: RegExp;
|
|
301
|
+
/** Severity if detected */
|
|
302
|
+
severity: Severity;
|
|
303
|
+
/** Description */
|
|
304
|
+
description: string;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* OpenClaw Plugin API interface (minimal for type safety)
|
|
308
|
+
*/
|
|
309
|
+
export interface PluginAPI {
|
|
310
|
+
/** Get plugin configuration */
|
|
311
|
+
getConfig<T = ClawdstrikeConfig>(): T;
|
|
312
|
+
/** Register a tool */
|
|
313
|
+
registerTool(tool: ToolDefinition): void;
|
|
314
|
+
/** Register CLI commands */
|
|
315
|
+
registerCli(callback: (ctx: CliContext) => void): void;
|
|
316
|
+
/** Register a background service */
|
|
317
|
+
registerService(service: ServiceDefinition): void;
|
|
318
|
+
/** Get logger */
|
|
319
|
+
getLogger(): Logger;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Tool definition for registration
|
|
323
|
+
*/
|
|
324
|
+
export interface ToolDefinition {
|
|
325
|
+
/** Tool name */
|
|
326
|
+
name: string;
|
|
327
|
+
/** Tool description */
|
|
328
|
+
description: string;
|
|
329
|
+
/** JSON Schema for parameters */
|
|
330
|
+
schema: Record<string, unknown>;
|
|
331
|
+
/** Tool execution function */
|
|
332
|
+
execute: (params: Record<string, unknown>) => Promise<unknown>;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* CLI context for command registration
|
|
336
|
+
*/
|
|
337
|
+
export interface CliContext {
|
|
338
|
+
program: {
|
|
339
|
+
command(name: string): CommandBuilder;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Command builder interface
|
|
344
|
+
*/
|
|
345
|
+
export interface CommandBuilder {
|
|
346
|
+
description(desc: string): CommandBuilder;
|
|
347
|
+
command(name: string): CommandBuilder;
|
|
348
|
+
action(fn: (...args: unknown[]) => Promise<void> | void): CommandBuilder;
|
|
349
|
+
argument(name: string, desc?: string): CommandBuilder;
|
|
350
|
+
option(flags: string, desc?: string, defaultValue?: unknown): CommandBuilder;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Service definition for background processes
|
|
354
|
+
*/
|
|
355
|
+
export interface ServiceDefinition {
|
|
356
|
+
/** Service ID */
|
|
357
|
+
id: string;
|
|
358
|
+
/** Start function */
|
|
359
|
+
start: () => Promise<void>;
|
|
360
|
+
/** Stop function */
|
|
361
|
+
stop: () => Promise<void>;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Logger interface
|
|
365
|
+
*/
|
|
366
|
+
export interface Logger {
|
|
367
|
+
debug(message: string, ...args: unknown[]): void;
|
|
368
|
+
info(message: string, ...args: unknown[]): void;
|
|
369
|
+
warn(message: string, ...args: unknown[]): void;
|
|
370
|
+
error(message: string, ...args: unknown[]): void;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Hook event context for tool_result_persist
|
|
374
|
+
*/
|
|
375
|
+
export interface ToolResultPersistEvent {
|
|
376
|
+
type: 'tool_result_persist';
|
|
377
|
+
timestamp: string;
|
|
378
|
+
context: {
|
|
379
|
+
sessionId: string;
|
|
380
|
+
toolResult: {
|
|
381
|
+
toolName: string;
|
|
382
|
+
params: Record<string, unknown>;
|
|
383
|
+
result: unknown;
|
|
384
|
+
error?: string;
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
messages: string[];
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Hook event context for agent:bootstrap
|
|
391
|
+
*/
|
|
392
|
+
export interface AgentBootstrapEvent {
|
|
393
|
+
type: 'agent:bootstrap';
|
|
394
|
+
timestamp: string;
|
|
395
|
+
context: {
|
|
396
|
+
sessionId: string;
|
|
397
|
+
agentId: string;
|
|
398
|
+
bootstrapFiles: Array<{
|
|
399
|
+
path: string;
|
|
400
|
+
content: string;
|
|
401
|
+
}>;
|
|
402
|
+
cfg: ClawdstrikeConfig;
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Generic hook event type
|
|
407
|
+
*/
|
|
408
|
+
export type HookEvent = ToolResultPersistEvent | AgentBootstrapEvent;
|
|
409
|
+
/**
|
|
410
|
+
* Hook handler function type
|
|
411
|
+
*/
|
|
412
|
+
export type HookHandler = (event: HookEvent) => Promise<void> | void;
|
|
413
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,UAAU,GAAG,OAAO,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU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AAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE;YACV,QAAQ,EAAE,MAAM,CAAC;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;KACH,CAAC;IACF,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,KAAK,CAAC;YACpB,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC,CAAC;QACH,GAAG,EAAE,iBAAiB,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,sBAAsB,GAAG,mBAAmB,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clawdstrike/openclaw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Clawdstrike security plugin for OpenClaw",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./cli": {
|
|
14
|
+
"import": "./dist/cli/index.js",
|
|
15
|
+
"types": "./dist/cli/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"clawdstrike": "./dist/cli/bin.js"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"e2e": "npm run build && node dist/e2e/openclaw-e2e.js",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"lint": "npm run typecheck",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"bench": "npm run build && node benchmarks/policy-engine.bench.mjs",
|
|
29
|
+
"bench:json": "npm run build && OUTPUT_JSON=1 node benchmarks/policy-engine.bench.mjs"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@clawdstrike/adapter-core": "^0.1.0",
|
|
33
|
+
"@clawdstrike/policy": "^0.1.0",
|
|
34
|
+
"chalk": "^5.3.0",
|
|
35
|
+
"commander": "^14.0.3",
|
|
36
|
+
"glob": "^13.0.1",
|
|
37
|
+
"js-yaml": "^4.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/js-yaml": "^4.0.9",
|
|
41
|
+
"@types/node": "^25.2.0",
|
|
42
|
+
"typescript": "^5.9.3",
|
|
43
|
+
"vitest": "^4.0.18"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"openclaw": ">=0.1.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"openclaw": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"rulesets",
|
|
56
|
+
"README.md"
|
|
57
|
+
],
|
|
58
|
+
"keywords": [
|
|
59
|
+
"openclaw",
|
|
60
|
+
"security",
|
|
61
|
+
"clawdstrike",
|
|
62
|
+
"ai-agent"
|
|
63
|
+
],
|
|
64
|
+
"license": "Apache-2.0",
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "https://github.com/backbay-labs/clawdstrike.git",
|
|
68
|
+
"directory": "packages/adapters/clawdstrike-openclaw"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/backbay-labs/clawdstrike",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/backbay-labs/clawdstrike/issues"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=20"
|
|
79
|
+
},
|
|
80
|
+
"openclaw": {
|
|
81
|
+
"extensions": [
|
|
82
|
+
"./dist/plugin.js"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}
|