Setup Alpine Proxy with DevGuard Dependency Proxy
Alpine Linux is the base of many container images, so every apk add in a Dockerfile or CI job pulls system packages into your builds. The DevGuard dependency proxy sits between apk and the Alpine mirror. It checks every .apk download against your package rules and the OSV dataset to block known malicious packages.
- Registry URL:
<your-devguard-url>/api/v1/dependency-proxy/<secret>/apk/alpine
Replace <secret> with the dependency proxy secret of your organization, project or repository. The complete proxy URL is shown in its Dependency Proxy Settings in DevGuard.
Configuration
apk reads its package sources from /etc/apk/repositories. Point every entry at DevGuard:
Afterwards, the file looks like this:
https://<your-devguard-url>/api/v1/dependency-proxy/<secret>/apk/alpine/v3.20/main
https://<your-devguard-url>/api/v1/dependency-proxy/<secret>/apk/alpine/v3.20/community
The proxy modifies the alpine package index (APKINDEX.tar.gz) to include only the allowed packages. Therefore it's necessary to add the following public key to your system so that apk can verify the index signature:
Replace <alpine-key-file> with the file name of the signing key, which looks like devguard-dependency-proxy-1a2b3c4d.rsa.pub. It is derived from the key's fingerprint, so the full key URL is shown in the Dependency Proxy Settings next to the proxy URL. Keep the file name when you save the key to /etc/apk/keys/, because apk picks the key by the name stored in the index signature.
On startup, the proxy blocks all requests until the malicious package database is fully loaded. This initialization period prevents cache poisoning. See Cache Management for details.
How Alpine packages are handled
Alpine packages are matched as alpine/<package>, for example pkg.name == "alpine/curl", with pkg.ecosystem == "apk".
Testing
DevGuard ships a test package, fake-malicious-package, that is permanently flagged as malicious for all versions. It does not exist in the Alpine mirror, so apk cannot request it, but a direct download must be rejected: