Hub rules-huggingface

rules-huggingface

v3 public Verified

Hugging Face

Hugging Face is a platform for building, training, and deploying state-of-the-art machine learning models. These rules govern model hosting, dataset management, and API interaction on the Hugging Face Hub for AI agents.

@sigmashakeinc 2 pulls 6 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-huggingface →
Severity
5 error 1 warn 0 info
demo.cast
Hugging Face is a platform for building, training, and deploying state-of-the-art machine learning models. These rules govern model hosting, dataset management, and API interaction on the Hugging Face Hub for AI agents.

Rules index

6 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

huggingface

huggingface-block-unsafe-patterns error block

trust_remote_code=True allows the model repository to execute arbitrary Python code on your machine during model loading — a critical RCE vector. Only set this for repositories you have personally audited. Pin the revision parameter to a specific commit hash so future repo changes cannot inject new code: from_pretrained(..., revision='abc123', trust_remote_code=True).

Rule source requires an active Pro or Enterprise subscription.
huggingface-no-dataset-load-script-trust error block

load_dataset(..., trust_remote_code=True) runs the dataset's loading script on your machine. A malicious or compromised dataset repository can execute arbitrary code. Review the dataset loading script before enabling this flag, and pin the revision.

Rule source requires an active Pro or Enterprise subscription.
huggingface-no-hardcoded-hf-token error block

HuggingFace API token hardcoded in source code. Tokens exposed in git history give read/write access to all your private models and datasets. Use os.environ['HF_TOKEN'] or login() via the CLI and store the token in ~/.cache/huggingface/token.

Rule source requires an active Pro or Enterprise subscription.
huggingface-no-pipeline-trust-remote-code error block

pipeline(..., trust_remote_code=True) executes arbitrary code from the model repository. Same risk as from_pretrained with trust_remote_code — pin a specific revision hash and only use audited repositories.

Rule source requires an active Pro or Enterprise subscription.
huggingface-no-unsafe-pickle-load error block

torch.load() deserializes Python pickles by default, enabling arbitrary code execution from untrusted .pt/.pth model files (CWE-502). Use torch.load(..., weights_only=True) (PyTorch ≥2.0) to restrict deserialization to tensor data only, or use safetensors format.

Rule source requires an active Pro or Enterprise subscription.
huggingface-no-unverified-model-source warning log

Loading a HuggingFace model without pinning a revision= hash means future pushes to the repo can silently change the model weights or tokenizer. Pin the exact commit: from_pretrained('org/model', revision='<commit-sha>') to ensure reproducibility and supply-chain integrity.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
bb7484ce32908f272871402cbc3b3b32240318af39c09e253fd9acaffd0e78f3
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-huggingface/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-huggingface. The published version only bumps when a maintainer resyncs.

No commit history available.