AID-M-002.002: Cryptographic Integrity Verification
Pillars: data, infra, model, app
Lifecycle: building, validation
Scope boundary
Owns creation and verification of whole-artifact cryptographic digests and signatures for stored, transferred, loaded, or admission-bound datasets, models, configurations, and related artifacts, bound to the expected identity and provenance record. It does not decide release promotion or own continuous drift monitoring.
AID-M-002.001: AID-M-002.002 proves that artifact bytes match trusted integrity metadata; AID-M-002.001 proves version identity and derivation lineage. Integrity verification and reproducible version history are complementary but independently evidenced claims.
AID-H-020.001: AID-M-002.002 verifies a complete artifact as one integrity object; AID-H-020.001 signs and verifies individual retrieval chunks so partial knowledge-base content cannot be substituted at query time. A valid whole-artifact digest does not prove the identity of each runtime-retrieved chunk, and chunk signatures do not replace release-artifact verification.
AID-D-004.001: AID-M-002.002 owns the authoritative whole-artifact digest and signature verification used at ingestion, transfer, load, or admission; AID-D-004.001 independently replays those checks over a declared candidate or deployed snapshot and emits integrity-drift findings. The same promotion-time verification cannot earn a second PASS under Detect, and a later detector result does not replace artifact admission.
AID-H-003.002: AID-M-002.002 supplies whole-artifact and signed-member integrity evidence; AID-H-003.002 owns the final model promotion, deployment, load and reload decision. A successful digest or signer verification cannot authorize a loader or earn duplicate admission credit.
Implementation guidance
- AID-M-002.002-G001: Generate and verify whole-artifact checksums (e.g., SHA-256) for datasets, models, and container images at critical pipeline stages.
- AID-M-002.002-G002: Sign single-file artifacts or complete model bundles under a pinned identity, verify their exact byte/member integrity, and supply evidence to the canonical model release/load gate.
AID-M-002.002-G001
Concept:
We generate a cryptographic hash (e.g. SHA-256) for each critical artifact (dataset, feature store export, model weights) at ingestion/build time. We store that hash in a trusted metadata store. Any job that later consumes that artifact must recompute the hash and compare. If it doesn't match, the job stops immediately instead of silently training on or deploying a tampered file.
Step 1: Generate Hash on Data Ingestion
# integrity/hash_file.py
import hashlib
def sha256_file(path):
h = hashlib.sha256()
with open(path, "rb") as f:
for block in iter(lambda: f.read(4096), b""):
h.update(block)
return h.hexdigest()
if __name__ == "__main__":
dataset_hash = sha256_file("data/creditcard.csv")
print(f"SHA256(data/creditcard.csv)={dataset_hash}")
# Store dataset_hash in a secure metadata store:
# - MLflow tag
# - signed manifest file
# - internal registry DB
Step 2: Enforce Hash Check Before Training or Serving
# training_or_inference_gate.py
from pathlib import Path
from integrity.hash_file import sha256_file
# The protected digest file is mounted read-only only after its detached signature is verified.
EXPECTED_HASH = Path("/run/aidefend/verified/data-creditcard.sha256").read_text(encoding="ascii").strip()
if len(EXPECTED_HASH) != 64 or any(ch not in "0123456789abcdef" for ch in EXPECTED_HASH):
raise RuntimeError("verified digest has invalid SHA-256 format")
ACTUAL_HASH = sha256_file("data/creditcard.csv")
if ACTUAL_HASH != EXPECTED_HASH:
raise RuntimeError("Data integrity check failed: unexpected content hash")
print("Data integrity check passed; proceeding with training or inference.")
print("integrity gate completed for the verified artifact digest")Action: Make this hash verification the very first step of any training, fine-tuning, or inference job that uses high-risk data or model weights. If verification fails, the pipeline must hard-stop and alert security. This prevents silent poisoning or corruption from propagating further.
AID-M-002.002-G002
Step 1: Keep blob signing for a true single-file artifact
# Run in a trusted CI identity after producing the immutable artifact.
MODEL_FILE=model.safetensors
cosign sign-blob --yes --bundle "$MODEL_FILE.sigstore.json" "$MODEL_FILE"
# The integrity verifier pins both identity and issuer.
cosign verify-blob --bundle "$MODEL_FILE.sigstore.json" --certificate-identity "https://github.com/my-org/my-repo/.github/workflows/build.yml@refs/heads/main" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" "$MODEL_FILE"Step 2: Sign a complete multi-file model bundle
Install model-signing from an organization-approved, hash-locked dependency file or a pinned CI image. Keep the detached signature outside the signed directory so the signature cannot accidentally become an input to its own manifest.
# File layout:
# release/model/ exact directory promoted to the registry
# artifacts/model.oms.sig detached OMS-compatible Sigstore bundle
MODEL_DIR=release/model
OMS_SIGNATURE=artifacts/model.oms.sig
EXPECTED_IDENTITY="https://github.com/my-org/my-repo/.github/workflows/build.yml@refs/heads/main"
EXPECTED_ISSUER="https://token.actions.githubusercontent.com"
mkdir -p artifacts
model_signing digest "$MODEL_DIR" > artifacts/model.digest.txt
model_signing sign "$MODEL_DIR" --signature "$OMS_SIGNATURE"
model_signing verify "$MODEL_DIR" --signature "$OMS_SIGNATURE" --identity "$EXPECTED_IDENTITY" --identity-provider "$EXPECTED_ISSUER"Step 3: Prove the verifier rejects member tampering
# Negative test: mutate one signed member in an isolated copy.
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
cp -a "$MODEL_DIR" "$TMP_DIR/model"
printf '
' >> "$TMP_DIR/model/config.json"
if model_signing verify "$TMP_DIR/model" --signature "$OMS_SIGNATURE" --identity "$EXPECTED_IDENTITY" --identity-provider "$EXPECTED_ISSUER"; then
echo "ERROR: tampered model bundle verified" >&2
exit 1
fiVerify safely
At deployment, verify from the registry download in a clean environment and recompute the directory manifest; do not rely on the build job's self-reported success.
Integrity handoff
This primitive proves signer identity and whole-artifact/member integrity; it does not authorize model promotion, deployment or load. Supply the verified signature, digest and population result to the canonical AID-H-003.002-G003 coordinator on its same protected artifact/tree. A valid OMS or blob signature alone cannot replace composition, source-status, loader policy or final release approval.
Open-source tools
- sha256sum
- GnuPG
- Cosign
- Notation CLI (OCI artifact signature verification)
- Sigstore model-signing
- pyca/cryptography
- MLflow
Commercial / hosted tools
- AWS Key Management Service
- Azure Key Vault
- Google Cloud Key Management Service
- DigiCert Software Trust Manager
- GlobalSign Code Signing
Threat mappings
MITRE ATLAS
- AML.T0010 AI Supply Chain Compromise
- AML.T0115 Publish Poisoned AI Artifacts
- AML.T0074 Masquerading
- AML.T0020 Training Data Poisoning
- AML.T0010.002 AI Supply Chain Compromise: Data
- AML.T0010.003 AI Supply Chain Compromise: Model
- AML.T0010.004 AI Supply Chain Compromise: Container Registry
- AML.T0115.001 Publish Poisoned AI Artifacts: Models
- AML.T0059 Erode Dataset Integrity
- AML.T0076 Corrupt AI Model
- AML.T0112.001 Machine Compromise: AI Artifacts
MAESTRO
- Data Tampering (L2)
- Compromised Container Images (L4)
- Supply Chain Attacks (Cross-Layer)
OWASP LLM Top 10 2026
- LLM04:2026 Supply Chain
- LLM05:2026 Data and Model Poisoning
OWASP ML Top 10 2023
- ML06:2023 AI Supply Chain Attacks
- ML10:2023 Model Poisoning
OWASP Top 10 for Agentic Applications 2026
- ASI04:2026 Agentic Supply Chain Vulnerabilities
NIST Adversarial Machine Learning 2025
- NISTAML.051 Model Poisoning (Supply Chain)
Cisco Integrated AI Security and Safety Framework
- AITech-6.1 Training Data Poisoning (Rejects training data altered after its approved signed digest was established)
Google Secure AI Framework 2.0 - Risks
- MST: Model Source Tampering
- MDT: Model Deployment Tampering
Databricks AI Security Framework 3.0
- Raw Data 1.7: Lack of data trustworthiness
- Raw Data 1.11: Compromised 3rd-party datasets
- Model 7.3: ML Supply chain vulnerabilities
- Model 7.4: Source code control attack
- Algorithms 5.4: Malicious libraries