@extends('layouts.app') @section('title', '源碼掃描') @section('content')

源碼掃描

@if(session('success'))
{{ session('success') }}
@endif {{-- 工具選擇卡片 --}} @php $scanners = [ 'semgrep' => ['label'=>'Semgrep', 'color'=>'primary', 'icon'=>'bi-code-slash', 'sub'=>'Semgrep Inc.', 'desc'=>'SAST 靜態分析,偵測注入、XSS、機密洩漏,支援 30+ 語言', 'tags'=>['SAST','OWASP','多語言'], 'badge'=>'Docker', 'badge_c'=>'primary'], 'trivy' => ['label'=>'Trivy', 'color'=>'info', 'icon'=>'bi-boxes', 'sub'=>'Aqua Security', 'desc'=>'依賴套件 CVE 掃描,支援 composer / npm / pip / go.mod', 'tags'=>['SCA','CVE','依賴套件'], 'badge'=>'Docker', 'badge_c'=>'info'], 'sonarqube' => ['label'=>'SonarQube', 'color'=>'warning', 'icon'=>'bi-bar-chart-line', 'sub'=>'SonarSource', 'desc'=>'業界標準程式碼品質+安全分析,需安裝 SonarQube Server', 'tags'=>['SAST','品質','合規'], 'badge'=>\App\Services\SonarService::isConfigured()?'已設定':'需設定','badge_c'=>\App\Services\SonarService::isConfigured()?'success':'secondary'], ]; @endphp
@foreach($scanners as $key => $s) @php $cnt = $counts[$key] ?? null; $active = $scanner === $key; @endphp
{{ $s['label'] }} {{ $s['badge'] }}
{{ $s['sub'] }}
{{ $cnt['total'] ?? 0 }}
次掃描

{{ $s['desc'] }}

@foreach($s['tags'] as $tag) {{ $tag }} @endforeach
@endforeach
{{-- 掃描記錄列表 --}}
{{-- 標題 + 篩選標籤 --}} @if($scanner) {{ $scanners[$scanner]['label'] ?? $scanner }} @else @endif 掃描記錄 {{-- 搜尋框 --}}
@if($scanner) @endif
@if($search) @endif
@if($scanner) 清除篩選 @endif
@if($isAdmin) @endif @forelse($scans as $scan) @php $bySev = $scan->summary['by_severity'] ?? []; @endphp @if($isAdmin) @endif @empty @endforelse
來源 工具 語言 共享 狀態 C H M L建立者時間
@php $displayName = $scan->project?->name ?? $scan->source_name ?? ($scan->source_type === 'upload' ? '上傳檔案' : null) ?? basename(parse_url($scan->source_ref ?? '', PHP_URL_PATH) ?: '—'); @endphp {{ $displayName }} @if($scan->source_type === 'upload')
上傳檔案
@else
{{ Str::limit(parse_url($scan->source_ref ?? '', PHP_URL_PATH) ?: ($scan->source_ref ?? ''), 55) }}
@endif @if($scan->branch && $scan->branch !== 'main') {{ $scan->branch }} @endif
{{ $scan->scannerLabel() }} {{ $scan->language ?? '—' }} @php $st = $scan->share_type ?? 'private'; @endphp @php $canManage = $isAdmin || $scan->created_by === auth()->id(); @endphp @if($canManage) @else {{-- 非建立者:僅顯示狀態,無法修改 --}} @if($st === 'public') @elseif($st === 'restricted') @else @endif @endif @if($scan->status==='done') 完成 @elseif($scan->status==='running') 執行中 @elseif($scan->status==='failed') 失敗 @else 待執行 @endif {{ ($bySev['critical']??0) ?: '·' }} {{ ($bySev['high']??0) ?: '·' }} {{ ($bySev['medium']??0) ?: '·' }} {{ ($bySev['low']??0) ?: '·' }} {{ $scan->creator?->name ?? '—' }} {{ $scan->created_at->format('m-d H:i') }}
@if($scan->status === 'done') @endif
@csrf @method('DELETE')
@if($search) 找不到「{{ $search }}」的掃描記錄 @else 尚無掃描記錄,請點選上方工具卡片開始掃描 @endif
{{-- 分享設定 Modal --}} {{-- 寄送報告 Modal --}} @include('partials.send-report-modal') @push('scripts') @endpush @endsection