@extends('layouts.app') @section('title', '新增源碼掃描') @section('content')
返回掃描清單
@csrf @if($errors->any())
    @foreach($errors->all() as $e)
  • {{ $e }}
  • @endforeach
@endif {{-- ① 工具選擇 --}}
選擇掃描工具
{{-- Semgrep --}}
Semgrep Docker
Semgrep SAST
靜態分析,偵測注入、XSS、機密洩漏,支援 PHP/JS/Python/Go 等
OWASP Top 10 SAST ★
{{-- Trivy --}}
Trivy Docker
Trivy SCA
依賴套件 CVE 掃描,composer / npm / pip / go.mod
CVE A06:2021
{{-- SonarQube --}}
SonarQube @if(\App\Services\SonarService::isConfigured()) 已設定 @else 需設定 @endif
SonarQube
業界標準程式碼品質+安全分析,需 SonarQube Server
品質 合規
{{-- 左欄:來源設定 --}}
掃描來源
{{-- 來源類型 --}}
來源類型
GitLab
Clone
本機路徑
Server
上傳檔案
zip / tar.gz
{{-- GitLab URL --}}
@error('source_ref')
{{ $message }}
@enderror
{{-- 分支 --}}
{{-- 本機路徑 --}}
伺服器上的絕對路徑
{{-- 上傳檔案 --}}
@error('source_file')
{{ $message }}
@enderror
支援 .zip.tar.gz,最大 200 MB
{{-- 上傳進度條 --}}
{{-- 綁定專案 --}}
{{-- 已選摘要 --}}
已選工具
Semgrep SAST
規則集:auto(推薦)
{{-- 共享設定 --}}
檢視權限
@foreach([ 'private' => ['icon'=>'bi-lock', 'color'=>'secondary', 'label'=>'私人', 'desc'=>'只有自己與管理員可見'], 'public' => ['icon'=>'bi-people-fill', 'color'=>'success', 'label'=>'全部公開', 'desc'=>'所有有源碼掃描權限的人'], 'restricted' => ['icon'=>'bi-person-check-fill','color'=>'warning', 'label'=>'指定對象', 'desc'=>'只有選定的帳號可見'], ] as $val => $opt) @endforeach
{{-- 指定帳號區塊 --}}
搜尋並新增帳號
取消
{{-- 右欄:掃描模式 --}}
{{-- Semgrep 規則集 --}}
Semgrep 規則集
@foreach($semgrepRulesets as $key => $rs)
{{ $rs['label'] }}
{{ $rs['desc'] }}
@endforeach
{{-- Trivy 模式 --}}
Trivy 掃描模式
@foreach($trivyModes as $mkey => $mm)
{{ $mm['label'] }} @if($mkey==='fs') 推薦 @endif
{{ $mm['desc'] }}
@endforeach
{{-- SonarQube --}}
SonarQube 設定
@if(!\App\Services\SonarService::isConfigured())
尚未設定 SonarQube。
1. 啟動:docker run -d --name sonarqube -p 9000:9000 sonarqube:community
2. 瀏覽 http://localhost:9000,建立 User Token
3. 在 .env 加入:
SONAR_URL=http://localhost:9000
SONAR_TOKEN=your_token
@else
SonarQube 已設定:{{ config('services.sonarqube.url') }}
@endif
SonarQube 會自動偵測專案語言並執行完整程式碼品質+安全分析。掃描時間依專案大小約 2–30 分鐘。
@endsection @push('scripts') @endpush