Only node-red is allowed to run CVE audit

This commit is contained in:
2026-08-19 15:47:44 +02:00
parent d0066a9d6d
commit db173af1c9
+9
View File
@@ -461,6 +461,15 @@ def telemetry():
@app.route('/api/security/cve-audit', methods=['POST', 'GET']) @app.route('/api/security/cve-audit', methods=['POST', 'GET'])
def run_cve_audit(): def run_cve_audit():
"""Protected endpoint triggered by Node-RED using REST API + API Key.""" """Protected endpoint triggered by Node-RED using REST API + API Key."""
# Only node-red is allowed in this endpoint
if g.device_id != "node-red":
return jsonify({
"@odata.error": {
"code": "403",
"message": "Forbidden: Not allowed to trigger CVE audit"
}
}), 403
audit_results = shodan_auditor.audit_server_vulnerabilities() audit_results = shodan_auditor.audit_server_vulnerabilities()
inserted = cve_audit_results.insert_one({ inserted = cve_audit_results.insert_one({