Skip to main content

hf-auth-helper

Set up safe, scoped Hugging Face authentication for agents.

Coding agents that read untrusted content (web pages, issues, datasets) can be prompt-injected. If such an agent holds a normal write token, one injection can delete your datasets, Spaces, and buckets. hf-auth-helper sets up propose-only access instead: the agent can read and open pull requests, but a human has to merge — nothing the agent does is irreversible.

What the agent can do with a token set up this way:

  • Read the models, datasets, Spaces, and buckets in its scope (plus whatever optional reads you grant: collections, gated models, …).
  • Propose changes to any git-based repo — models, datasets, Spaces — as pull requests with real commits, ready for your review.
  • Open and comment on discussions, and manage its own pull requests.

What it cannot do, no matter how it is prompted:

  • Merge pull requests (even its own), push to branches, or change any repository settings.
  • Write to buckets at all: buckets have no pull-request mechanism and no version history, so any write would be unreviewable and unrecoverable — bucket write access is never part of any selection. Buckets stay read-only for the agent.
  • Delete or overwrite anything, anywhere.

The trade-off to know about: the token can still read everything you scope it to, so exfiltration of readable data remains your residual risk — see the threat model in the spec.

Usage

uvx hf-auth-helper agent login

One interactive command:

  1. Recommended or customize — accept the field-tested access settings, or answer plain-language yes/no questions ("Read gated models?", "Read your billing usage?", …) to narrow them. Reading repo contents and opening pull requests are always included; write access never is.
  2. Organizations — if you're already logged into the hf CLI, your orgs are detected and offered as a checklist; otherwise enter names manually.
  3. Token form — a summary of what the token will be able to do, then the Hugging Face token page URL with your scopes preselected. Open it on any device (the tool assumes you may be SSH'd into a remote box and only opens a local browser if you say yes); name the token and click create.
  4. Verification — paste the token (input stays hidden) and it is checked against the Hub: if its scopes allow anything beyond reading and opening pull requests, it is refused with the violating permissions named, and nothing is stored. Differences from what you configured are reported.
  5. Storage — keep it as a named hf CLI profile (activate with hf auth switch), make it the primary token (your current login is preserved as a named profile, never destroyed), or write an HF_TOKEN= line into an env file for a single agent process.

Scripting (no prompts when not a TTY; flags select resources and destinations, never scopes):

uvx hf-auth-helper agent login --org my-org --profile my-agent
uvx hf-auth-helper agent login --env /path/to/agent/.env
uvx hf-auth-helper agent login --url-only        # just print the prefill URL

Whatever you select, write capability is limited to opening PRs and discussions. A token created this way cannot push to main, merge PRs, modify buckets, change settings, or delete anything. What it can still do is read everything you granted it — see the threat model in docs/SPECIFICATION.md for why "nothing irreversible" is the guarantee, not "nothing leaks".

The full behavior contract, threat model, and design rationale live in docs/SPECIFICATION.md.

License

MIT

Metadata

Release files for hf-auth-helper 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hf-auth-helper 0.1.1
File Size Uploaded Provenance
hf_auth_helper-0.1.1.tar.gz 689.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hf-auth-helper 0.1.1
File Interpreter ABI Platform
hf_auth_helper-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / hf_auth_helper-0.1.1.tar.gz

Download URL hf_auth_helper-0.1.1.tar.gz
Size 689.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6691510498f273c721e058dfa569283a617d2de76879a8806220070c280bdfb9
BLAKE2b-256 checksum
How to use checksums
617e57a97beea7512552a26ff026abd79cbae2cc99197696f068907f02d11feb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hf_auth_helper-0.1.1-py3-none-any.whl

Download URL hf_auth_helper-0.1.1-py3-none-any.whl
Size 794.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1a55ca7e3d61173a8bf1c15909897b88591e14e04c6e2e6325fa6e926016136
BLAKE2b-256 checksum
How to use checksums
42e406b3544ae980ef8a54f000ff227b9fa88c493f8ddcf920aa376746e7cbc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for hf-auth-helper 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page