Security Guard
ReviewAudited by ClawScan on May 10, 2026.
Overview
This looks like a local security helper, but its code may treat high-risk actions as allowed without confirmed approval and may ignore custom permission settings.
Review carefully before relying on this as a security control. Do not use it as the only approval or authorization layer until high-risk confirmation and custom role handling are fixed and tested; also keep audit logs protected and avoid logging secrets.
Findings (3)
Artifact-based informational review of SKILL.md, metadata, install specs, static scan signals, and capability signals. ClawScan does not execute the skill or run runtime probes.
An application or agent that treats allowed=true as permission to proceed could run a sensitive operation without an actual human confirmation step.
High-risk actions are marked as needing confirmation, but check() still logs success and returns allowed=true, so approval enforcement is left to caller behavior rather than failing closed.
if (riskLevel === 'high') {
result.checks.riskLevel = riskLevel;
result.requiresConfirmation = true;
await this.auditLogger.logHighRisk({ ... });
}
// 4. 记录审计日志
await this.auditLogger.log({ ... status: 'success', ... });
result.allowed = true;
return result;Make high-risk checks return a pending or denied state until confirm() succeeds, and document a required fail-closed confirmation flow.
Users may believe they configured a narrower RBAC policy while the runtime uses different built-in permissions, creating an unexpected authorization boundary.
The constructor accepts a config object, but the shown code initializes built-in roles and permissions instead of applying caller-provided roles/defaultRole from the documented configuration examples.
constructor(config = {}) {
super();
this.roles = new Map();
...
this.defineRole('admin', {
permissions: ['*'],
description: 'Full access'
});
this.defineRole('user', {
permissions: [
'file:read',
'file:write:home',
'web:read',
'exec:safe',
'memory:read',
'memory:write'
],Apply and validate the supplied permission configuration, test strict/default-role behavior, and clearly document any built-in roles that remain active.
Audit logs may retain sensitive operation metadata or details on disk if callers include secrets or private resource names.
The audit logger writes persistent local records containing user, action, resource, status, and details fields.
this.logDir = config.logDir || './audit-logs';
...
userId: operation.userId || 'anonymous',
action: operation.action,
resource: operation.resource,
status: operation.status || 'success',
details: operation.details || {},
...
await fs.appendFile(logFile, entries, 'utf-8');Store logs in a protected directory, avoid placing secrets in details/resource fields, and configure retention/cleanup appropriately.
