petter2025 commited on
Commit
f516920
·
verified ·
1 Parent(s): 046e6cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
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
- # REFINED: detected requires explicit detection signal in OSS output
731
- # Not just existence of detection_data, but evidence of actual detection
732
  detected = False
733
  if isinstance(detection_data, dict):
734
  # Look for explicit detection signals that OSS should provide
735
- detection_signals = ["signal", "anomaly", "finding", "detected", "alert", "indicator"]
736
- detected = any(k in detection_data for k in detection_signals)
 
 
 
 
 
 
 
 
 
 
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