cyberdudebivash/CYBERDUDEBIVASH-THREAT-INTEL-PLATFORM
GitHub: cyberdudebivash/CYBERDUDEBIVASH-THREAT-INTEL-PLATFORM
一个基于AI的威胁情报平台,实现多源情报聚合、STIX导出和自动同步的轻量级安全态势监控方案。
Stars: 0 | Forks: 0
# CYBERDUDEBIVASH® SENTINEL APEX v25.0 — 同步修复包
## 🔴 生产环境事件:仪表盘显示 "Last Sync: 3d ago"
### 根本原因分析摘要
经过全面的 v24↔v25 代码对比:
| File | Status | Impact |
|------|--------|--------|
| `sentinel_blogger.py` | IDENTICAL | Not the issue |
| `export_stix.py` | IDENTICAL | Not the issue |
| `multi_source_intel.py` | IDENTICAL | Not the issue |
| `GitHub Actions workflows` | IDENTICAL | Not the issue |
| **`index.html` line ~2285** | BUG FOUND | **ROOT CAUSE** |
### Bug
仪表盘的 "Last Sync" 指标从**错误的数组索引**读取数据:
```
// BUGGY CODE (line ~2285):
const lastTs = data.length ?
timeSince(data[data.length - 1].timestamp || data[0].timestamp) : '—';
// ^^^^^^^^^^^^^^^^^^^^^ reads LAST (oldest) entry!
```
`feed_manifest.json` 数组的最新条目在前,但代码读取的是 `data.length - 1`,即最旧的条目。
### 次要 Issue
GitHub Actions 工作流可能已停止运行,或者 gh-pages 部署失败。
## 📦 包内容
```
v25_sync_fix/
├── README.md # This file
├── diagnose_sync.py # Diagnostic script
├── force_sync.py # Emergency sync script
├── dashboard_sync_fix.js # JS patch helper
├── patches/
│ └── index_html_sync_fix.patch # Diff patch for index.html
└── .github/
└── workflows/
└── sentinel-blogger.yml # Enhanced workflow (v25.0)
```
## 🔧 修复说明
### Step 1: 应用仪表盘修复
**Option A: 手动编辑**
打开 `index.html` 并找到第 ~2285 行:
```
// OLD (BUGGY):
const lastTs = data.length ? timeSince(data[data.length - 1].timestamp || data[0].timestamp) : '—';
```
替换为:
```
// NEW (FIXED):
let sortedData = [...data].sort((a, b) => new Date(b.timestamp || 0) - new Date(a.timestamp || 0));
const lastTs = sortedData.length ? timeSince(sortedData[0].timestamp) : '—';
```
**Option B: 应用补丁**
```
cd /path/to/CYBERDUDEBIVASH-THREAT-INTEL-PLATFORM
patch -p1 < patches/index_html_sync_fix.patch
```
### Step 2: 更新 GitHub Actions 工作流
将此包中增强的 v25.0 版本替换 `.github/workflows/sentinel-blogger.yml`。
主要改进:
- 每 4 小时运行一次(原来是 6 小时)
- 创建包含准确同步时间戳的 `sync_marker.json`
- 同步前/后验证
- 并发控制以防止竞态条件
### Step 3: 验证 GitHub Actions
1. 访问:`https://github.com/cyberdudebivash/CYBERDUDEBIVASH-THREAT-INTEL-PLATFORM/settings/actions`
2. 确保选中了 "Allow all actions and reusable workflows"
3. 检查计划工作流未被禁用
### Step 4: 手动触发工作流
1. 访问:`https://github.com/cyberdudebivash/CYBERDUDEBIVASH-THREAT-INTEL-PLATFORM/actions`
2. 选择 "CDB Sentinel Blogger" 工作流
3. 点击 "Run workflow" → "Run workflow"
### Step 5: 运行诊断(可选)
```
cd /path/to/CYBERDUDEBIVASH-THREAT-INTEL-PLATFORM
python diagnose_sync.py
```
## 🔍 诊断检查清单
- [ ] `feed_manifest.json` 包含带有今天时间戳的条目
- [ ] GitHub Actions "CDB Sentinel Blogger" 工作流成功运行
- [ ] gh-pages 分支包含最新的 `data/stix/feed_manifest.json`
- [ ] `index.html` 读取的是 `data[0].timestamp`(而不是 `data[data.length-1]`)
- [ ] 没有 Secret 过期(REFRESH_TOKEN, CLIENT_ID 等)
## 📊 修复后的预期结果
仪表盘应显示:
- **Last Sync**: `< 4h`(基于工作流计划)
- **Fresh reports**: 来自今天/昨天的 CVE
- **Metrics**: 更新的计数
## 🚨 紧急强制同步
如果其他方法都失败,请运行:
```
python force_sync.py
```
这将:
1. 更新 manifest 中的时间戳
2. 提交并推送更改
3. 强制刷新仪表盘
## 📝 备注
- v25 模块(scoring, ctem, simulator)**不是**导致问题的原因
- 它们使用延迟导入,不影响同步流水线
- 该 Bug 存在于原始的 index.html 中(v25 之前)
**修复作者**: Claude (Anthropic)
**日期**: 2026-02-28
**版本**: v25.0-hotfix-1
标签:AI驱动, CMS安全, Dashboard, ESC4, GitHub Actions, Homebrew安装, JavaScript, Last Sync, masscan, nuclei, OSINT, STIX, TIP, 前端修复, 威胁情报平台, 情报源管理, 排序算法, 数据可视化, 数据同步, 生产事故修复, 网络安全, 网络调试, 自动化, 自动笔记, 逆向工具, 错误诊断, 隐私保护