- 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>
96 lines
3.3 KiB
Go
96 lines
3.3 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/fraktal/mev-beta/tools/audit-orchestrator/internal"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
mode = flag.String("mode", "comprehensive", "Audit mode: quick, standard, comprehensive, continuous, custom")
|
|
configFile = flag.String("config", "orchestrator-config.yaml", "Configuration file path")
|
|
outputDir = flag.String("output", "reports/orchestrator", "Output directory")
|
|
verbose = flag.Bool("verbose", false, "Enable verbose output")
|
|
dryRun = flag.Bool("dry-run", false, "Perform dry run without executing audits")
|
|
parallel = flag.Bool("parallel", true, "Run compatible audits in parallel")
|
|
timeout = flag.Duration("timeout", 60*time.Minute, "Overall timeout for all audits")
|
|
reportFormat = flag.String("format", "html", "Report format: html, json, pdf, all")
|
|
dashboardMode = flag.Bool("dashboard", false, "Start interactive dashboard")
|
|
watchMode = flag.Bool("watch", false, "Continuous monitoring mode")
|
|
webhookURL = flag.String("webhook", "", "Webhook URL for notifications")
|
|
schedule = flag.String("schedule", "", "Cron schedule for automatic runs")
|
|
baselineDir = flag.String("baseline", "", "Baseline reports directory for comparison")
|
|
thresholds = flag.String("thresholds", "", "Custom quality thresholds file")
|
|
environment = flag.String("env", "development", "Environment: development, staging, production")
|
|
integrationMode = flag.Bool("integration", false, "Integration with external systems")
|
|
metricsExport = flag.Bool("metrics", false, "Export metrics to external systems")
|
|
)
|
|
flag.Parse()
|
|
|
|
// Create output directory
|
|
if err := os.MkdirAll(*outputDir, 0755); err != nil {
|
|
log.Fatalf("Failed to create output directory: %v", err)
|
|
}
|
|
|
|
// Initialize audit orchestrator
|
|
orchestrator, err := internal.NewAuditOrchestrator(&internal.OrchestratorConfig{
|
|
Mode: *mode,
|
|
ConfigFile: *configFile,
|
|
OutputDir: *outputDir,
|
|
Verbose: *verbose,
|
|
DryRun: *dryRun,
|
|
Parallel: *parallel,
|
|
Timeout: *timeout,
|
|
ReportFormat: *reportFormat,
|
|
DashboardMode: *dashboardMode,
|
|
WatchMode: *watchMode,
|
|
WebhookURL: *webhookURL,
|
|
Schedule: *schedule,
|
|
BaselineDir: *baselineDir,
|
|
Thresholds: *thresholds,
|
|
Environment: *environment,
|
|
IntegrationMode: *integrationMode,
|
|
MetricsExport: *metricsExport,
|
|
})
|
|
if err != nil {
|
|
log.Fatalf("Failed to initialize audit orchestrator: %v", err)
|
|
}
|
|
|
|
ctx := context.Background()
|
|
ctx, cancel := context.WithTimeout(ctx, *timeout)
|
|
defer cancel()
|
|
|
|
if *dashboardMode {
|
|
fmt.Println("Starting audit orchestrator dashboard...")
|
|
if err := orchestrator.StartDashboard(ctx); err != nil {
|
|
log.Fatalf("Dashboard failed: %v", err)
|
|
}
|
|
return
|
|
}
|
|
|
|
if *watchMode {
|
|
fmt.Println("Starting continuous monitoring mode...")
|
|
if err := orchestrator.StartContinuousMonitoring(ctx); err != nil {
|
|
log.Fatalf("Continuous monitoring failed: %v", err)
|
|
}
|
|
return
|
|
}
|
|
|
|
fmt.Printf("Starting audit orchestration in %s mode...\n", *mode)
|
|
exitCode, err := orchestrator.RunOrchestration(ctx)
|
|
if err != nil {
|
|
log.Fatalf("Audit orchestration failed: %v", err)
|
|
}
|
|
|
|
fmt.Printf("Audit orchestration complete. Reports saved to: %s\n", *outputDir)
|
|
fmt.Printf("Exit code: %d\n", exitCode)
|
|
|
|
os.Exit(exitCode)
|
|
}
|