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
tools
Building resilient distributed systems with circuit breakers, retries with full-jitter exponential backoff, retry budgets (per-request 3-attempt + per-client 10% ratio per Google SRE), deadline propagation, and the cascading-failure math (4 layers × 3 retries = 64x amplification). Grounded in Resilience4j, Microsoft Cloud Patterns, AWS Architecture Blog (Marc Brooker), and Google SRE Book.
testing
Designing HTTP cache headers that work correctly across browsers, CDNs, and shared proxies — `Cache-Control` directives per RFC 9111, `stale-while-revalidate` and `stale-if-error` per RFC 5861, the Vary header for varying responses, and surrogate keys for tag-based purging. Grounded in IETF RFCs and Cloudflare/Fastly docs.
development
Use when designing or fixing a Content Security Policy on a real site, choosing between nonce-based and hash-based CSP, adding strict-dynamic, debugging "Refused to execute inline script" errors, deploying CSP in report-only mode first, configuring report-to / report-uri, or auditing an existing policy for unsafe-inline / unsafe-eval / wildcards. Triggers: "CSP blocks legitimate inline script", strict-dynamic, nonce-{RANDOM}, sha256-{HASH}, object-src none, base-uri none, frame-ancestors, Trusted Types, X-Content-Security-Policy obsolete, report-only vs enforced. NOT for general HTTP security headers (HSTS, COOP/COEP), Trusted Types deep dive, CORS configuration, or building a WAF.
tools
Choosing and operating an HTTP API versioning strategy that doesn't break clients — Stripe's date-based pinned versions, the Deprecation/Sunset header pair (RFC 9745 + RFC 8594), URI vs header vs media-type approaches, and the version-transformer pattern. Grounded in Stripe's published architecture and IETF RFCs.