Files
OpenClaw Bot 95a558acc9 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 记录完成状态
2026-02-23 18:11:11 +08:00

276 lines
6.7 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>InsightFlow Clipper</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 360px;
min-height: 400px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
background: #f5f5f5;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
text-align: center;
}
.header h1 {
font-size: 20px;
font-weight: 600;
}
.header p {
font-size: 12px;
opacity: 0.9;
margin-top: 5px;
}
.content {
padding: 15px;
}
.page-info {
background: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.page-info .title {
font-size: 14px;
font-weight: 600;
color: #333;
margin-bottom: 5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.page-info .url {
font-size: 12px;
color: #666;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.stats {
display: flex;
gap: 15px;
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid #eee;
}
.stat {
font-size: 12px;
color: #888;
}
.stat span {
color: #667eea;
font-weight: 600;
}
.actions {
display: flex;
flex-direction: column;
gap: 10px;
}
.btn {
padding: 12px 20px;
border: none;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.btn-primary:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.btn-secondary {
background: white;
color: #667eea;
border: 1px solid #667eea;
}
.btn-secondary:hover {
background: #f8f9ff;
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.status {
text-align: center;
padding: 10px;
font-size: 12px;
color: #666;
}
.status.success {
color: #4CAF50;
}
.status.error {
color: #f44336;
}
.clips-list {
margin-top: 15px;
max-height: 200px;
overflow-y: auto;
}
.clip-item {
background: white;
border-radius: 6px;
padding: 10px;
margin-bottom: 8px;
font-size: 12px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.clip-item .clip-title {
font-weight: 600;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.clip-item .clip-time {
color: #999;
font-size: 11px;
margin-top: 3px;
}
.clip-item .clip-status {
display: inline-block;
padding: 2px 6px;
border-radius: 3px;
font-size: 10px;
margin-top: 5px;
}
.clip-status.synced {
background: #e8f5e9;
color: #4CAF50;
}
.clip-status.pending {
background: #fff3e0;
color: #ff9800;
}
.settings-link {
text-align: center;
margin-top: 15px;
}
.settings-link a {
color: #667eea;
text-decoration: none;
font-size: 12px;
}
.settings-link a:hover {
text-decoration: underline;
}
.loading {
display: none;
text-align: center;
padding: 20px;
}
.loading.active {
display: block;
}
.spinner {
width: 30px;
height: 30px;
border: 3px solid #f3f3f3;
border-top: 3px solid #667eea;
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 0 auto 10px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="header">
<h1>📎 InsightFlow</h1>
<p>一键保存网页到知识库</p>
</div>
<div class="content">
<div class="page-info" id="pageInfo">
<div class="title" id="pageTitle">加载中...</div>
<div class="url" id="pageUrl"></div>
<div class="stats">
<div class="stat">字数: <span id="wordCount">0</span></div>
<div class="stat">待同步: <span id="pendingCount">0</span></div>
</div>
</div>
<div class="actions">
<button class="btn btn-primary" id="clipPageBtn">
📄 保存整个页面
</button>
<button class="btn btn-secondary" id="clipSelectionBtn">
✏️ 保存选中内容
</button>
</div>
<div class="status" id="status"></div>
<div class="loading" id="loading">
<div class="spinner"></div>
<div>正在处理...</div>
</div>
<div class="clips-list" id="clipsList"></div>
<div class="settings-link">
<a href="#" id="openOptions">⚙️ 设置</a>
</div>
</div>
<script src="popup.js"></script>
</body>
</html>