Enforce it

A proxy only protects clients that use it. Block the public registries so nothing can go around Pratique, or redirect them to Pratique at your web gateway, and check lockfiles in CI.

Why enforcement matters

Pratique decides what a client may install, but only for requests that reach it. A developer with a fresh laptop, a CI job with a default configuration, or an AI agent that runs pip install talks to the public registry directly. Those installs skip quarantine, the malware check and the audit log.

So treat a client configuration as a convenience, and the network as the control. Use one or more of these:

  • Block direct access from CI and developer machines, so the only way to the registries is through Pratique.
  • Redirect the registries to Pratique at your web gateway, so clients that aren't configured are sent there instead of failing quietly.
  • Check lockfiles in CI, so a lockfile that points around Pratique fails the build.

Block direct access

These hosts should be unreachable except from Pratique:

texthosts to block
registry.npmjs.org
registry.yarnpkg.com
pypi.org
files.pythonhosted.org
repo.packagist.org
packagist.org
api.github.com
codeload.github.com

api.github.com and codeload.github.com are on the list because Composer downloads package archives from them. Pratique's own server must still reach the registries, so leave its egress open. It also needs OSV for threat data and tuf-repo-cdn.sigstore.dev for provenance checks.

These registries sit behind CDNs with changing addresses, so blocking by IP address is unreliable. It is stronger to deny all egress by default and allow only what is needed. The examples below are starting points, so test them in your environment.

Kubernetes CI runners

This policy lets pods in the ci namespace reach only the pratique namespace and DNS. Add your other required destinations to it.

yamlNetworkPolicy
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: ci-egress-through-pratique
  namespace: ci
spec:
  podSelector: {}
  policyTypes: [Egress]
  egress:
    - to:
        - namespaceSelector:
            matchLabels: { kubernetes.io/metadata.name: pratique }
    - to:
        - namespaceSelector:
            matchLabels: { kubernetes.io/metadata.name: kube-system }
      ports:
        - { protocol: UDP, port: 53 }

Self-hosted runners

Allow egress to Pratique and your other required hosts in your firewall or egress proxy, then deny the rest.

GitHub-hosted runners

You don't control the network of GitHub-hosted runners, so you can't block the registries there. For a real guarantee, use self-hosted runners. On hosted runners, the lockfile check still catches mistakes.

Developer machines

Full enforcement on laptops usually needs a managed proxy, a web gateway or an endpoint policy. If your company has a web gateway, redirect the registries as described below. As a lighter step, distribute the client configuration and rely on the CI check.

Redirect at your web gateway

If your company inspects HTTPS at a secure web gateway or SASE service, such as Zscaler, Netskope, Cloudflare Gateway, Palo Alto Prisma Access or an on-premises proxy, you can redirect the registries to Pratique instead of only blocking them. This covers developer machines, CI and AI agents, with nothing to install on them.

Add one redirect rule per host. Keep the path and query, and use a 307 or 308 redirect:

Requests toRedirect to
https://registry.npmjs.org/*https://pratique.example.com/npm/*
https://registry.yarnpkg.com/*https://pratique.example.com/npm/*
https://pypi.org/simple/*https://pratique.example.com/pypi/simple/*
https://files.pythonhosted.org/packages/*https://pratique.example.com/pypi/packages/*
https://repo.packagist.org/*https://pratique.example.com/composer/*
https://proxy.golang.org/*https://pratique.example.com/go/*
https://sum.golang.org/*https://pratique.example.com/go/sumdb/sum.golang.org/*

Exempt Pratique's own server from these rules, so it can still reach the registries.

What clients see

  • A configured client sends its requests to Pratique directly, with its token. The redirect rules never touch it.
  • A client that isn't configured is redirected and gets a 401. The message says where to create a token and links to the Connect page, which shows how to set up the package manager. npm doesn't print a response body for a 401, so it shows the message as an npm notice line instead.
  • Tokens stay required. Package managers only send a token to the address they are configured for, so a redirected request never carries one. Nothing is downloaded without a token, so every download in the audit log still names a person or a bot.
  • Lockfiles that record public addresses, such as files.pythonhosted.org links in uv.lock, keep working once the client is configured, because those addresses are redirected too.

What can't be redirected

Keep blocking the hosts the rules don't cover: packagist.org, api.github.com and codeload.github.com. The two GitHub hosts serve far more than packages, so redirecting them isn't possible. A configured Composer client downloads archives through Pratique instead.

Without HTTPS inspection, a gateway can't see paths, so it can't redirect by path. Block the hosts instead.

Check lockfiles in CI

A lockfile can name a public registry, a Git repository or a direct URL. On a runner that can reach it, the install goes around Pratique. pratique lockcheck fails the build before the install runs, and names each entry:

bashfail the build on lockfiles that bypass Pratique
pratique lockcheck --registry https://pratique.example.com

It needs no token and fails when it finds no lockfiles. Add it to every pipeline, including those on hosted runners you can't lock down. See check lockfiles for the files it reads and example jobs.

Distribute client settings

Configured clients go straight to Pratique, so they never meet a block or a redirect. Distribute the settings from the Connect page with your usual tools, such as a dotfiles repository, device management, or the base images for CI. Each person then adds their own token. See tokens.

ini.npmrc, in the project or home directory
registry=https://pratique.example.com/npm/
//pratique.example.com/npm/:_authToken=YOUR_TOKEN
inipip.conf
[global]
index-url = https://token:YOUR_TOKEN@pratique.example.com/pypi/simple/

For uv, Composer and Go, see Python, Composer and Go. Keep tokens out of files you commit to a repository.