Update app.py
Browse files
app.py
CHANGED
|
@@ -727,13 +727,23 @@ def transform_arf_output_for_ui(raw_result: dict, scenario_name: str) -> dict:
|
|
| 727 |
# STEP 3: BUILD UI ANALYSIS (DERIVED, NOT INFERRED)
|
| 728 |
# ===================================================
|
| 729 |
|
| 730 |
-
#
|
| 731 |
-
#
|
| 732 |
detected = False
|
| 733 |
if isinstance(detection_data, dict):
|
| 734 |
# Look for explicit detection signals that OSS should provide
|
| 735 |
-
|
| 736 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 737 |
|
| 738 |
# CORRECTED: confidence = 0 if not in source (visibly conservative)
|
| 739 |
confidence = 0 # VISIBLY CONSERVATIVE DEFAULT
|
|
|
|
| 727 |
# STEP 3: BUILD UI ANALYSIS (DERIVED, NOT INFERRED)
|
| 728 |
# ===================================================
|
| 729 |
|
| 730 |
+
# SURGICAL FIX: Add "anomaly_detected" to detection_signals list
|
| 731 |
+
# REAL ARF OSS USES "anomaly_detected": true key
|
| 732 |
detected = False
|
| 733 |
if isinstance(detection_data, dict):
|
| 734 |
# Look for explicit detection signals that OSS should provide
|
| 735 |
+
# FIX: Added "anomaly_detected" to the list
|
| 736 |
+
detection_signals = ["signal", "anomaly", "finding", "detected", "alert", "indicator", "anomaly_detected"]
|
| 737 |
+
|
| 738 |
+
# Check for any detection signals in keys or values
|
| 739 |
+
for signal in detection_signals:
|
| 740 |
+
if signal in str(detection_data).lower():
|
| 741 |
+
detected = True
|
| 742 |
+
break
|
| 743 |
+
|
| 744 |
+
# ADDITIONAL DEFENSIVE CHECK: Direct boolean check for anomaly_detected
|
| 745 |
+
if not detected and "anomaly_detected" in detection_data:
|
| 746 |
+
detected = bool(detection_data["anomaly_detected"])
|
| 747 |
|
| 748 |
# CORRECTED: confidence = 0 if not in source (visibly conservative)
|
| 749 |
confidence = 0 # VISIBLY CONSERVATIVE DEFAULT
|