
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@torknetwork/guardian
Advanced tools
AI governance and security layer for OpenClaw agents. Intentionally inspects AI agent traffic to detect PII leaks, policy violations, and dangerous tool calls.
OpenClaw is powerful. Tork makes it safe.
Enterprise-grade security and governance layer for OpenClaw agents. Detect PII, enforce policies, generate compliance receipts, control tool access, and scan skills for vulnerabilities before installation.
npm install @torknetwork/guardian
import { TorkGuardian } from '@torknetwork/guardian';
const guardian = new TorkGuardian({
apiKey: process.env.TORK_API_KEY!,
});
// Govern an LLM request before sending
const result = await guardian.governLLM({
messages: [
{ role: 'user', content: 'Email john@example.com about the project' },
],
});
// PII is redacted: "Email [EMAIL_REDACTED] about the project"
// Check if a tool call is allowed
const decision = guardian.governTool({
name: 'shell_execute',
args: { command: 'rm -rf /' },
});
// { allowed: false, reason: 'Blocked shell command pattern: "rm -rf"' }
Detect country-specific PII patterns across 13 regions and 3 industries. Configure region and industry in your Guardian config or pass them per-call.
const guardian = new TorkGuardian({
apiKey: process.env.TORK_API_KEY!,
pii: {
region: ['ae', 'sa'], // UAE + Saudi Arabia
industry: 'finance', // Enable finance-specific patterns
},
});
// All govern/redact calls now include regional detection
const result = await guardian.redactPII('Emirates ID 784-1234-1234567-1');
import { redactPII } from '@torknetwork/guardian';
const result = await redactPII('tork_...', 'Aadhaar 1234 5678 9012', {
region: ['in'],
industry: 'healthcare',
});
au us gb eu ae sa ng in jp cn kr br
healthcare finance legal
Tork Guardian governs all network activity — port binds, outbound connections, and DNS lookups — with SSRF prevention, reverse shell detection, and per-skill rate limiting.
const guardian = new TorkGuardian({
apiKey: process.env.TORK_API_KEY!,
networkPolicy: 'default',
});
const network = guardian.getNetworkHandler();
// Validate a port bind
const bind = network.validatePortBind('my-skill', 3000, 'tcp');
// { allowed: true, reason: 'Port 3000/tcp bound' }
// Validate an outbound connection
const egress = network.validateEgress('my-skill', 'api.openai.com', 443);
// { allowed: true, reason: 'Egress to api.openai.com:443 allowed' }
// Validate a DNS lookup (flags raw IPs)
const dns = network.validateDNS('my-skill', 'api.openai.com');
// { allowed: true, reason: 'DNS lookup for api.openai.com allowed' }
// Get the full activity log for compliance
const log = network.getActivityLog();
// Get a network report with anomaly detection
const report = network.getMonitor().getNetworkReport();
import { validatePortBind, validateEgress, validateDNS } from '@torknetwork/guardian';
const config = { apiKey: 'tork_...', networkPolicy: 'strict' as const };
validatePortBind(config, 'my-skill', 3000, 'tcp');
validateEgress(config, 'my-skill', 'api.openai.com', 443);
validateDNS(config, 'my-skill', 'api.openai.com');
// Default — balanced for dev & production
const guardian = new TorkGuardian({
apiKey: 'tork_...',
networkPolicy: 'default',
});
// Strict — enterprise lockdown (443 only, explicit domain allowlist)
const guardian = new TorkGuardian({
apiKey: 'tork_...',
networkPolicy: 'strict',
});
// Custom — override any setting
const guardian = new TorkGuardian({
apiKey: 'tork_...',
networkPolicy: 'custom',
allowedOutboundPorts: [443, 8443],
allowedDomains: ['api.myservice.com'],
maxConnectionsPerMinute: 30,
});
See docs/NETWORK-SECURITY.md for full details on threat coverage, policy comparison, and compliance receipts.
Pre-built configurations for common environments:
import {
MINIMAL_CONFIG,
DEVELOPMENT_CONFIG,
PRODUCTION_CONFIG,
ENTERPRISE_CONFIG,
} from '@torknetwork/guardian';
| Config | Policy | Network | Description |
|---|---|---|---|
MINIMAL_CONFIG | standard | default | Just an API key, all defaults |
DEVELOPMENT_CONFIG | minimal | default | Permissive policies, full logging |
PRODUCTION_CONFIG | standard | default | Blocked exfil domains (pastebin, ngrok, burp) |
ENTERPRISE_CONFIG | strict | strict | Explicit domain allowlist, 20 conn/min, TLS only |
import { TorkGuardian, PRODUCTION_CONFIG } from '@torknetwork/guardian';
const guardian = new TorkGuardian({
...PRODUCTION_CONFIG,
apiKey: process.env.TORK_API_KEY!,
});
const guardian = new TorkGuardian({
// Required
apiKey: 'tork_...',
// Optional
baseUrl: 'https://tork.network', // API endpoint
policy: 'standard', // 'strict' | 'standard' | 'minimal'
redactPII: true, // Enable PII redaction
// Shell command governance
blockShellCommands: [
'rm -rf', 'mkfs', 'dd if=', 'chmod 777',
'shutdown', 'reboot',
],
// File access control
allowedPaths: [], // Empty = allow all (except blocked)
blockedPaths: [
'.env', '.env.local', '~/.ssh',
'~/.aws', 'credentials.json',
],
// Network governance
networkPolicy: 'default', // 'default' | 'strict' | 'custom'
allowedInboundPorts: [3000, 8080], // Ports skills may bind to
allowedOutboundPorts: [443], // Ports for outbound connections
allowedDomains: ['api.openai.com'], // If non-empty, only these domains are allowed
blockedDomains: ['evil.com'], // Domains always blocked
maxConnectionsPerMinute: 60, // Per-skill egress rate limit
// API failure handling (see docs/FAILURE-MODES.md)
failureMode: 'closed', // 'closed' (default) | 'open'
onFailure: (error) => {}, // Called when failureMode 'open' allows a call through
});
The port, domain, and rate-limit fields apply on top of whichever base
networkPolicy you pick — e.g. networkPolicy: 'strict' plus your own
allowedDomains keeps the strict lockdown but uses your allowlist.
Auth failures never fail open. If the API returns 401 or 403 (missing,
invalid, expired, or revoked key), the SDK throws TorkAuthError — governance
did not run and the SDK will not pretend it did. Other 4xx responses throw
TorkRequestError. This is not configurable.
Outages are your choice. For 5xx responses, timeouts, and connection
failures, the default failureMode: 'closed' throws TorkUnavailableError.
Opt into failureMode: 'open' to allow requests through during Tork outages;
every allowed-through call is reported to your onFailure callback.
const guardian = new TorkGuardian({
apiKey: process.env.TORK_API_KEY!,
failureMode: 'open', // opt-in; default is 'closed'
onFailure: (error) => alerting.warn('Tork unavailable, call ungoverned', error),
});
Versions ≤ 1.0.2 failed open on all errors, including auth failures. Upgrade — see docs/FAILURE-MODES.md.
| Policy | PII | Shell | Files | Network |
|---|---|---|---|---|
| strict | Deny on detection | Block all | Whitelist only | Block all |
| standard | Redact | Block dangerous | Block sensitive | Allow |
| minimal | Redact | Allow all | Allow all | Allow all |
import { redactPII, generateReceipt, governToolCall } from '@torknetwork/guardian';
// Redact PII from text
const result = await redactPII('tork_...', 'Call 555-123-4567');
// Generate a compliance receipt
const receipt = await generateReceipt('tork_...', 'Processed user data');
// Check a tool call against policy
const decision = governToolCall(
{ name: 'file_write', args: { path: '.env' } },
{ policy: 'standard', blockedPaths: ['.env'] }
);
Scan any OpenClaw skill for vulnerabilities before installing it. The scanner checks for 14 security patterns across code and network categories.
# Scan a skill directory
npx tork-scan ./my-skill
# Full details for every finding
npx tork-scan ./my-skill --verbose
# JSON output for CI/CD
npx tork-scan ./my-skill --json
# Fail on any high or critical finding
npx tork-scan ./my-skill --strict
import { SkillScanner, generateBadge } from '@torknetwork/guardian';
const scanner = new SkillScanner();
const report = await scanner.scanSkill('./my-skill');
console.log(`Risk: ${report.riskScore}/100`);
console.log(`Verdict: ${report.verdict}`); // 'verified' | 'reviewed' | 'flagged'
See docs/SCANNER.md for the full rule reference, severity weights, and example output.
Skills that pass the security scanner receive a Tork Verified badge:
| Badge | Score | Meaning |
|---|---|---|
| Tork Verified (green) | 0 - 29 | Safe to install |
| Tork Reviewed (yellow) | 30 - 49 | Manual review recommended |
| Tork Flagged (red) | 50 - 100 | Security risks detected |
import { SkillScanner, generateBadge, generateBadgeMarkdown } from '@torknetwork/guardian';
const scanner = new SkillScanner();
const report = await scanner.scanSkill('./my-skill');
const badge = generateBadge(report);
// Add to your README
console.log(generateBadgeMarkdown(badge));
Sign up at tork.network to get your API key.
FAQs
AI governance and security layer for OpenClaw agents. Intentionally inspects AI agent traffic to detect PII leaks, policy violations, and dangerous tool calls.
We found that @torknetwork/guardian demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.