Skip to content

v0.3.1

Choose a tag to compare

@github-actions github-actions released this 19 Nov 01:27
· 35 commits to main since this release

Security fixes and a clean-up of the code after a security audit and a code-quality audit of v0.3.0. No critical or high severity issues were found. Upgrading is recommended, especially if pull-through caching is on.

Security

  • Pull-through no longer adds upstream content to repositories created locally. A repository created by modelctl push, hf upload or the API never goes to the upstream hub, so someone who registers the same name upstream cannot add branches or revisions to it. For names the registry does not hold at all, use --pull-through-allow to keep internal namespaces from being fetched.
  • Request bodies are bounded in size and time. An unauthenticated client could make the server write large files to its temporary directory through the web sign-in form.
  • Pull-through is bounded. At most 64 fetches wait (beyond that the answer is 503 with Retry-After), revisions are validated before the upstream is asked, and --pull-through-max-file-bytes optionally limits file size.
  • The upstream token is only sent to the configured upstream host, and redirects or pagination links to loopback, private or link-local addresses are refused.
  • A signed upload URL stops working when the token that obtained it is revoked or loses the write role.
  • The database file is created owner-only (0600) on Linux and macOS.
  • Files the upstream keeps in git are only reused from content that was itself mirrored.
  • modelctl pull stops at the listed size, and file paths containing control characters are refused on write.

New

  • modelctl verify re-hashes stored files and reports any that are missing or damaged. See the operations guide for the repair steps.
  • A flag for every non-secret server setting, for example --backup-interval, --s3-bucket and --pull-through-allow. The environment variables still work; secrets remain environment-only.
  • --max-blob-bytes optionally limits the size of an uploaded file.

Fixed

  • REGISTRY_REQUIRE_AUTH=yes (and on) left downloads open, because only true and 1 were understood. yes, no, on and off are now accepted, and an unrecognised value stops the server from starting.
  • modelctl restore --replace keeps the old database's write-ahead log with the old database, and a failed restore puts the old database back.
  • Two backups taken in the same second no longer overwrite each other.
  • A file that finished fetching at the wrong moment could briefly be reported as missing (404).
  • Background fetches and scheduled backups are stopped and waited for at shutdown, before the database closes.
  • A local failure during pull-through is reported as 500 with a generic message, not as an upstream failure that included a server path. A failing upstream during a mirror is now 502 with the reason.
  • A database failure is no longer reported as "already exists" or as a bad token.
  • modelctl token create could print an empty token and exit 0 if the answer could not be read.
  • File listings no longer wait behind large downloads in pull-through.

Upgrade notes

Nothing in the data directory changes, and a v0.3.0 data directory opens as it is. Things you may notice:

  • An unrecognised value in a boolean setting (REGISTRY_REQUIRE_AUTH, REGISTRY_REQUIRE_ADMIN_TOKEN, REGISTRY_PULL_THROUGH, REGISTRY_S3_REDIRECT, REGISTRY_RESTORE_IF_EMPTY) now stops start-up with a message naming the setting.
  • The example compose.yaml publishes the port on 127.0.0.1 only; change the port mapping to expose it.
  • A supplied admin token shorter than 32 characters logs a warning at start. It still works.
  • Mirroring from another registry that redirects downloads to a bucket on a private address is refused; turn REGISTRY_S3_REDIRECT off on the source registry.
  • GET /api/v1/backups/snapshot is the address for a snapshot; the v0.3.0 address GET /api/v1/backup/snapshot still works.
  • delete, gc and backup now answers can carry a warning field.

Full Changelog: v0.3.0...v0.3.1