Fix clear-text logging of exceptions in security_audit.py
Some checks failed
Multi-Node Blockchain Health Monitoring / health-check (push) Has been cancelled
P2P Network Verification / p2p-verification (push) Has been cancelled

This commit is contained in:
aitbc
2026-04-25 21:10:26 +02:00
parent 2e00574e8e
commit bd095fbc4d

View File

@@ -76,7 +76,7 @@ class SecurityAudit:
self.results["warnings"].append(issue) self.results["warnings"].append(issue)
except Exception as e: except Exception as e:
logger.error(f"Error in {category_name} check") logger.error(f"Error in {category_name} check: {type(e).__name__}")
self.results["findings"].append({ self.results["findings"].append({
"category": category_name, "category": category_name,
"score": 0, "score": 0,
@@ -124,7 +124,7 @@ class SecurityAudit:
}) })
score -= 1 score -= 1
except Exception as e: except Exception as e:
logger.warning(f"Could not check {pattern}: {e}") logger.warning(f"Could not check {pattern}: {type(e).__name__}")
# Check for world-writable files # Check for world-writable files
try: try:
@@ -142,7 +142,7 @@ class SecurityAudit:
}) })
score -= min(5, len(writable_files)) score -= min(5, len(writable_files))
except Exception as e: except Exception as e:
logger.warning(f"Could not check world-writable files: {e}") logger.warning(f"Could not check world-writable files: {type(e).__name__}")
return max(0, score), issues return max(0, score), issues
@@ -325,7 +325,7 @@ class SecurityAudit:
}) })
score -= 1 score -= 1
except Exception as e: except Exception as e:
logger.warning(f"Could not analyze dependencies: {e}") logger.warning(f"Could not analyze dependencies: {type(e).__name__}")
# Check for poetry.lock or requirements.txt # Check for poetry.lock or requirements.txt
lock_files = ["poetry.lock", "requirements.txt"] lock_files = ["poetry.lock", "requirements.txt"]