You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
248 lines
8.0 KiB
248 lines
8.0 KiB
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>代码扫描报告 - {{ project.name }}</title>
|
|
<style>
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
line-height: 1.6;
|
|
margin: 0;
|
|
padding: 20px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
}
|
|
.header {
|
|
text-align: center;
|
|
border-bottom: 2px solid #1890ff;
|
|
padding-bottom: 20px;
|
|
margin-bottom: 30px;
|
|
}
|
|
.header h1 {
|
|
color: #1890ff;
|
|
margin: 0;
|
|
font-size: 2.5em;
|
|
}
|
|
.header p {
|
|
color: #666;
|
|
margin: 10px 0 0 0;
|
|
}
|
|
.summary {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 30px;
|
|
}
|
|
.summary-card {
|
|
background: #f8f9fa;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
text-align: center;
|
|
border-left: 4px solid #1890ff;
|
|
}
|
|
.summary-card h3 {
|
|
margin: 0 0 10px 0;
|
|
color: #333;
|
|
}
|
|
.summary-card .number {
|
|
font-size: 2em;
|
|
font-weight: bold;
|
|
color: #1890ff;
|
|
}
|
|
.severity-critical { border-left-color: #ff4d4f; }
|
|
.severity-high { border-left-color: #ff7a45; }
|
|
.severity-medium { border-left-color: #ffa940; }
|
|
.severity-low { border-left-color: #73d13d; }
|
|
.severity-info { border-left-color: #40a9ff; }
|
|
|
|
.section {
|
|
margin-bottom: 30px;
|
|
}
|
|
.section h2 {
|
|
color: #333;
|
|
border-bottom: 2px solid #f0f0f0;
|
|
padding-bottom: 10px;
|
|
}
|
|
.vulnerability {
|
|
background: #fff;
|
|
border: 1px solid #e8e8e8;
|
|
border-radius: 8px;
|
|
margin-bottom: 15px;
|
|
overflow: hidden;
|
|
}
|
|
.vulnerability-header {
|
|
background: #f8f9fa;
|
|
padding: 15px 20px;
|
|
border-bottom: 1px solid #e8e8e8;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
.vulnerability-title {
|
|
font-weight: bold;
|
|
font-size: 1.1em;
|
|
}
|
|
.severity-badge {
|
|
padding: 4px 12px;
|
|
border-radius: 20px;
|
|
color: white;
|
|
font-size: 0.9em;
|
|
font-weight: bold;
|
|
}
|
|
.severity-critical { background: #ff4d4f; }
|
|
.severity-high { background: #ff7a45; }
|
|
.severity-medium { background: #ffa940; }
|
|
.severity-low { background: #73d13d; }
|
|
.severity-info { background: #40a9ff; }
|
|
|
|
.vulnerability-body {
|
|
padding: 20px;
|
|
}
|
|
.vulnerability-meta {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 20px;
|
|
margin-bottom: 15px;
|
|
}
|
|
.meta-item {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.meta-label {
|
|
font-weight: bold;
|
|
margin-right: 10px;
|
|
min-width: 80px;
|
|
}
|
|
.file-path {
|
|
font-family: 'Courier New', monospace;
|
|
background: #f5f5f5;
|
|
padding: 2px 6px;
|
|
border-radius: 4px;
|
|
}
|
|
.code-block {
|
|
background: #f8f8f8;
|
|
border: 1px solid #e8e8e8;
|
|
border-radius: 4px;
|
|
padding: 15px;
|
|
margin: 10px 0;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 0.9em;
|
|
overflow-x: auto;
|
|
}
|
|
.ai-suggestion {
|
|
background: #e6f7ff;
|
|
border: 1px solid #91d5ff;
|
|
border-radius: 4px;
|
|
padding: 15px;
|
|
margin-top: 10px;
|
|
}
|
|
.ai-suggestion h4 {
|
|
margin: 0 0 10px 0;
|
|
color: #1890ff;
|
|
}
|
|
.footer {
|
|
text-align: center;
|
|
margin-top: 40px;
|
|
padding-top: 20px;
|
|
border-top: 1px solid #e8e8e8;
|
|
color: #666;
|
|
}
|
|
@media print {
|
|
body { background: white; }
|
|
.container { box-shadow: none; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<h1>代码扫描报告</h1>
|
|
<p>项目: {{ project.name }} | 生成时间: {{ generated_at }}</p>
|
|
</div>
|
|
|
|
<!-- 扫描摘要 -->
|
|
<div class="section">
|
|
<h2>扫描摘要</h2>
|
|
<div class="summary">
|
|
<div class="summary-card">
|
|
<h3>总漏洞数</h3>
|
|
<div class="number">{{ total_vulnerabilities }}</div>
|
|
</div>
|
|
{% for severity, vulns in by_severity.items() %}
|
|
<div class="summary-card severity-{{ severity }}">
|
|
<h3>{{ severity|title }} 漏洞</h3>
|
|
<div class="number">{{ vulns|length }}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 漏洞详情 -->
|
|
<div class="section">
|
|
<h2>漏洞详情</h2>
|
|
{% for vulnerability in vulnerabilities %}
|
|
<div class="vulnerability">
|
|
<div class="vulnerability-header">
|
|
<div class="vulnerability-title">
|
|
{{ vulnerability.rule_id }}: {{ vulnerability.message }}
|
|
</div>
|
|
<span class="severity-badge severity-{{ vulnerability.severity.value }}">
|
|
{{ vulnerability.severity.value|upper }}
|
|
</span>
|
|
</div>
|
|
<div class="vulnerability-body">
|
|
<div class="vulnerability-meta">
|
|
<div class="meta-item">
|
|
<span class="meta-label">文件:</span>
|
|
<span class="file-path">{{ vulnerability.file_path }}</span>
|
|
</div>
|
|
<div class="meta-item">
|
|
<span class="meta-label">行号:</span>
|
|
<span>{{ vulnerability.line_number or 'N/A' }}</span>
|
|
</div>
|
|
<div class="meta-item">
|
|
<span class="meta-label">分类:</span>
|
|
<span>{{ vulnerability.category.value }}</span>
|
|
</div>
|
|
<div class="meta-item">
|
|
<span class="meta-label">状态:</span>
|
|
<span>{{ vulnerability.status.value }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
{% if vulnerability.code_snippet %}
|
|
<div>
|
|
<strong>相关代码:</strong>
|
|
<div class="code-block">{{ vulnerability.code_snippet }}</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if vulnerability.ai_enhanced and vulnerability.ai_suggestion %}
|
|
<div class="ai-suggestion">
|
|
<h4>🤖 AI 建议</h4>
|
|
<p>{{ vulnerability.ai_suggestion }}</p>
|
|
{% if vulnerability.ai_confidence %}
|
|
<small>置信度: {{ (vulnerability.ai_confidence * 100)|round(1) }}%</small>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<div class="footer">
|
|
<p>此报告由代码漏洞检测系统自动生成</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|