Security Ownership Map
Build a bipartite graph of people and files from git history to compute ownership risk, detect orphaned security-critical code, and identify bus factor hotspots.
Overview
This skill analyzes git repositories to answer critical security ownership questions:
- Who owns the security-sensitive code? Map people to auth, crypto, and secrets-related files
- What is the bus factor? Identify files with dangerously low contributor diversity
- Where is orphaned code? Find sensitive code that hasn't been touched recently
- How do files cluster? Build co-change graphs to understand code movement patterns
Workflow
1. Scope the Repository
- Define the repo root and any in-scope paths
- Set time window with
--since / --until parameters
- Decide sensitivity rules (defaults flag auth/crypto/secret paths)
2. Build the Ownership Map
python run_ownership_map.py \
--repo . \
--out ownership-map-out \
--since "12 months ago" \
--emit-commits
3. Query Security Findings
# Orphaned sensitive code (stale + low bus factor)
python query_ownership.py --data-dir ownership-map-out summary --section orphaned_sensitive_code
# Hidden owners for sensitive tags
python query_ownership.py --data-dir ownership-map-out summary --section hidden_owners
# Sensitive hotspots with low bus factor
python query_ownership.py --data-dir ownership-map-out summary --section bus_factor_hotspots
# Auth/crypto files with bus factor <= 1
python query_ownership.py --data-dir ownership-map-out files --tag auth --bus-factor-max 1
Output Artifacts
The analysis produces:
people.csv — Nodes: people with timezone detection
files.csv — Nodes: files with sensitivity tags
edges.csv — Edges: touch relationships
cochange_edges.csv — File-to-file co-change edges with Jaccard weight
summary.json — Security ownership findings
communities.json — Code community clusters with maintainers
Sensitivity Rules
Default rules flag common sensitive paths:
# pattern,tag,weight
**/auth/**,auth,1.0
**/crypto/**,crypto,1.0
**/*.pem,secrets,1.0
**/middleware/auth*,auth,1.0
**/password*,auth,0.8
Override with --sensitive-config path/to/sensitive.csv.
Key Security Queries
- Bus factor hotspots — Files with bus_factor <= 1 that handle auth/crypto
- Orphaned code — Sensitive files not touched in 6+ months
- Hidden owners — Developers who silently control large portions of sensitive code
- Ownership drift — Compare against CODEOWNERS to highlight discrepancies
Best Practices
- Run quarterly to track ownership changes
- Compare against CODEOWNERS for drift detection
- Filter bots with
--ignore-author-regex '(bot|dependabot)'
- Use
--window-days 90 to smooth churn effects
- Export to Neo4j/Gephi for visual analysis
1---2name: security-ownership-map3description: "Analyze git repositories to build security ownership topology, compute bus factor for sensitive code, detect orphaned security-critical files, and export ownership graphs for visualization."4version: 1.0.05author: openai6license: MIT7tags: [security, ownership, bus-factor, git-analysis, code-ownership]8testingTypes: [security]9frameworks: []10languages: [python, typescript, go]11domains: [backend, infrastructure, devops]12agents: [claude-code, cursor, github-copilot, windsurf, codex, aider, continue, cline, zed, bolt]13metadata:14 source: https://skillmd.com/skills/pramoddutta/security-ownership-map15---1617# Security Ownership Map1819Build a bipartite graph of people and files from git history to compute ownership risk, detect orphaned security-critical code, and identify bus factor hotspots.2021## Overview2223This skill analyzes git repositories to answer critical security ownership questions:2425- **Who owns the security-sensitive code?** Map people to auth, crypto, and secrets-related files26- **What is the bus factor?** Identify files with dangerously low contributor diversity27- **Where is orphaned code?** Find sensitive code that hasn't been touched recently28- **How do files cluster?** Build co-change graphs to understand code movement patterns2930## Workflow3132### 1. Scope the Repository3334- Define the repo root and any in-scope paths35- Set time window with `--since` / `--until` parameters36- Decide sensitivity rules (defaults flag auth/crypto/secret paths)3738### 2. Build the Ownership Map3940```bash41python run_ownership_map.py \42 --repo . \43 --out ownership-map-out \44 --since "12 months ago" \45 --emit-commits46```4748### 3. Query Security Findings4950```bash51# Orphaned sensitive code (stale + low bus factor)52python query_ownership.py --data-dir ownership-map-out summary --section orphaned_sensitive_code5354# Hidden owners for sensitive tags55python query_ownership.py --data-dir ownership-map-out summary --section hidden_owners5657# Sensitive hotspots with low bus factor58python query_ownership.py --data-dir ownership-map-out summary --section bus_factor_hotspots5960# Auth/crypto files with bus factor <= 161python query_ownership.py --data-dir ownership-map-out files --tag auth --bus-factor-max 162```6364## Output Artifacts6566The analysis produces:6768- `people.csv` — Nodes: people with timezone detection69- `files.csv` — Nodes: files with sensitivity tags70- `edges.csv` — Edges: touch relationships71- `cochange_edges.csv` — File-to-file co-change edges with Jaccard weight72- `summary.json` — Security ownership findings73- `communities.json` — Code community clusters with maintainers7475## Sensitivity Rules7677Default rules flag common sensitive paths:7879```csv80# pattern,tag,weight81**/auth/**,auth,1.082**/crypto/**,crypto,1.083**/*.pem,secrets,1.084**/middleware/auth*,auth,1.085**/password*,auth,0.886```8788Override with `--sensitive-config path/to/sensitive.csv`.8990## Key Security Queries91921. **Bus factor hotspots** — Files with bus_factor <= 1 that handle auth/crypto932. **Orphaned code** — Sensitive files not touched in 6+ months943. **Hidden owners** — Developers who silently control large portions of sensitive code954. **Ownership drift** — Compare against CODEOWNERS to highlight discrepancies9697## Best Practices9899- Run quarterly to track ownership changes100- Compare against CODEOWNERS for drift detection101- Filter bots with `--ignore-author-regex '(bot|dependabot)'`102- Use `--window-days 90` to smooth churn effects103- Export to Neo4j/Gephi for visual analysis