Phase 7 Task 3: 数据安全与合规

- 创建 security_manager.py 安全模块
  - SecurityManager: 安全管理主类
  - 审计日志系统 - 记录所有数据操作
  - 端到端加密 - AES-256-GCM 加密项目数据
  - 数据脱敏 - 支持手机号、邮箱、身份证等敏感信息脱敏
  - 数据访问策略 - 基于用户、角色、IP、时间的访问控制
  - 访问审批流程 - 敏感数据访问需要审批

- 更新 schema.sql 添加安全相关数据库表
  - audit_logs: 审计日志表
  - encryption_configs: 加密配置表
  - masking_rules: 脱敏规则表
  - data_access_policies: 数据访问策略表
  - access_requests: 访问请求表

- 更新 main.py 添加安全相关 API 端点
  - GET /api/v1/audit-logs - 查询审计日志
  - GET /api/v1/audit-logs/stats - 审计统计
  - POST /api/v1/projects/{id}/encryption/enable - 启用加密
  - POST /api/v1/projects/{id}/encryption/disable - 禁用加密
  - POST /api/v1/projects/{id}/encryption/verify - 验证密码
  - GET /api/v1/projects/{id}/encryption - 获取加密配置
  - POST /api/v1/projects/{id}/masking-rules - 创建脱敏规则
  - GET /api/v1/projects/{id}/masking-rules - 获取脱敏规则
  - PUT /api/v1/masking-rules/{id} - 更新脱敏规则
  - DELETE /api/v1/masking-rules/{id} - 删除脱敏规则
  - POST /api/v1/projects/{id}/masking/apply - 应用脱敏
  - POST /api/v1/projects/{id}/access-policies - 创建访问策略
  - GET /api/v1/projects/{id}/access-policies - 获取访问策略
  - POST /api/v1/access-policies/{id}/check - 检查访问权限
  - POST /api/v1/access-requests - 创建访问请求
  - POST /api/v1/access-requests/{id}/approve - 批准访问
  - POST /api/v1/access-requests/{id}/reject - 拒绝访问

- 更新 requirements.txt 添加 cryptography 依赖

- 更新 STATUS.md 和 README.md 记录完成状态
This commit is contained in:
OpenClaw Bot
2026-02-23 18:11:11 +08:00
parent 847e183b85
commit 95a558acc9
19 changed files with 4407 additions and 1646 deletions

View File

@@ -1,141 +1,46 @@
/* InsightFlow Chrome Extension - Content Styles */
.insightflow-float-btn {
position: absolute;
width: 36px;
height: 36px;
background: #4f46e5;
border-radius: 50%;
display: none;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
z-index: 999999;
transition: transform 0.2s, box-shadow 0.2s;
#insightflow-clipper-btn {
animation: slideIn 0.3s ease-out;
}
.insightflow-float-btn:hover {
transform: scale(1.1);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
@keyframes slideIn {
from {
transform: translateX(100px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.insightflow-float-btn svg {
color: white;
/* 选中文本高亮样式 */
::selection {
background: rgba(102, 126, 234, 0.3);
}
.insightflow-popup {
position: absolute;
width: 300px;
background: white;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
z-index: 999999;
display: none;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-size: 14px;
/* 剪辑成功提示 */
.insightflow-toast {
position: fixed;
top: 20px;
right: 20px;
background: #4CAF50;
color: white;
padding: 15px 20px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
z-index: 999999;
animation: toastSlideIn 0.3s ease-out;
}
.insightflow-popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
border-bottom: 1px solid #e5e7eb;
font-weight: 600;
color: #111827;
}
.insightflow-close-btn {
background: none;
border: none;
font-size: 20px;
color: #6b7280;
cursor: pointer;
padding: 0;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.insightflow-close-btn:hover {
color: #111827;
}
.insightflow-popup-content {
padding: 16px;
}
.insightflow-text-preview {
background: #f3f4f6;
padding: 12px;
border-radius: 6px;
font-size: 13px;
color: #4b5563;
line-height: 1.5;
max-height: 120px;
overflow-y: auto;
margin-bottom: 12px;
}
.insightflow-actions {
display: flex;
gap: 8px;
}
.insightflow-btn {
flex: 1;
padding: 8px 12px;
border: 1px solid #d1d5db;
border-radius: 6px;
background: white;
color: #374151;
font-size: 13px;
cursor: pointer;
transition: all 0.2s;
}
.insightflow-btn:hover {
background: #f9fafb;
border-color: #9ca3af;
}
.insightflow-btn-primary {
background: #4f46e5;
border-color: #4f46e5;
color: white;
}
.insightflow-btn-primary:hover {
background: #4338ca;
border-color: #4338ca;
}
.insightflow-project-list {
max-height: 200px;
overflow-y: auto;
}
.insightflow-project-item {
padding: 12px;
border-radius: 6px;
cursor: pointer;
transition: background 0.2s;
}
.insightflow-project-item:hover {
background: #f3f4f6;
}
.insightflow-project-name {
font-weight: 500;
color: #111827;
margin-bottom: 4px;
}
.insightflow-project-desc {
font-size: 12px;
color: #6b7280;
@keyframes toastSlideIn {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}