Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions console/src/features/supply/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export interface ScanReport {
component_id: string
kind: string
rating: Rating
description?: string // manifest 自报描述(中文可读,便于识别);备份演示数据可缺省
risks: ScanRisk[]
}
8 changes: 7 additions & 1 deletion console/src/features/supply/supply-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export function SupplyPage() {
{t(RATING_KEY[r.rating])}
</Badge>
</div>
<p className="mt-1.5 text-[12px] text-ink-3">
<p className="mt-1 truncate text-[12.5px] text-ink-2" title={r.description ?? ''}>
{r.description || r.kind}
</p>
<p className="mt-1 text-[12px] text-ink-3">
{r.kind} · {t('supply.risk_count', { count: r.risks.length })}
</p>
</button>
Expand All @@ -85,6 +88,9 @@ export function SupplyPage() {
{report.kind} · {t('supply.risk_count', { count: report.risks.length })}
</span>
</div>
{report.description ? (
<p className="mt-1.5 text-[13px] text-ink-2">{report.description}</p>
) : null}

<Card className="mt-3 overflow-hidden">
<table className="w-full text-[14px]">
Expand Down
5 changes: 5 additions & 0 deletions docs/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5412,6 +5412,11 @@
"type": "string",
"title": "Rating"
},
"description": {
"type": "string",
"title": "Description",
"default": ""
},
"risks": {
"items": {
"$ref": "#/components/schemas/SupplyScanRiskDTO"
Expand Down
13 changes: 13 additions & 0 deletions samples/supplychain/gray-ops-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 灰件样例(演示中间档):功能看似正当(上报运维指标),但外联目标是裸 IP 端点
# (无域名可核验)→ 命中 endpoint.raw_ip(high) → 预期评级 approve(转人工审批,
# 非一棍子打死)。仅用于演示供应链扫描分级处置,非真实组件。
name: ops-metrics-reporter
version: 0.4.2
description: 采集本机运行指标并上报到自建监控服务。
permissions:
- file.read
- network
endpoints:
- http://10.2.16.9:9100/metrics
dependencies:
- requests==2.31.0
1 change: 1 addition & 0 deletions src/fulcrum/adapters/api/schemas/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class SupplyScanReportDTO(BaseModel):
component_id: str # name@version
kind: str = "component" # 组件类型(plugin/skill/mcp,据 manifest 或文件名推断)
rating: str # 评级 = 最严重项:critical→block / high→approve / medium→sanitize / 否则 allow
description: str = "" # manifest 自报描述(组件获取时自带,中文可读,便于页面识别)
risks: list[SupplyScanRiskDTO] = Field(default_factory=list)


Expand Down
11 changes: 9 additions & 2 deletions src/fulcrum/adapters/api/supply_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _infer_kind(stem: str, manifest: dict) -> str:
return "component"


def to_scan_report_dto(report: ScanReport, kind: str) -> SupplyScanReportDTO:
def to_scan_report_dto(report: ScanReport, kind: str, description: str = "") -> SupplyScanReportDTO:
"""ScanReport → 供应链页 DTO(风险项按分值降序,对齐 CLI 报告呈现)。"""
risks = [
SupplyScanRiskDTO(
Expand All @@ -53,6 +53,7 @@ def to_scan_report_dto(report: ScanReport, kind: str) -> SupplyScanReportDTO:
component_id=report.component_id,
kind=kind,
rating=report.rating.value,
description=" ".join(description.split()), # 折叠多行为单行,页面副标题友好
risks=risks,
)

Expand All @@ -73,7 +74,13 @@ def scan_directory(scanner: SupplyChainScanner, manifest_dir: str) -> list[Suppl
if not isinstance(manifest, dict):
continue
report = scanner.scan(manifest, Context(session_id="supply-scan"))
out.append(to_scan_report_dto(report, _infer_kind(path.stem, manifest)))
out.append(
to_scan_report_dto(
report,
_infer_kind(path.stem, manifest),
str(manifest.get("description") or ""),
)
)
out.sort(key=lambda r: (_RATING_RANK.get(r.rating, 9), r.component_id))
return out

Expand Down
Loading