f7c1904625
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
Branch Policy Check / Verify merge target (pull_request) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Generic: Repo Health / Access control (pull_request) Successful in 1s
PR RC Release / Build RC Release (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Failing after 5s
Branch Cleanup / Delete merged branch (pull_request) Successful in 1s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || 'development' }}) (pull_request) Successful in 1m44s
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
Add a pluggable security scanning framework with secret detection as the first scanner module. Scans run on push to default branch and on-demand via the Security settings page. Includes: - Scanner interface for pluggable scanner types - Secret scanner with 15 built-in patterns (AWS, GitHub, Stripe, etc.) - SecurityAlert model with fingerprint-based dedup - SecurityScannerConfig per-repo settings - Migration v349 for security tables - Repo settings Security page with alerts table - Scan Now button for on-demand scanning - Alert resolve/dismiss actions - Push-time scanning in post-receive hook
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
// Copyright 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package security
|
|
|
|
import (
|
|
security_model "code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/security"
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/git"
|
|
)
|
|
|
|
// Finding represents a single security issue found by a scanner.
|
|
type Finding struct {
|
|
Scanner security_model.ScannerType
|
|
Severity security_model.AlertSeverity
|
|
RuleID string
|
|
Title string
|
|
Description string
|
|
FilePath string
|
|
LineNumber int
|
|
CommitSHA string
|
|
Fingerprint string // unique identifier for dedup
|
|
Metadata string // JSON extra data
|
|
}
|
|
|
|
// Scanner is the interface all security scanner modules implement.
|
|
type Scanner interface {
|
|
// Type returns the scanner type identifier.
|
|
Type() security_model.ScannerType
|
|
|
|
// ScanCommit scans a single commit and returns findings.
|
|
ScanCommit(commit *git.Commit) ([]Finding, error)
|
|
|
|
// ScanTree scans the full repository tree and returns findings.
|
|
ScanTree(commit *git.Commit) ([]Finding, error)
|
|
}
|