arch-lens-security
Skill1 starsChanged 8 months agoMITView on GitHub
Create Security architecture diagram showing trust boundaries, validation layers, and process isolation. Security lens answering "Where are the trust boundaries?
- Reads credentials
In this repository59 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- arch-lens-c4-containerSkill
- arch-lens-concurrencySkill
- arch-lens-data-lineageSkill
- arch-lens-deploymentSkill
- arch-lens-developmentSkill
- arch-lens-error-resilienceSkill
- arch-lens-module-dependencySkill
- arch-lens-operationalSkill
- arch-lens-process-flowSkill
- arch-lens-repository-accessSkill
- arch-lens-scenariosSkill
- arch-lens-state-lifecycleSkill
- audit-archSkill
- audit-bugsSkill
- audit-cohesionSkill
- audit-defense-standardsSkill
- audit-frictionSkill
- audit-implSkill
- audit-testsSkill
- design-guardsSkill
- dry-walkthroughSkill
- elaborate-phaseSkill
- exp-lens-benchmark-representativenessSkill
- exp-lens-causal-assumptionsSkill
- exp-lens-comparator-constructionSkill
- exp-lens-error-budgetSkill
- exp-lens-estimand-claritySkill
- exp-lens-exploratory-confirmatorySkill
- exp-lens-fair-comparisonSkill
- exp-lens-governance-riskSkill
- exp-lens-iterative-learningSkill
- exp-lens-measurement-validitySkill
- exp-lens-pipeline-integritySkill
- exp-lens-randomization-blockingSkill
- exp-lens-reproducibility-artifactsSkill
- exp-lens-sensitivity-robustnessSkill
- exp-lens-severity-testingSkill
- exp-lens-unit-interferenceSkill
- exp-lens-validity-threatsSkill
- exp-lens-variance-stabilitySkill
- id-slopSkill
- implement-worktreeSkill
- investigateSkill
- make-arch-diagSkill
- make-experiment-diagSkill
- make-groupsSkill
- make-planSkill
- make-reqSkill
- make-scenariosSkill
- mermaidSkill
- plan-arcSkill
- rectifySkill
- review-approachSkill
- update-architectureSkill
- update-reqsSkill
- update-specsSkill
- verify-diagSkill
- verify-proposed-diagSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Document path contracts and restrictions
- Very specific: line 38
BEFORE creating any diagram, LOAD the /mermaid skill using the Skill tool - this is MANDATORY
- Distinctive: line 51
Look for: validate, sanitize, clean, escape, input validation
- Distinctive: line 56
Look for: path, traversal, .., forbidden, whitelist, blacklist
- Distinctive: line 61
Look for: subprocess, Popen, timeout, isolation, sandbox
- Distinctive: line 66
Look for: auth, permission, token, API key, credential
- Very specific: line 71
Look for: secret, API_KEY, credential, .env, gitignore
- Distinctive: line 76
Look for: write_zone, allowed_paths, snapshot, file_change
- Distinctive: line 81
Look for: isolation, tenant, scope, multi-tenancy
- Very specific: line 139
Write the diagram to: temp/arch-lens-security/arch_diag_security_{YYYY-MM-DD_HHMMSS}.md
- Distinctive: line 245
Before creating the diagram, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Security Architecture Lens
Cognitive Mode: Security Primary Question: "Where are the trust boundaries?" Focus: Trust Boundaries, Validation Layers, Path Contracts, Process Isolation
When to Use
- Need to understand security architecture
- Documenting trust boundaries and validation
- Analyzing path contracts and isolation
- User invokes
/arch-lens-securityor/make-arch-diag security
Critical Constraints
NEVER:
- Modify any source code files
- Expose actual secrets or credentials
- Show implementation details that could aid attacks
ALWAYS:
- Focus on TRUST BOUNDARIES
- Show validation layers in order
- Document path contracts and restrictions
- Include process isolation mechanisms
- BEFORE creating any diagram, LOAD the
/mermaidskill using the Skill tool - this is MANDATORY
Analysis Workflow
Step 1: Launch Parallel Exploration Subagents
Spawn Explore subagents to investigate:
Input Validation
- Find input validation code
- Identify sanitization patterns
- Look for: validate, sanitize, clean, escape, input validation
Path Security
- Find path validation/restriction code
- Identify forbidden patterns
- Look for: path, traversal, .., forbidden, whitelist, blacklist
Process Boundaries
- Find subprocess/isolation code
- Identify timeouts and guards
- Look for: subprocess, Popen, timeout, isolation, sandbox
Authentication/Authorization
- Find auth-related code
- Identify permission checks
- Look for: auth, permission, token, API key, credential
Secret Management
- Find secret handling
- Identify env var usage
- Look for: secret, API_KEY, credential, .env, gitignore
File System Security
- Find file access controls
- Identify write zone restrictions
- Look for: write_zone, allowed_paths, snapshot, file_change
Database Isolation
- Find database access controls
- Identify per-user/per-tenant isolation
- Look for: isolation, tenant, scope, multi-tenancy
Step 2: Map Trust Boundaries
Identify boundaries where trust changes:
- External -> Application (user input)
- Application -> Subprocess (code execution)
- Application -> FileSystem (file access)
- Application -> Database (data access)
- Application -> External API (outbound)
CRITICAL - Analyze Read/Write Direction: For EVERY trust boundary crossing:
- Inbound (reads): Data entering from less trusted to more trusted
- Outbound (writes): Data leaving from more trusted to less trusted
- Validation point: Where is data validated and in which direction?
Security implications by direction:
- Reads from untrusted: Requires input validation
- Writes to untrusted: Requires output encoding/sanitization
- Reads from trusted storage: Generally safe
- Writes to trusted storage: Requires authorization check
Step 3: Document Validation Layers
For each trust boundary:
- What is validated?
- How are violations handled?
- What's the defense-in-depth strategy?
Step 4: Create the Diagram
Use flowchart with:
Direction: TB for layered security view
Subgraphs per Trust Boundary:
- Entry (CLI/API input)
- Subprocess Boundary
- FileSystem Boundary
- Path Contract
- Write Zone Enforcement
- Database Isolation
Node Styling:
cliclass: Entry points, user inputdetectorclass: Validation gates, guardsphaseclass: Processing after validationgapclass: Forbidden/restricted (yellow warning)stateNodeclass: Enforcement pointsoutputclass: Isolated resources
Show Flow Through Boundaries:
- Sequential validation layers
- What passes vs what's blocked
Step 5: Write Output
Write the diagram to: temp/arch-lens-security/arch_diag_security_{YYYY-MM-DD_HHMMSS}.md
Output Template
# Security Diagram: {System Name}
**Lens:** Security (Trust Boundaries)
**Question:** Where are the trust boundaries?
**Date:** {YYYY-MM-DD}
**Scope:** {What was analyzed}
## Trust Boundaries Overview
| Boundary | Validation | Threat Mitigated |
|----------|------------|------------------|
| {boundary} | {validation} | {threat} |
## Security Diagram
```mermaid
%%{init: {'flowchart': {'nodeSpacing': 40, 'rankSpacing': 50, 'curve': 'basis'}}}%%
flowchart TB
%% CLASS DEFINITIONS %%
classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;
classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef gap fill:#ff6f00,stroke:#ffa726,stroke-width:2px,color:#000;
subgraph Boundary1 ["TRUST BOUNDARY 1: Entry"]
INPUT["User Input<br/>━━━━━━━━━━<br/>Untrusted"]
VALIDATE["Validation<br/>━━━━━━━━━━<br/>Check input"]
end
subgraph Boundary2 ["TRUST BOUNDARY 2: Subprocess"]
PRECHECK["Pre-flight Check<br/>━━━━━━━━━━<br/>Limits check"]
SUBPROCESS["Subprocess<br/>━━━━━━━━━━<br/>Isolated execution"]
GUARD["Process Guard<br/>━━━━━━━━━━<br/>Timeout, cleanup"]
end
subgraph PathContract ["PATH CONTRACT"]
FORBIDDEN["Forbidden Patterns<br/>━━━━━━━━━━<br/>credentials, .pem"]
TRAVERSAL["Traversal Check<br/>━━━━━━━━━━<br/>No '..' allowed"]
WHITELIST["Directory Whitelist<br/>━━━━━━━━━━<br/>Allowed paths"]
end
subgraph WriteZone ["WRITE ZONE ENFORCEMENT"]
ZONE["Write Zone<br/>━━━━━━━━━━<br/>Restricted area"]
end
%% FLOW %%
INPUT --> VALIDATE
VALIDATE --> PRECHECK
PRECHECK --> SUBPROCESS
SUBPROCESS --> GUARD
GUARD --> FORBIDDEN
FORBIDDEN --> TRAVERSAL
TRAVERSAL --> WHITELIST
WHITELIST --> ZONE
%% CLASS ASSIGNMENTS %%
class INPUT cli;
class VALIDATE,PRECHECK,GUARD detector;
class SUBPROCESS phase;
class FORBIDDEN,TRAVERSAL gap;
class WHITELIST stateNode;
class ZONE output;Color Legend:
| Color | Category | Description |
| Dark Blue | Entry | Untrusted input |
| Red | Validation | Validation gates and guards |
| Purple | Process | Isolated execution |
| Yellow | Restricted | Forbidden patterns |
| Teal | Enforcement | Whitelist, allowed |
| Dark Teal | Zone | Protected resources |
Security Validation Layers
| Layer | Component | Threat Mitigated |
| 1 | {component} | {threat} |
| 2 | {component} | {threat} |
Path Contract Rules
| Rule | Description |
| Forbidden Patterns | {patterns} |
| Traversal Prevention | {how} |
| Whitelist | {allowed dirs} |
---
## Pre-Diagram Checklist
Before creating the diagram, verify:
- [ ] LOADED `/mermaid` skill using the Skill tool
- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)
- [ ] Diagram will include a color legend table
---
## Related Skills
- `/make-arch-diag` - Parent skill for lens selection
- `/mermaid` - MUST BE LOADED before creating diagram
- `/arch-lens-error-resilience` - For error handling view
- `/audit-arch` - For security violation detectionDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

