- Added comprehensive bounds checking to prevent buffer overruns in multicall parsing - Implemented graduated validation system (Strict/Moderate/Permissive) to reduce false positives - Added LRU caching system for address validation with 10-minute TTL - Enhanced ABI decoder with missing Universal Router and Arbitrum-specific DEX signatures - Fixed duplicate function declarations and import conflicts across multiple files - Added error recovery mechanisms with multiple fallback strategies - Updated tests to handle new validation behavior for suspicious addresses - Fixed parser test expectations for improved validation system - Applied gofmt formatting fixes to ensure code style compliance - Fixed mutex copying issues in monitoring package by introducing MetricsSnapshot - Resolved critical security vulnerabilities in heuristic address extraction - Progress: Updated TODO audit from 10% to 35% complete 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
76 lines
2.6 KiB
Go
76 lines
2.6 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/fraktal/mev-beta/tools/cicd-audit/internal"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
pipeline = flag.String("pipeline", "full", "Pipeline type: quick, standard, full, custom")
|
|
configFile = flag.String("config", "audit-config.yaml", "Configuration file path")
|
|
outputDir = flag.String("output", "reports/cicd-audit", "Output directory")
|
|
verbose = flag.Bool("verbose", false, "Enable verbose output")
|
|
parallel = flag.Bool("parallel", true, "Run audits in parallel")
|
|
failFast = flag.Bool("fail-fast", false, "Stop on first failure")
|
|
reportFormat = flag.String("format", "junit", "Report format: junit, json, html, all")
|
|
timeout = flag.Duration("timeout", 30*time.Minute, "Overall timeout for all audits")
|
|
stage = flag.String("stage", "all", "CI/CD stage: build, test, security, deploy, all")
|
|
environment = flag.String("env", "development", "Environment: development, staging, production")
|
|
slackWebhook = flag.String("slack-webhook", "", "Slack webhook URL for notifications")
|
|
emailRecipients = flag.String("email", "", "Comma-separated email recipients for notifications")
|
|
baselineMode = flag.Bool("baseline", false, "Generate baseline reports")
|
|
compareMode = flag.Bool("compare", false, "Compare against baseline")
|
|
metricsMode = flag.Bool("metrics", false, "Generate metrics and trends")
|
|
)
|
|
flag.Parse()
|
|
|
|
// Create output directory
|
|
if err := os.MkdirAll(*outputDir, 0755); err != nil {
|
|
log.Fatalf("Failed to create output directory: %v", err)
|
|
}
|
|
|
|
// Initialize CI/CD auditor
|
|
auditor, err := internal.NewCICDAuditor(&internal.CICDAuditConfig{
|
|
Pipeline: *pipeline,
|
|
ConfigFile: *configFile,
|
|
OutputDir: *outputDir,
|
|
Verbose: *verbose,
|
|
Parallel: *parallel,
|
|
FailFast: *failFast,
|
|
ReportFormat: *reportFormat,
|
|
Timeout: *timeout,
|
|
Stage: *stage,
|
|
Environment: *environment,
|
|
SlackWebhook: *slackWebhook,
|
|
EmailRecipients: *emailRecipients,
|
|
BaselineMode: *baselineMode,
|
|
CompareMode: *compareMode,
|
|
MetricsMode: *metricsMode,
|
|
})
|
|
if err != nil {
|
|
log.Fatalf("Failed to initialize CI/CD auditor: %v", err)
|
|
}
|
|
|
|
ctx := context.Background()
|
|
ctx, cancel := context.WithTimeout(ctx, *timeout)
|
|
defer cancel()
|
|
|
|
fmt.Printf("Starting CI/CD audit pipeline: %s...\n", *pipeline)
|
|
exitCode, err := auditor.RunCICDPipeline(ctx)
|
|
if err != nil {
|
|
log.Fatalf("CI/CD audit pipeline failed: %v", err)
|
|
}
|
|
|
|
fmt.Printf("CI/CD audit pipeline complete. Reports saved to: %s\n", *outputDir)
|
|
fmt.Printf("Exit code: %d\n", exitCode)
|
|
|
|
os.Exit(exitCode)
|
|
}
|