Private packages

In artifactory mode, Pratique can host your internal npm, Python and Composer packages next to the public ones. Only reserved names can be published, so a private package can never shadow a public one, and a reserved name is never looked up upstream.

How private names work

Dependency confusion happens when a package manager finds a public package with the same name as an internal one, and installs the public one. Pratique prevents it with reserved names. You list your internal name patterns, and Pratique never asks a public registry about a name that matches them.

  • Reserved names are never looked up upstream. If nothing is published under a reserved name, clients get a 404 that says it is a reserved internal name.
  • Published names stay private. A name that has been published is never looked up upstream, even if you later remove its pattern.
  • Only reserved names can be published. A publish under any other name gets a 403, so a publish token can't put a package called lodash in front of the real one.

Reserve your internal names

Set PRATIQUE_RESERVED to a comma-separated list of patterns, or access.reserved in the config file. A * matches any characters except /.

yamlpratique.yaml
access:
  reserved: ["@acme/*", "acme-*", "acme/*"]

A pattern that isn't valid stops the server from starting, because a pattern that can't match would send internal names upstream. Set reserved names before anyone uses Pratique, so internal names are never sent to a public registry.

Create a publish token

Only admins can create a token that publishes. Under Access tokens, select Can publish private packages when you create the token. Other tokens get a 403 when they try to publish.

  • For CI, choose A bot or CI system under For. A bot token keeps publish access until you revoke it.
  • A personal token with publish access must expire within 90 days. Choose 90 days or 30 days under Expires.
  • A personal token loses publish access when its owner signs in and is no longer an admin. It keeps read access.

When the reserved list is set, the Connect page shows admins the publish commands with your server's address filled in.

Publish

npm

Put the publish token in .npmrc, as on the Connect page, then publish to Pratique's npm address:

bashpublish an npm package
npm publish --registry=https://pratique.example.com/npm/

The version must be a valid semantic version, and each publish must add one new version with one tarball. Pratique doesn't support deprecating or unpublishing.

Python

Upload with uv publish or twine upload to the /pypi/legacy/ address:

bashpublish a Python package
uv publish --publish-url https://pratique.example.com/pypi/legacy/ --token YOUR_TOKEN

twine upload --repository-url https://pratique.example.com/pypi/legacy/ \
  -u __token__ -p YOUR_TOKEN dist/*

Each file's name must match the package name and version it is uploaded as.

Composer

Composer has no publish command, so upload a zip with curl. The zip must contain composer.json, at its root or in its one top-level folder. Pratique reads the name from that file, and the version from the version parameter, which is required.

bashpublish a Composer package
curl -u token:YOUR_TOKEN --upload-file package.zip \
  'https://pratique.example.com/composer/upload?version=1.0.0'

Go

Pratique doesn't host Go modules. A Go module whose path matches a reserved name is never sent to the public proxy or the checksum database. Set GOPRIVATE so the go command fetches those modules directly from your own source host. See Go.

Published versions can't change

Once a version is published, it stays as it is. This is what lets clients trust a version they installed before.

  • Publishing the same version again gets a 409 that says published versions can't change.
  • Another spelling of a published version also gets a 409. Package managers treat 1.0, v1.0.0 and 1.0.0+build as the same version as 1.0.0, so Pratique refuses them too.

To ship a fix, publish a new version.

Who can publish a name

A private name belongs to whoever published it first: the token's team, or the person or bot if the token has no team. After that, a publish from any other owner gets a 403 that names the owner, and the attempt shows as Report refused under Activity. So one leaked publish token can't publish over every internal package.

To give a name to a team, an admin opens the package's Policy tab and uses Owner. Choose a team, or Whoever publishes next to free the name for the next publish. A project or build with the same name shares the owner, so changing it in one place changes it for all of them.

If you set claim_needs_team, a token with no team can't claim a new private name. See who can report under a name for the same rules applied to projects and builds.

What Pratique checks

Your team made these packages, so most checks don't apply to them:

  • No quarantine. A published version is available at once.
  • No malware check. Threat feeds are not consulted for private packages.
  • A person's block still applies. If an internal release is bad, block it on the package's page and clients can no longer download it. See blocked and allowed.

Every publish is recorded in the audit log, with who published which file and its SHA-256 hash.

Storage and modes

  • Storage cleanup never removes private packages, because nothing else has a copy. See storage.
  • Back them up. On SQLite and local disk, blobs/ in the data directory is the only copy of your private packages.
  • Firewall mode hosts no private packages. Publishing is refused, and the server won't start in firewall mode while it still holds any. Reserved names still never go upstream, so point those scopes at your own registry. See firewall mode.