Skip to main content
SkillTotal

Is huggingface-hub safe?

What huggingface-hub does

huggingface-hub is the Python client library and hf command-line tool for the Hugging Face Hub. It downloads and publishes models, datasets and other repositories there, and runs inference and jobs. The PyPI author field lists Hugging Face, Inc., and the code lives in huggingface/huggingface_hub. It downloads files into a local cache, uploads files and folders to repositories, and authenticates with Hub access tokens set through hf auth login or HF_TOKEN. Before installing, create a fine-grained token limited to the repositories you need, as the Hub token documentation recommends for production use.

No malicious indicators - review capabilities before installing
Notable — review in context (a capability is not a malicious indicator):
  • Python shell/command execution
  • Python filesystem read
  • Python filesystem write/delete

What to do: Nothing here argues against installing it. Grant the capabilities it lists only if you expect the tool to need them.

huggingface-hub is a PyPI package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators. It can: delegated authentication, filesystem read, filesystem write and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 0/100 (low).

huggingface-hub 2.4.0

PyPI package · pypi:huggingface-hub
LOW
0
/ 100 risk score
Snapshot · scanned Nov 13, 2026 · huggingface-hub@2.4.0 · engine 1.1.0 / ruleset 100

Get notified when this component changes

Change alerts aren't live yet. Leave your email and we'll let you know when they launch. We use it only for this and delete it on request.

Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of huggingface-hub's authors. Report a false positive.

Capabilities — what this component can do (not a risk score):
delegated authenticationfilesystem readfilesystem writeshell execution

Behavioral traits

How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.

Execution authority
Tool Access Control / Direct Tool Access
Filesystem reach
Tool Execution Context
Delegated authentication
Tool Execution Context / User Delegated Credentials

Findings (4)

CapabilityPython shell/command executionnot scored · severity highST-SHELL-PY

The component can run operating-system commands or spawn processes.

result = subprocess.run(
            [self.binary_path, "-json"],
            input=full_query,
            capture_output=True,
            text=True,
            encoding="utf-8",
            check=False,
        )
result = subprocess.run(cmd)
subprocess.run([uv_path, "venv", str(venv_dir)], check=True)
subprocess.run(install_cmd, check=True, timeout=_EXTENSIONS_PIP_INSTALL_TIMEOUT)
return subprocess.run([str(python), "-c", ""], capture_output=True).returncode == 0
return subprocess.call([str(executable_path)] + args)
return subprocess.call(["sh", str(executable_path)] + args)
subprocess.run(
        "git config lfs.customtransfer.multipart.path hf".split(),
        check=True,
        cwd=local_path,
    )
subprocess.run(
        f"git config lfs.customtransfer.multipart.args {LFS_MULTIPART_UPLOAD_COMMAND}".split(),
        check=True,
        cwd=local_path,
    )
res = subprocess.run(command, start_new_session=True)
subprocess.call([*_hf_argv(), "skills", "update", DEFAULT_SKILL_ID, "-g"])
return subprocess.run(
        command,
        capture_output=True,
        check=check,
        encoding="utf-8",
        errors="replace",  # if not utf-8, replace char by �
        cwd=folder or os.getcwd(),
        **kwargs,
    )
with subprocess.Popen(
        command,
        stdin=subprocess.PIPE,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        encoding="utf-8",
        errors="replace",  # if not utf-8, replace char by �
        cwd=fold …

Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.

Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; avoid shell=True.

CapabilityPython filesystem readnot scored · severity mediumST-FS-PY-READ

The component reads files from disk.

with open(filter_file) as f:
with open(plan_file) as f:
with open(self.path_or_fileobj, "rb") as file:
with open(local_path, "rb") as f:
with open(path, encoding="utf-8") as f:
return path.read_text(encoding="utf-8-sig")
existing = path.read_text() if path.exists() else ""
with open(tmp_path, "rb") as f:
parsed = json.loads(local_path.read_text(encoding="utf-8"))
content = (skill_dir / "SKILL.md").read_text(encoding="utf-8")
script=str(local_path), header=parse_uv_script_header(local_path.read_text(encoding="utf-8"))
yield UvScript(script=script, header=parse_uv_script_header(path.read_text(encoding="utf-8")))
return body_file.read_text(encoding="utf-8")
data = json.loads(manifest_path.read_text())
return (_get_extension_dir(manifest.short_name) / _LATEST_COMMIT_FILENAME).read_text() or None
with open(filepath, "rb") as file:
if not ref_path.exists() or commit_hash != ref_path.read_text():
with open(paths.file_path, "rb") as f:
with open(revision_file) as f:
resolved=ref_path.read_text().strip(), initial=revision, repo_id=repo_id, repo_type=repo_type
with open(index_file) as f:
resp = get_session().post(f"{self.endpoint}/uploads", headers=headers, content=path.read_bytes())

Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.

Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.

CapabilityPython filesystem write/deletenot scored · severity mediumST-FS-PY-WRITE

The component writes or deletes files on disk.

with open(plan_file, "w") as f:
tag_path.write_text(CACHEDIR_TAG_CONTENT)
path.write_text(_completion_script("fish"))
(install_dir / "SKILL.md").write_text(content, encoding="utf-8")
shutil.rmtree(install_dir)
local_path.write_bytes(response.content)
manifest_path.write_text(json.dumps(data, indent=2, sort_keys=True))
shutil.rmtree(extension_dir)
shutil.rmtree(extension_dir)
shutil.rmtree(extension_dir, ignore_errors=True)
(_get_extension_dir(short_name) / _LATEST_COMMIT_FILENAME).write_text(sha or "")
executable_path.write_bytes(binary)
shutil.rmtree(venv_dir, ignore_errors=True)
shutil.copytree(central_skill_path, link_path)
shutil.copytree(temp_dir.name, persistent_temp_dir, dirs_exist_ok=True)
with open(path, "w") as f:
shutil.move(abs_src, abs_dst, copy_function=_copy_no_matter_what)
shutil.copyfile(abs_src, abs_dst)
tmp_path.write_text(commit_hash)

Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.

Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.

CapabilityDelegated authentication (OAuth 2.0 / OIDC)not scored · severity lowST-AUTH-DELEGATED

An OAuth 2.0 / OpenID Connect delegated-authentication flow was detected (authorization-code / refresh-token / token-exchange grant, an OIDC authorize/discovery endpoint or id_token, or a delegation library). Tools authenticate with the end user's delegated, scoped credentials rather than a long-lived embedded service credential. (7 occurrence(s) shown as evidence).

from authlib.integrations.base_client.errors import MismatchingStateError
from authlib.integrations.starlette_client import OAuth
server_metadata_url=constants.OPENID_PROVIDER_URL + "/.well-known/openid-configuration",
_TOKEN_EXCHANGE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:token-exchange"
_ID_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:id_token"
_REFRESH_TOKEN_GRANT_TYPE = "refresh_token"

Fix: Delegated auth is a lower-blast-radius execution context than an embedded static credential. Confirm the requested scopes are minimal and that tokens are never logged or forwarded off-host.

How attackers abuse these capabilities

Interactive labs on the attack class behind the rules above. They show the technique, not anything found in huggingface-hub.

Maintain huggingface-hub?

Check the next package before your agent installs it

The free Claude Code plugin scans each npm, PyPI or MCP package with this report's open-source engine before the install command runs. It runs on your machine and needs no account.

Check your own component

Run the same evidence-backed scan on any MCP server, agent skill, or package.

Scan your own component

How we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →