Autonomous security and compliance scanning agent for git repositories. Features: SAST (Semgrep), SBOM (Syft), CVE monitoring (OSV.dev/NVD), GDPR/OAuth pattern detection, LLM triage, issue creation (GitHub/GitLab/Jira), PR reviews, and Dioxus fullstack dashboard. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
882 B
Rust
28 lines
882 B
Rust
use std::sync::Arc;
|
|
|
|
use axum::routing::post;
|
|
use axum::{Extension, Router};
|
|
|
|
use crate::agent::ComplianceAgent;
|
|
use crate::error::AgentError;
|
|
use crate::webhooks::{github, gitlab};
|
|
|
|
pub async fn start_webhook_server(agent: &ComplianceAgent) -> Result<(), AgentError> {
|
|
let app = Router::new()
|
|
.route("/webhook/github", post(github::handle_github_webhook))
|
|
.route("/webhook/gitlab", post(gitlab::handle_gitlab_webhook))
|
|
.layer(Extension(Arc::new(agent.clone())));
|
|
|
|
let addr = "0.0.0.0:3002";
|
|
let listener = tokio::net::TcpListener::bind(addr)
|
|
.await
|
|
.map_err(|e| AgentError::Other(format!("Failed to bind webhook server: {e}")))?;
|
|
|
|
tracing::info!("Webhook server listening on {addr}");
|
|
axum::serve(listener, app)
|
|
.await
|
|
.map_err(|e| AgentError::Other(format!("Webhook server error: {e}")))?;
|
|
|
|
Ok(())
|
|
}
|