Skip to content

# [BUG/ML-OPS] Fix Data Poisoning in XGBoost Inference Matrix (Pandas NaN Handling) #98

Closed

Description

@squid-protocol

🛑 Problem Statement

In security_auditor.py, the Pandas DataFrame construction for the XGBoost malware model currently utilizes .fillna(0) and fill_value=0. When the orchestrator degrades into Zero-Dependency Mode, advanced features (like Betweenness Centrality or Token Mass) are intentionally bypassed.

By hard-forcing these missing values to 0, the pipeline mathematically poisons the ML inference matrix. It explicitly instructs the model that a feature was measured as exactly zero, rather than treating it as missing data. XGBoost natively supports NaN and routes missing values accurately through its decision trees. Forcing a 0 skews threat detection weights and introduces artificial data drift.

🎯 Objective

Restore native missing-data handling (NaN) within the ML-Ops pipeline to guarantee accurate SAST (Static Application Security Testing) threat inference, especially when operating in air-gapped or dependency-restricted DevSecOps environments.

🛠️ Proposed Implementation

Update the construct_feature_matrix() logic in security_auditor.py:

  • Change fill_value=0 to fill_value=np.nan during Pandas DataFrame reindexing.
  • Remove the .fillna(0) call entirely to allow XGBoost to process the sparse matrix and true null values gracefully.

✅ Acceptance Criteria

  • construct_feature_matrix() applies np.nan for omitted structural columns.
  • XGBoost ingests the NaN sparse matrix without throwing tensor or type errors.
  • Zero-Dependency Mode no longer artificially skews malware classification outcomes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugml-ops

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions