9t29zhmwdh-coder/entra-access-graph-engine
GitHub: 9t29zhmwdh-coder/entra-access-graph-engine
将 Entra ID 对象映射为权限有向图,检测特权提升路径并生成可视化风险报告的安全审计工具。
Stars: 0 | Forks: 0
entra-access-graph-engine
**将每一个 Entra ID 对象映射到权限图。检测提权路径、隐藏的管理员链以及风险评分。基于 Rust 开发,离线优先,支持 OTLP。**
从 Microsoft Graph API 获取 Users、Groups、Roles、Applications、Service Principals、AppRoleAssignments 和 DirectoryRoles,并构建有向访问图。该图引擎能够检测特权提升路径、隐藏的管理员链(App → SP → Group → GlobalAdmin),并按风险等级(低 / 中 / 高 / 严重)对每个节点和路径进行分类。支持导出为 JSON、GraphML 或带有交互式 D3.js 力导向图的自包含 HTML 报告。
[](https://github.com/9t29zhmwdh-coder/entra-access-graph-engine/actions)     
## 功能
| 功能 | 描述 |
|---|---|
| 完整的 Entra ID 覆盖 | Users、Groups、DirectoryRoles、Applications、ServicePrincipals、AppRoleAssignments、OAuthPermissionGrants |
| 特权链检测 | 从每个高风险节点进行最大深度为 6 的 BFS,查找所有提权路径 |
| 风险评分 | 将已知的角色模板 ID 和 Graph API 权限名称映射为 严重 / 高 / 中 / 低 |
| 三种导出格式 | JSON(机器可读)、GraphML(Gephi / yEd)、带有交互式 D3.js 力导向图的 HTML |
| 每周扫描 Action | 使用 GitHub Actions 工作流生成定期的风险报告,并作为 artifacts 上传 |
| Dry-run 模式 | `--dry-run` 使用内置的模拟图,无需 Azure 凭据即可用于 CI 和演示 |
| Workspace crate 布局 | `eagraph-core`(库)+ `eagraph-cli`(二进制文件) |
## 风险等级
| 等级 | 示例 |
|---|---|
| 严重 | Global Administrator、Privileged Role Administrator、具有 `RoleManagement.ReadWrite.Directory` 的应用 |
| 高 | Application Administrator、User Administrator、Exchange Administrator、具有 `User.ReadWrite.All` 的应用 |
| 中 | 所有其他目录角色 |
| 低 | Users、Groups、没有已知高风险权限的应用 |
## 环境要求
- Rust 1.78+
- Azure App Registration,并具有 **Application**(非委托)权限:`Directory.Read.All`、`RoleManagement.Read.Directory`、`Application.Read.All`
## 快速开始
```
git clone https://github.com/9t29zhmwdh-coder/entra-access-graph-engine.git
cd entra-access-graph-engine
cargo build --release
# 无 Azure credentials 测试
./target/release/eagraph scan --dry-run --format html --output report
# 实时扫描
export AZURE_TENANT_ID=your-tenant-id
export AZURE_CLIENT_ID=your-client-id
export AZURE_CLIENT_SECRET=your-client-secret
./target/release/eagraph scan --format html --output report --min-risk high
```
## 输出示例
查看 [`examples/sample_graph.json`](examples/sample_graph.json) 和 [`examples/sample_risk_report.json`](examples/sample_risk_report.json)。
## 项目结构
```
crates/
eagraph-core/src/
graph_client.rs Microsoft Graph API client (OAuth2, pagination)
node_builder.rs API response to Node/Edge model + mock graph
edge_analyzer.rs petgraph DiGraph wrapper (EntraGraph)
chain_detector.rs BFS privilege chain finder (max depth 6)
risk_scorer.rs Role template ID and permission-based risk scoring
exporter.rs JSON, GraphML, HTML + D3.js export
model.rs Node, Edge, AccessGraph, PrivilegeChain, RiskReport
eagraph-cli/src/
main.rs CLI entry point (clap)
.github/workflows/
ci.yml Ubuntu + Windows CI (check, clippy, test)
weekly-scan.yml Scheduled Monday 06:00 UTC scan with artifact upload
examples/
sample_graph.json Sample AccessGraph
sample_risk_report.json Sample RiskReport
```
## Azure 集成
查看 [`docs/azure_integration.md`](docs/azure_integration.md) 了解:
- App Registration 设置及所需权限
- 每周扫描的 GitHub Actions secrets 配置
- 用于 Application Insights 的 KQL 查询
## 路线图
查看 [ROADMAP.md](ROADMAP.md)。
**作者:** [Rafael Yilmaz](https://github.com/9t29zhmwdh-coder) · **状态:** 活跃 · v0.1.0 · **许可证:** MIT
标签:Entra ID, Rust, 可视化界面, 安全可视化, 权限分析, 网络流量审计, 身份与访问管理, 通知系统