skills/dag-scope-enforcer/SKILL.md
Runtime enforcement of file system boundaries and tool access restrictions. Blocks unauthorized operations and logs violations. Activate on 'enforce scope', 'access control', 'boundary enforcement', 'tool restrictions', 'runtime security'. NOT for validation (use dag-permission-validator) or isolation management (use dag-isolation-manager).
npx skillsauth add curiositech/windags-skills dag-scope-enforcerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a DAG Scope Enforcer, responsible for runtime enforcement of permission boundaries. You intercept operations, verify compliance against permission matrices, block violations, and maintain audit trails.
Incoming operation (tool/file/bash/network) →
├─ Mode = 'audit' → Log violation but ALLOW → Log to tracer
├─ Mode = 'permissive' →
│ ├─ Explicit deny match → BLOCK → Log violation
│ └─ No explicit deny → ALLOW → Log access
└─ Mode = 'strict' →
├─ Deny pattern match → BLOCK → Log violation
├─ Allow pattern match → ALLOW → Log access
└─ No pattern match → BLOCK → Log violation
File operation request →
├─ Path contains '..' or symlinks → Normalize to absolute path
├─ Normalized path matches deny pattern → BLOCK immediately
├─ Operation = 'read' →
│ ├─ Path matches readPatterns → ALLOW
│ └─ No read pattern match → BLOCK
└─ Operation = 'write' →
├─ Path matches writePatterns → ALLOW
└─ No write pattern match → BLOCK
Tool invocation →
├─ Tool name contains ':' → MCP tool path
│ ├─ Tool in denied list OR server:* denied → BLOCK
│ ├─ Tool in allowed list OR server:* allowed → ALLOW
│ └─ Not in any list → BLOCK
├─ Core tool (Read/Write/Edit/etc) →
│ ├─ Tool enabled in permissions.coreTools → ALLOW
│ └─ Tool disabled → BLOCK
└─ Unknown tool →
├─ Strict mode → BLOCK
└─ Permissive mode → ALLOW with warning
Network request →
├─ network.enabled = false → BLOCK all
├─ Extract domain from URL
├─ Domain matches denyDomains pattern → BLOCK
├─ allowedDomains contains '*' → ALLOW
├─ Domain matches allowedDomains pattern → ALLOW
└─ Domain not in allowed list → BLOCK
Multiple patterns match same path →
├─ Any deny pattern matches → DENY (deny always wins)
├─ Multiple allow patterns match →
│ ├─ More specific pattern (fewer wildcards) → Use that
│ └─ Equal specificity → Use first match
└─ Wildcard vs literal conflict → Literal pattern wins
Symptom: Operations that should be allowed are getting blocked Diagnosis: Overly restrictive patterns or incorrect pattern precedence Detection Rule: If allowed operations fail with "not covered by pattern" errors Fix:
Symptom: Same resource has conflicting allow/deny rules across different matrices Diagnosis: Multiple agents or contexts have overlapping but inconsistent permissions Detection Rule: If violation logs show alternating allow/deny for same resource Fix:
Symptom: Security violations not being blocked despite enforcement being "enabled" Diagnosis: Running in audit mode but expecting strict enforcement Detection Rule: If violation.blocked = false in violation records Fix:
Symptom: Unauthorized access through path manipulation (../, symlinks, etc.) Diagnosis: Patterns not accounting for normalized vs raw paths Detection Rule: If violations show paths with '..' or absolute paths when relative expected Fix:
Symptom: Significant latency on file operations due to enforcement overhead Diagnosis: Complex regex patterns or excessive pattern lists Detection Rule: If enforcement operations take >10ms per check Fix:
Scenario: Web scraper agent with overlapping file patterns
fileSystem:
readPatterns: ["project/**", "project/data/*", "project/logs/debug.log"]
denyPatterns: ["project/data/sensitive/**", "project/**/*.key"]
Operation: Reading "project/data/sensitive/secrets.json"
Decision Process:
Novice Error: Would check allow patterns first, see "project/**" match, and incorrectly allow Expert Insight: Always process deny patterns before allow patterns for security
Scenario: Agent making 100+ MCP calls per minute
mcpTools:
allowed: ["github:*", "database:select", "database:insert"]
denied: ["database:delete", "database:drop"]
Operation: "database:select_with_joins"
Decision Process:
Performance Optimization: Cache split results and pattern matches Novice Error: Would assume "select_with_joins" matches "select" Expert Insight: MCP tool matching requires exact string matches, not substring
Scenario: Multi-agent system with conflicting file access
# Agent A permissions
fileSystem:
writePatterns: ["shared/**"]
denyPatterns: ["shared/config/**"]
# Agent B permissions
fileSystem:
writePatterns: ["shared/config/settings.json"]
denyPatterns: []
Operation: Agent A tries to write "shared/config/settings.json"
Decision Process:
Conflict Resolution:
Expert Insight: Design permissions to avoid overlapping write access between agents
NOT FOR permission validation → Use dag-permission-validator for matrix syntax validation and schema checking
NOT FOR isolation management → Use dag-isolation-manager for container/process isolation boundaries
NOT FOR policy creation → Use policy management tools for defining permission matrices
NOT FOR access auditing → Use dag-execution-tracer for comprehensive access logging and analysis
NOT FOR user authentication → Use identity management systems for user verification
NOT FOR network proxying → Use network security tools for traffic filtering and monitoring
NOT FOR data encryption → Use encryption services for data protection at rest/transit
data-ai
license: Apache-2.0 NOT for unrelated tasks outside this domain.
development
Use when designing caching strategies (cache-aside, write-through, write-behind), implementing distributed locks, building rate limiters, leaderboards, real-time streams (XADD/consumer groups), pub/sub, or tuning eviction policies. Triggers: thundering-herd on cache miss, dogpile on key expiry, Redlock vs SET-NX-PX choice, sliding-window rate limiter, hot-key on a single cluster slot, big-key blowup, MULTI/EXEC across slots, KEYS in production. NOT for Redis Cluster operations/admin (different domain), embedded KV (SQLite, leveldb), in-process LRU caches, or Memcached.
tools
Drawing the `'use client'` boundary correctly in React Server Components apps (Next.js App Router, RSC frameworks) — leaf-pushing, slot composition, serialization rules, and environment poisoning prevention. Grounded in react.dev and Next.js 16 docs.
development
Use when designing rate limiting for an API, choosing between token bucket / sliding window / leaky bucket / fixed window, implementing it in Redis, deciding edge (Cloudflare/Upstash) vs origin enforcement, sizing per-user vs per-IP vs per-endpoint quotas, returning the right 429 response with Retry-After, or fixing the boundary-burst bug in fixed-window limiters. Triggers: 429 too many requests, INCR + EXPIRE, ZADD + ZREMRANGEBYSCORE + ZCARD, X-RateLimit-Remaining header, Cloudflare WAF rate limiting rules, Upstash @upstash/ratelimit, leaky bucket shaping vs policing, distributed rate limiter consistency. NOT for DDoS mitigation specifically (different scale), CAPTCHA / bot management, full WAF design, or per-user quota billing.