Security & Bundle Integrity
Security in PAM has three layers. The runtime ships hardened defaults for everything it controls: client addresses, error output, request limits, metrics, WebSocket origins and the control plane. The installer and self-updater verify every PAM release before it replaces the binary you run. And the build tools (pam build, pam package, pam release) produce bundles with a SHA-256 manifest and checksums you can verify anywhere.
A bundle proves the integrity of the files it records. It does not replace a trusted release channel, secret management or operating-system isolation; you still need those.
Runtime Defaults
Section titled “Runtime Defaults”These defaults are part of PAM’s security contract. Changing one is a behaviour change listed in the changelog:
X-Forwarded-Foris honoured only fromtrustedProxies/PAM_TRUSTED_PROXIES, and the client is the rightmost untrusted entry.- The worker
/metricspath answers loopback peers only, unlessmetricsTokenormetricsPublicis set. - WebSocket upgrades from another site’s page get
403unless the origin is inwebsocketOrigins(orcorsOrigins). - Request bodies held by PHP are bounded per worker (
maxInflightBodyBytes). - Errors never expose messages or traces unless
exposeErrorsis enabled; in server modedisplay_errorsis off andlog_errorson. - The control plane refuses a non-loopback address without
PAM_ADMIN_TOKENorPAM_ADMIN_TOKEN_FILE, and compares tokens in constant time. - Runtime directories, hand-off sockets, environment files, dashboards and signing keys must be private to the current user; PAM refuses group- or world-readable ones.
The full table, with the options that change each default, is in Production.
Verifying the PAM Installation
Section titled “Verifying the PAM Installation”The official installer downloads the release archive and its .sha256 file, requires exactly one lowercase SHA-256 entry for the exact archive name, and compares it with the downloaded bytes before extracting. Extraction refuses symlinks, hard links, devices and any entry that is not a regular file or directory. The new binary must report exactly the requested version before it is activated with an atomic rename.
To pin an archive digest you obtained through an independent channel:
PAM_VERSION=v2.2.27 PAM_EXPECTED_ARCHIVE_SHA256=<sha256> sh install.shpam self-update goes further. Official binaries embed the identity of the release-signing key; before running the installer, the updater verifies an Ed25519-signed manifest for the target platform and the authorized archive digest. It never downgrades silently:
pam self-update --check # verify and report a newer authorized releasepam self-update v2.2.27 # install a specific versionpam self-update v2.2.20 --allow-downgrade # an explicit, intentional downgradeLocal builds compiled without a signing identity refuse to self-update.
Building a Bundle
Section titled “Building a Bundle”pam build creates a relocatable directory with your application, its Composer dependencies, the PAM binary and the exact private libphp it was built against:
pam build --entry index.php --output dist● PRODUCTION BUNDLE READY──────────────────────────────────────────────────────────── Output /srv/acme/dist Launch /srv/acme/dist/bin/pam-rundist/├── app/ your project files├── bin/pam the PAM binary├── bin/pam-run launcher: sets LD_LIBRARY_PATH and runs app/<entry>├── lib/libphp.so the private PHP runtime└── manifest.json PAM version, target, entry and a SHA-256 for every fileThe manifest lists every file, sorted by path, with its size and digest:
{ "pamVersion": "2.2.27", "target": "x86_64-linux", "entry": "index.php", "phpLibrary": "lib/libphp.so", "files": [ { "path": "app/index.php", "bytes": 372, "sha256": "ec6f0b93404b8b40d373b5ddc5330f3e15a56222fbf0454c67db1..." } ]}--entry defaults to index.php and --output to dist.
What Goes Into the Bundle
Section titled “What Goes Into the Bundle”pam build copies the project directory except .git, .pam, .env, node_modules and target. Symlinks that resolve inside the project are followed; symlinks pointing outside it fail the build.
Verifying a Bundle
Section titled “Verifying a Bundle”The launcher does not re-hash the bundle on every start, so verify it in your pipeline, after copying and before switching traffic. With jq and sha256sum:
cd distjq -r '.files[] | "\(.sha256) \(.path)"' manifest.json | sha256sum --check --quiet && echo "bundle OK"Any modified file is reported (app/index.php: FAILED) and the command exits non-zero. Then run pam doctor inside the final artifact or image.
Packaging a Release
Section titled “Packaging a Release”pam package builds the bundle and archives it as a versioned, platform-specific tar.gz with a neighbouring .sha256 file:
pam package --output artifactsPackaged /srv/acme/artifacts/acme-api-1.0.0-linux-x86_64.tar.gzChecksum /srv/acme/artifacts/acme-api-1.0.0-linux-x86_64.tar.gz.sha256The archive name comes from the name and version in pam.json. pam package refuses to overwrite an existing archive. Verify it on the receiving host:
sha256sum --check acme-api-1.0.0-linux-x86_64.tar.gz.sha256Publish checksums through a channel independent of the archive: a checksum downloaded from the same compromised location proves nothing. Native and Desktop projects delegate pam package to their own platform packagers.
The Release Gate
Section titled “The Release Gate”pam release runs every local gate in order and stops at the first failure:
pam release --check # gates only, nothing is packagedpam release # gates, then pam package| Step | Command |
|---|---|
| 1 | pam doctor --ci |
| 2 | pam lint |
| 3 | pam test |
| 4 (PAM Native projects) | pam sign |
5 (without --check) |
pam package |
In a Product workspace, the gate runs doctor, lint and test for the server, native and desktop apps plus the shared contract tests, and a full release also runs pam release:verify on the generated dist/product-release.json.
Auditing Dependencies
Section titled “Auditing Dependencies”Run Composer’s advisory audit through PAM’s embedded Composer:
pam composer audit --lockedpam outdated lists direct dependency updates (--all includes transitive ones).
Signed Distribution Evidence
Section titled “Signed Distribution Evidence”For claims that an exact package installs, upgrades and rolls back on a clean host, PAM uses signed evidence manifests that can be verified offline:
umask 077openssl rand -base64 32 > evidence.keypam distribution:sign evidence/draft.json --key evidence.key --output evidence/distribution.jsonpam distribution:verify evidence/distribution.jsonpam distribution:verify evidence/distribution.json --json- The key is a padded base64 32-byte Ed25519 seed in a file with no group or other permissions; symlinked keys are rejected.
distribution:signvalidates the draft (codes, timing, referenced file sizes and hashes) before signing, never overwrites its output, and writes only the public key and its identity into the manifest.distribution:verifyre-reads every referenced file and checks the signature without network access.
What PAM Does Not Provide
Section titled “What PAM Does Not Provide”Earlier 0.1.x releases had experimental pam sandbox, pam record, pam replay, signed bootstrap snapshots and WASI/RPC commands. They do not exist in PAM 1.0 and later; do not copy those examples into automation. Use container or host sandboxing (the hardened packaging/pam.service unit, a non-root container), pam composer audit, and application-owned incident capture where you need those controls.
How PAM Itself Is Tested
Section titled “How PAM Itself Is Tested”Every pull request to the PAM repository runs cargo deny, composer audit, six fuzz targets (HTTP request path, multipart, C header reader, dispatch envelope, page cache policy, shared table) and integration tests under AddressSanitizer and UndefinedBehaviorSanitizer, plus CodeQL for C/C++, Rust and workflows. A nightly job runs an RSS soak and Valgrind. A green run reduces known risks; it does not prove the absence of leaks in extensions or Composer packages your application loads.
Reporting a Vulnerability
Section titled “Reporting a Vulnerability”Do not open a public issue for a vulnerability. Follow the Security Policy to report it privately.
Next Steps
Section titled “Next Steps”- Production for the full hardening checklist.
- Declarative Deploys to roll bundles out and back.
- Compatibility for supported platforms and PHP versions.