Fix dead code warnings: prefix unused fields with underscore
This commit is contained in:
parent
c2588d80d5
commit
d09a584443
4 changed files with 8 additions and 56 deletions
|
|
@ -1,14 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
@ -20,13 +9,11 @@ pub mod policy_checker;
|
||||||
pub mod risk_assessment;
|
pub mod risk_assessment;
|
||||||
pub mod training_tracker;
|
pub mod training_tracker;
|
||||||
|
|
||||||
|
|
||||||
pub use code_scanner::{
|
pub use code_scanner::{
|
||||||
CodeIssue, CodeScanner, ComplianceReporter, ComplianceScanResult, IssueSeverity, IssueType,
|
CodeIssue, CodeScanner, ComplianceReporter, ComplianceScanResult, IssueSeverity, IssueType,
|
||||||
ScanStats,
|
ScanStats,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
pub enum ComplianceFramework {
|
pub enum ComplianceFramework {
|
||||||
GDPR,
|
GDPR,
|
||||||
|
|
@ -36,7 +23,6 @@ pub enum ComplianceFramework {
|
||||||
PCIDSS,
|
PCIDSS,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
pub enum ComplianceStatus {
|
pub enum ComplianceStatus {
|
||||||
Compliant,
|
Compliant,
|
||||||
|
|
@ -46,7 +32,6 @@ pub enum ComplianceStatus {
|
||||||
NotApplicable,
|
NotApplicable,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub enum Severity {
|
pub enum Severity {
|
||||||
Low,
|
Low,
|
||||||
|
|
@ -55,7 +40,6 @@ pub enum Severity {
|
||||||
Critical,
|
Critical,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct ComplianceCheckResult {
|
pub struct ComplianceCheckResult {
|
||||||
pub framework: ComplianceFramework,
|
pub framework: ComplianceFramework,
|
||||||
|
|
@ -68,7 +52,6 @@ pub struct ComplianceCheckResult {
|
||||||
pub evidence: Vec<String>,
|
pub evidence: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct ComplianceIssue {
|
pub struct ComplianceIssue {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -80,7 +63,6 @@ pub struct ComplianceIssue {
|
||||||
pub assigned_to: Option<String>,
|
pub assigned_to: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct AuditLogEntry {
|
pub struct AuditLogEntry {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -96,7 +78,6 @@ pub struct AuditLogEntry {
|
||||||
pub metadata: HashMap<String, String>,
|
pub metadata: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
pub enum AuditEventType {
|
pub enum AuditEventType {
|
||||||
Access,
|
Access,
|
||||||
|
|
@ -108,7 +89,6 @@ pub enum AuditEventType {
|
||||||
Authorization,
|
Authorization,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
pub enum ActionResult {
|
pub enum ActionResult {
|
||||||
Success,
|
Success,
|
||||||
|
|
@ -117,7 +97,6 @@ pub enum ActionResult {
|
||||||
Error,
|
Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct RiskAssessment {
|
pub struct RiskAssessment {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -130,7 +109,6 @@ pub struct RiskAssessment {
|
||||||
pub risks: Vec<Risk>,
|
pub risks: Vec<Risk>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Risk {
|
pub struct Risk {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -145,7 +123,6 @@ pub struct Risk {
|
||||||
pub status: RiskStatus,
|
pub status: RiskStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum RiskCategory {
|
pub enum RiskCategory {
|
||||||
Technical,
|
Technical,
|
||||||
|
|
@ -155,7 +132,6 @@ pub enum RiskCategory {
|
||||||
Reputational,
|
Reputational,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum TreatmentStrategy {
|
pub enum TreatmentStrategy {
|
||||||
Mitigate,
|
Mitigate,
|
||||||
|
|
@ -164,7 +140,6 @@ pub enum TreatmentStrategy {
|
||||||
Avoid,
|
Avoid,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum RiskStatus {
|
pub enum RiskStatus {
|
||||||
Open,
|
Open,
|
||||||
|
|
@ -174,7 +149,6 @@ pub enum RiskStatus {
|
||||||
Closed,
|
Closed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct TrainingRecord {
|
pub struct TrainingRecord {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -187,7 +161,6 @@ pub struct TrainingRecord {
|
||||||
pub certificate_url: Option<String>,
|
pub certificate_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum TrainingType {
|
pub enum TrainingType {
|
||||||
SecurityAwareness,
|
SecurityAwareness,
|
||||||
|
|
@ -197,7 +170,6 @@ pub enum TrainingType {
|
||||||
RoleSpecific,
|
RoleSpecific,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct AccessReview {
|
pub struct AccessReview {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -210,7 +182,6 @@ pub struct AccessReview {
|
||||||
pub status: ReviewStatus,
|
pub status: ReviewStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct PermissionReview {
|
pub struct PermissionReview {
|
||||||
pub resource_type: String,
|
pub resource_type: String,
|
||||||
|
|
@ -220,7 +191,6 @@ pub struct PermissionReview {
|
||||||
pub action: ReviewAction,
|
pub action: ReviewAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum ReviewAction {
|
pub enum ReviewAction {
|
||||||
Approved,
|
Approved,
|
||||||
|
|
@ -229,7 +199,6 @@ pub enum ReviewAction {
|
||||||
FlaggedForReview,
|
FlaggedForReview,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum ReviewStatus {
|
pub enum ReviewStatus {
|
||||||
Pending,
|
Pending,
|
||||||
|
|
@ -238,24 +207,21 @@ pub enum ReviewStatus {
|
||||||
Approved,
|
Approved,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub struct ComplianceMonitor {
|
pub struct ComplianceMonitor {
|
||||||
enabled_frameworks: Vec<ComplianceFramework>,
|
enabled_frameworks: Vec<ComplianceFramework>,
|
||||||
check_interval_hours: u32,
|
_check_interval_hours: u32,
|
||||||
auto_remediate: bool,
|
_auto_remediate: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComplianceMonitor {
|
impl ComplianceMonitor {
|
||||||
|
|
||||||
pub fn new(frameworks: Vec<ComplianceFramework>) -> Self {
|
pub fn new(frameworks: Vec<ComplianceFramework>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
enabled_frameworks: frameworks,
|
enabled_frameworks: frameworks,
|
||||||
check_interval_hours: 24,
|
_check_interval_hours: 24,
|
||||||
auto_remediate: false,
|
_auto_remediate: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub async fn run_checks(
|
pub async fn run_checks(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
||||||
|
|
@ -269,7 +235,6 @@ impl ComplianceMonitor {
|
||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn check_framework(
|
async fn check_framework(
|
||||||
&self,
|
&self,
|
||||||
framework: &ComplianceFramework,
|
framework: &ComplianceFramework,
|
||||||
|
|
@ -283,11 +248,9 @@ impl ComplianceMonitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn check_gdpr(&self) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
async fn check_gdpr(&self) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
||||||
let mut results = Vec::new();
|
let mut results = Vec::new();
|
||||||
|
|
||||||
|
|
||||||
results.push(ComplianceCheckResult {
|
results.push(ComplianceCheckResult {
|
||||||
framework: ComplianceFramework::GDPR,
|
framework: ComplianceFramework::GDPR,
|
||||||
control_id: "gdpr_7.2".to_string(),
|
control_id: "gdpr_7.2".to_string(),
|
||||||
|
|
@ -299,7 +262,6 @@ impl ComplianceMonitor {
|
||||||
evidence: vec!["Automated data deletion configured".to_string()],
|
evidence: vec!["Automated data deletion configured".to_string()],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
results.push(ComplianceCheckResult {
|
results.push(ComplianceCheckResult {
|
||||||
framework: ComplianceFramework::GDPR,
|
framework: ComplianceFramework::GDPR,
|
||||||
control_id: "gdpr_5.1.f".to_string(),
|
control_id: "gdpr_5.1.f".to_string(),
|
||||||
|
|
@ -311,7 +273,6 @@ impl ComplianceMonitor {
|
||||||
evidence: vec!["AES-256-GCM encryption enabled".to_string()],
|
evidence: vec!["AES-256-GCM encryption enabled".to_string()],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
results.push(ComplianceCheckResult {
|
results.push(ComplianceCheckResult {
|
||||||
framework: ComplianceFramework::GDPR,
|
framework: ComplianceFramework::GDPR,
|
||||||
control_id: "gdpr_6.1".to_string(),
|
control_id: "gdpr_6.1".to_string(),
|
||||||
|
|
@ -326,11 +287,9 @@ impl ComplianceMonitor {
|
||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn check_soc2(&self) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
async fn check_soc2(&self) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
||||||
let mut results = Vec::new();
|
let mut results = Vec::new();
|
||||||
|
|
||||||
|
|
||||||
results.push(ComplianceCheckResult {
|
results.push(ComplianceCheckResult {
|
||||||
framework: ComplianceFramework::SOC2,
|
framework: ComplianceFramework::SOC2,
|
||||||
control_id: "cc6.1".to_string(),
|
control_id: "cc6.1".to_string(),
|
||||||
|
|
@ -345,13 +304,11 @@ impl ComplianceMonitor {
|
||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn check_iso27001(
|
async fn check_iso27001(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
||||||
let mut results = Vec::new();
|
let mut results = Vec::new();
|
||||||
|
|
||||||
|
|
||||||
results.push(ComplianceCheckResult {
|
results.push(ComplianceCheckResult {
|
||||||
framework: ComplianceFramework::ISO27001,
|
framework: ComplianceFramework::ISO27001,
|
||||||
control_id: "a.8.1".to_string(),
|
control_id: "a.8.1".to_string(),
|
||||||
|
|
@ -366,19 +323,16 @@ impl ComplianceMonitor {
|
||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn check_hipaa(&self) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
async fn check_hipaa(&self) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
||||||
Ok(vec![])
|
Ok(vec![])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn check_pci_dss(
|
async fn check_pci_dss(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
) -> Result<Vec<ComplianceCheckResult>, Box<dyn std::error::Error>> {
|
||||||
Ok(vec![])
|
Ok(vec![])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn calculate_compliance_score(results: &[ComplianceCheckResult]) -> f64 {
|
pub fn calculate_compliance_score(results: &[ComplianceCheckResult]) -> f64 {
|
||||||
if results.is_empty() {
|
if results.is_empty() {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
@ -388,7 +342,6 @@ impl ComplianceMonitor {
|
||||||
total / results.len() as f64
|
total / results.len() as f64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn generate_report(results: &[ComplianceCheckResult]) -> ComplianceReport {
|
pub fn generate_report(results: &[ComplianceCheckResult]) -> ComplianceReport {
|
||||||
let mut issues_by_severity = HashMap::new();
|
let mut issues_by_severity = HashMap::new();
|
||||||
let mut total_issues = 0;
|
let mut total_issues = 0;
|
||||||
|
|
@ -420,7 +373,6 @@ impl ComplianceMonitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct ComplianceReport {
|
pub struct ComplianceReport {
|
||||||
pub generated_at: DateTime<Utc>,
|
pub generated_at: DateTime<Utc>,
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ impl PolicyChecker {
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let mut violations = Vec::new();
|
let mut violations = Vec::new();
|
||||||
let mut warnings = Vec::new();
|
let warnings = Vec::new();
|
||||||
|
|
||||||
for rule in &policy.rules {
|
for rule in &policy.rules {
|
||||||
if !self.evaluate_rule(rule, context) {
|
if !self.evaluate_rule(rule, context) {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ pub struct UserDriveVectorDB {
|
||||||
user_id: Uuid,
|
user_id: Uuid,
|
||||||
bot_id: Uuid,
|
bot_id: Uuid,
|
||||||
collection_name: String,
|
collection_name: String,
|
||||||
db_path: PathBuf,
|
_db_path: PathBuf,
|
||||||
#[cfg(feature = "vectordb")]
|
#[cfg(feature = "vectordb")]
|
||||||
client: Option<Arc<Qdrant>>,
|
client: Option<Arc<Qdrant>>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ pub enum ComponentType {
|
||||||
pub struct WebaState {
|
pub struct WebaState {
|
||||||
apps: RwLock<HashMap<Uuid, WebApp>>,
|
apps: RwLock<HashMap<Uuid, WebApp>>,
|
||||||
pages: RwLock<HashMap<Uuid, WebAppPage>>,
|
pages: RwLock<HashMap<Uuid, WebAppPage>>,
|
||||||
components: RwLock<HashMap<Uuid, WebAppComponent>>,
|
_components: RwLock<HashMap<Uuid, WebAppComponent>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WebaState {
|
impl WebaState {
|
||||||
|
|
@ -100,7 +100,7 @@ impl WebaState {
|
||||||
Self {
|
Self {
|
||||||
apps: RwLock::new(HashMap::new()),
|
apps: RwLock::new(HashMap::new()),
|
||||||
pages: RwLock::new(HashMap::new()),
|
pages: RwLock::new(HashMap::new()),
|
||||||
components: RwLock::new(HashMap::new()),
|
_components: RwLock::new(HashMap::new()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue