Data Flow Mapping
Trace how data moves through the application from input to storage to output.
Identify trust boundary crossings, encryption/decryption points, serialization
steps, and data transformation operations. Produces annotated data flow maps
with security observations at each transition.
Supported Flags
Read ../../shared/schemas/flags.md for the full flag specification.
| Flag |
Data Flow Behavior |
--scope |
Default full. Data flow mapping requires broad visibility. Narrow scopes trace only flows touching scoped files. |
--depth quick |
Entry points and data stores only, no intermediate tracing. |
--depth standard |
Trace major data paths from input through processing to storage/output. |
--depth deep |
Full taint analysis: every transformation, validation, and boundary crossing. |
--depth expert |
Deep + annotate with threat categories, identify covert channels, DREAD scoring on flow weaknesses. |
--format |
Default text. Use md for Mermaid diagrams, json for structured flow graph. |
Workflow
Step 1: Determine Scope
- Parse
--scope flag. Default to full for comprehensive flow mapping.
- Resolve to a concrete file list.
- Prioritize: HTTP handlers, database access layers, external service clients,
message queue producers/consumers, file I/O operations, cache layers,
serialization/deserialization code, encryption modules.
Step 2: Identify Data Sources (Origins)
Catalog every point where data enters the system:
| Source Type |
What to Look For |
| HTTP requests |
Request body, query params, headers, cookies, path params, uploaded files |
| Database reads |
Queries returning user data, config data, or cached content |
| External APIs |
Responses from third-party services, webhook payloads |
| Message queues |
Consumed messages from Kafka, RabbitMQ, SQS, etc. |
| File system |
File reads, config loading, uploaded file processing |
| Environment |
Environment variables, secrets managers, config services |
| User sessions |
Session data, cached user state |
Step 3: Identify Data Sinks (Destinations)
Catalog every point where data exits or is persisted:
| Sink Type |
What to Look For |
| Database writes |
INSERT, UPDATE, ORM save/create operations |
| HTTP responses |
Response body, headers, cookies set |
| External APIs |
Requests to third-party services |
| Message queues |
Published messages |
| File system |
File writes, log files, exported data |
| Logs |
Application logs, audit logs, error tracking |
| Browser |
Rendered HTML, JavaScript context, DOM injection points |
| Email/SMS |
Outbound notification content |
Step 4: Trace Data Paths
For each source, trace data through the codebase to its sinks:
- Follow the variable: Track the request parameter/input through function
calls, assignments, and returns.
- Map transformations: Record every operation applied to the data:
- Validation (type checks, regex, allowlists)
- Sanitization (HTML escaping, SQL parameterization, encoding)
- Encryption/Decryption (note algorithm and key source)
- Serialization/Deserialization (JSON parse, protobuf, pickle)
- Aggregation (data combined with other sources)
- Redaction (fields stripped or masked)
- Mark trust boundaries: Note when data crosses between:
- External network to application
- Application to database
- Application to external service
- Frontend to backend
- Service to service (in microservices)
- User space to privileged operations
Step 5: Annotate Security Properties
At each node in the data flow, annotate:
| Property |
Values |
| Encrypted |
In transit (TLS), at rest (AES/etc.), both, neither |
| Validated |
Yes (with method), no, partial |
| Sanitized |
Yes (with method), no |
| Logged |
Yes (check for sensitive data in logs), no |
| Access controlled |
Auth required, role checked, none |
| PII/Sensitive |
Contains PII, financial, health, credentials, or other sensitive data |
Step 6: Identify Flow Weaknesses
Flag security concerns at data flow transitions:
- Missing validation: Data crosses a trust boundary without validation.
- Missing encryption: Sensitive data transmitted or stored without encryption.
- Sensitive data in logs: PII, credentials, or tokens written to log sinks.
- Deserialization of untrusted data:
pickle.loads, JSON.parse on unvalidated
external input without schema validation, ObjectInputStream on network data.
- Trust boundary violations: Internal-only data exposed to external sinks.
- Missing sanitization before output: Data from untrusted source rendered in
HTML, SQL, or shell command without appropriate encoding.
- Data retention issues: Sensitive data persisted longer than necessary or
without deletion mechanisms.
- Implicit trust: Data from one service consumed by another without re-validation.
Step 7: Generate Flow Diagrams
Produce Mermaid data flow diagrams:
graph LR
subgraph External
User[User Browser]
ExtAPI[Payment API]
end
subgraph Application
API[API Handler]
Valid[Validator]
Logic[Business Logic]
Encrypt[Encryption Layer]
end
subgraph Storage
DB[(Database)]
Cache[(Redis Cache)]
end
User -->|HTTPS, JSON body| API
API -->|raw input| Valid
Valid -->|validated data| Logic
Logic -->|PII: encrypted| Encrypt
Encrypt -->|ciphertext| DB
Logic -->|session token| Cache
Logic -->|payment request, TLS| ExtAPI
Annotate edges with: protocol, encryption status, data sensitivity level.
Step 8: Report
Output the data flow map with security annotations and any findings.
Output Format
This skill produces a data flow map plus findings for flow weaknesses.
Finding ID prefix: FLOW (e.g., FLOW-001).
## Data Flow Analysis
### Summary
- Data sources identified: N
- Data sinks identified: N
- Trust boundary crossings: N
- Unvalidated crossings: N
- Sensitive data flows: N
### Data Flow Diagram
[Mermaid diagram]
### Flow Inventory
| # | Source | Path | Sink | Sensitivity | Encrypted | Validated | Issue |
|---|--------|------|------|-------------|-----------|-----------|-------|
| 1 | POST /api/login | -> auth.verify -> db.query | users table | Credentials | TLS only | Yes | None |
| 2 | POST /api/upload | -> fileHandler -> fs.write | /uploads/ | User files | No | No | FLOW-001 |
### Trust Boundary Crossings
[Table of all boundary crossings with security annotations]
### Findings
[Standard findings for flow weaknesses]
Findings follow ../../shared/schemas/findings.md with:
metadata.tool: "data-flows"
references.cwe: CWE-319 (Cleartext Transmission), CWE-312 (Cleartext Storage),
CWE-532 (Info Exposure Through Log), CWE-502 (Deserialization of Untrusted Data)
Pragmatism Notes
- Not every data path needs encryption. Public data served over HTTPS is fine.
- Internal service-to-service calls over a trusted network or service mesh are
lower priority than internet-facing flows.
- Focus on sensitive data flows first: credentials, PII, financial data, health data.
- Log redaction is important but severity depends on log access controls.
- At
--depth quick, a high-level source-to-sink map is more useful than
exhaustive intermediate tracing.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: florianbuetow-claude-code-data-flows3description: Data Flow Mapping4---56# Data Flow Mapping78Trace how data moves through the application from input to storage to output.9Identify trust boundary crossings, encryption/decryption points, serialization10steps, and data transformation operations. Produces annotated data flow maps11with security observations at each transition.1213## Supported Flags1415Read `../../shared/schemas/flags.md` for the full flag specification.1617| Flag | Data Flow Behavior |18|------|--------------------|19| `--scope` | Default `full`. Data flow mapping requires broad visibility. Narrow scopes trace only flows touching scoped files. |20| `--depth quick` | Entry points and data stores only, no intermediate tracing. |21| `--depth standard` | Trace major data paths from input through processing to storage/output. |22| `--depth deep` | Full taint analysis: every transformation, validation, and boundary crossing. |23| `--depth expert` | Deep + annotate with threat categories, identify covert channels, DREAD scoring on flow weaknesses. |24| `--format` | Default `text`. Use `md` for Mermaid diagrams, `json` for structured flow graph. |2526## Workflow2728### Step 1: Determine Scope29301. Parse `--scope` flag. Default to `full` for comprehensive flow mapping.312. Resolve to a concrete file list.323. Prioritize: HTTP handlers, database access layers, external service clients,33 message queue producers/consumers, file I/O operations, cache layers,34 serialization/deserialization code, encryption modules.3536### Step 2: Identify Data Sources (Origins)3738Catalog every point where data enters the system:3940| Source Type | What to Look For |41|-------------|-----------------|42| HTTP requests | Request body, query params, headers, cookies, path params, uploaded files |43| Database reads | Queries returning user data, config data, or cached content |44| External APIs | Responses from third-party services, webhook payloads |45| Message queues | Consumed messages from Kafka, RabbitMQ, SQS, etc. |46| File system | File reads, config loading, uploaded file processing |47| Environment | Environment variables, secrets managers, config services |48| User sessions | Session data, cached user state |4950### Step 3: Identify Data Sinks (Destinations)5152Catalog every point where data exits or is persisted:5354| Sink Type | What to Look For |55|-----------|-----------------|56| Database writes | INSERT, UPDATE, ORM save/create operations |57| HTTP responses | Response body, headers, cookies set |58| External APIs | Requests to third-party services |59| Message queues | Published messages |60| File system | File writes, log files, exported data |61| Logs | Application logs, audit logs, error tracking |62| Browser | Rendered HTML, JavaScript context, DOM injection points |63| Email/SMS | Outbound notification content |6465### Step 4: Trace Data Paths6667For each source, trace data through the codebase to its sinks:68691. **Follow the variable**: Track the request parameter/input through function70 calls, assignments, and returns.712. **Map transformations**: Record every operation applied to the data:72 - Validation (type checks, regex, allowlists)73 - Sanitization (HTML escaping, SQL parameterization, encoding)74 - Encryption/Decryption (note algorithm and key source)75 - Serialization/Deserialization (JSON parse, protobuf, pickle)76 - Aggregation (data combined with other sources)77 - Redaction (fields stripped or masked)783. **Mark trust boundaries**: Note when data crosses between:79 - External network to application80 - Application to database81 - Application to external service82 - Frontend to backend83 - Service to service (in microservices)84 - User space to privileged operations8586### Step 5: Annotate Security Properties8788At each node in the data flow, annotate:8990| Property | Values |91|----------|--------|92| **Encrypted** | In transit (TLS), at rest (AES/etc.), both, neither |93| **Validated** | Yes (with method), no, partial |94| **Sanitized** | Yes (with method), no |95| **Logged** | Yes (check for sensitive data in logs), no |96| **Access controlled** | Auth required, role checked, none |97| **PII/Sensitive** | Contains PII, financial, health, credentials, or other sensitive data |9899### Step 6: Identify Flow Weaknesses100101Flag security concerns at data flow transitions:1021031. **Missing validation**: Data crosses a trust boundary without validation.1042. **Missing encryption**: Sensitive data transmitted or stored without encryption.1053. **Sensitive data in logs**: PII, credentials, or tokens written to log sinks.1064. **Deserialization of untrusted data**: `pickle.loads`, `JSON.parse` on unvalidated107 external input without schema validation, `ObjectInputStream` on network data.1085. **Trust boundary violations**: Internal-only data exposed to external sinks.1096. **Missing sanitization before output**: Data from untrusted source rendered in110 HTML, SQL, or shell command without appropriate encoding.1117. **Data retention issues**: Sensitive data persisted longer than necessary or112 without deletion mechanisms.1138. **Implicit trust**: Data from one service consumed by another without re-validation.114115### Step 7: Generate Flow Diagrams116117Produce Mermaid data flow diagrams:118119```mermaid120graph LR121 subgraph External122 User[User Browser]123 ExtAPI[Payment API]124 end125 subgraph Application126 API[API Handler]127 Valid[Validator]128 Logic[Business Logic]129 Encrypt[Encryption Layer]130 end131 subgraph Storage132 DB[(Database)]133 Cache[(Redis Cache)]134 end135136 User -->|HTTPS, JSON body| API137 API -->|raw input| Valid138 Valid -->|validated data| Logic139 Logic -->|PII: encrypted| Encrypt140 Encrypt -->|ciphertext| DB141 Logic -->|session token| Cache142 Logic -->|payment request, TLS| ExtAPI143```144145Annotate edges with: protocol, encryption status, data sensitivity level.146147### Step 8: Report148149Output the data flow map with security annotations and any findings.150151## Output Format152153This skill produces a **data flow map** plus findings for flow weaknesses.154155Finding ID prefix: **FLOW** (e.g., `FLOW-001`).156157```158## Data Flow Analysis159160### Summary161- Data sources identified: N162- Data sinks identified: N163- Trust boundary crossings: N164- Unvalidated crossings: N165- Sensitive data flows: N166167### Data Flow Diagram168[Mermaid diagram]169170### Flow Inventory171172| # | Source | Path | Sink | Sensitivity | Encrypted | Validated | Issue |173|---|--------|------|------|-------------|-----------|-----------|-------|174| 1 | POST /api/login | -> auth.verify -> db.query | users table | Credentials | TLS only | Yes | None |175| 2 | POST /api/upload | -> fileHandler -> fs.write | /uploads/ | User files | No | No | FLOW-001 |176177### Trust Boundary Crossings178[Table of all boundary crossings with security annotations]179180### Findings181[Standard findings for flow weaknesses]182```183184Findings follow `../../shared/schemas/findings.md` with:185- `metadata.tool`: `"data-flows"`186- `references.cwe`: `CWE-319` (Cleartext Transmission), `CWE-312` (Cleartext Storage),187 `CWE-532` (Info Exposure Through Log), `CWE-502` (Deserialization of Untrusted Data)188189## Pragmatism Notes190191- Not every data path needs encryption. Public data served over HTTPS is fine.192- Internal service-to-service calls over a trusted network or service mesh are193 lower priority than internet-facing flows.194- Focus on sensitive data flows first: credentials, PII, financial data, health data.195- Log redaction is important but severity depends on log access controls.196- At `--depth quick`, a high-level source-to-sink map is more useful than197 exhaustive intermediate tracing.198199---200> Converted and distributed by [TomeVault](https://tomevault.io/claim/florianbuetow) — claim your Tome and manage your conversions.201<!-- tomevault:4.0:skill_md:2026-04-13 -->