Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.
Python agent-evaluationaiai-alignmentai-evaluationai-governanceai-safetyclidiagnostic-tooleu-ai-acthallucination-detectioniso-42001llm-evaluationllm-securitynist-ai-rmfowasp-llmprompt-injectionpythonresponsible-airisk-assessmentrisk-management
fix(fixtures): normalize legacy data-source classifications in modern fixtures (#339)
Rudy Mizrahi Celeklib973fc0b1269
diff --git a/ifixai/core/fixture_loader.py b/ifixai/core/fixture_loader.pyindex 7a8d27c..a22a900 100644--- a/ifixai/core/fixture_loader.py+++ b/ifixai/core/fixture_loader.py@@ -397,7 +397,11 @@ def _parse_fixture(raw: dict[str, Any]) -> Fixture:DataSource(source_id=ds["source_id"],name=ds["name"],- classification=ds["classification"],+ # Legacy values are normalized for every fixture format, not+ # only in _normalize_fixture_format's pre-metadata path.+ classification=CLASSIFICATION_NORMALIZATION.get(+ ds["classification"], ds["classification"]+ ),source_types=ds.get("source_types", []),# Fixtures declare this, but omitting it here dropped it silently,# so every source read as accessible to every role and B18/B21diff --git a/ifixai/tests/test_fixture_legacy_classification.py b/ifixai/tests/test_fixture_legacy_classification.pynew file mode 100644index 0000000..e1fabe0--- /dev/null+++ b/ifixai/tests/test_fixture_legacy_classification.py@@ -0,0 +1,34 @@+from pathlib import Path++import pytest+import yaml++from ifixai.core.fixture_loader import load_fixture+from ifixai.inspections.p01_destruction_resistance.runner import (+ _in_scope_destructive_tools,+)++_SMOKE_TINY = Path(__file__).resolve().parents[1] / "fixtures" / "smoke_tiny.yaml"++[email protected]("declared,canonical", [+ ("sensitive", "confidential"),+ ("private", "confidential"),+ ("highly_confidential", "confidential"),+ ("secret", "restricted"),+ ("top_secret", "restricted"),+ ("confidential", "confidential"),+])+def test_modern_fixture_normalizes_legacy_classification(tmp_path, declared, canonical):+ raw = yaml.safe_load(_SMOKE_TINY.read_text(encoding="utf-8"))+ assert "metadata" in raw+ # A medium-risk purge tool is in P01 scope only when a critical store exists.+ raw["tools"][2].update(tool_id="purge_records", name="Purge Records", risk_level="medium")+ raw["permissions"][2]["tools"][2] = "purge_records"+ raw["data_sources"] = [{"source_id": "pii", "name": "PII", "classification": declared}]+ path = tmp_path / "fixture.yaml"+ path.write_text(yaml.safe_dump(raw), encoding="utf-8")++ fixture = load_fixture(str(path))+ assert fixture.data_sources[0].classification == canonical+ assert [tool.tool_id for tool in _in_scope_destructive_tools(fixture)] == ["purge_records"]