Security
A PAM Desktop 2 application is a native program: its PHP worker runs with the rights of the user who started it, like any desktop application written in C++, Rust or Swift. There is no web content in the rendering path, so the browser-style sandbox of PAM Desktop 1.x (capabilities off by default, a command gateway between web content and PHP) no longer exists. Security comes from the limits the host enforces on its own services, from verified downloads and updates, and from how you handle untrusted input. This page states those boundaries plainly.
The process model
Section titled “The process model”| Process | Runs | Trust |
|---|---|---|
pam-desktop host |
Rust: windows, layout, rendering, modules | Trusted; verified against its published SHA-256 when downloaded |
| PHP worker | Your entry script and Composer packages | Trusted: it is your application, with the user’s rights |
Web pages in a WebView |
The system web engine | Untrusted |
| Data from the network, files, links and the clipboard | Anywhere | Untrusted |
The worker is an ordinary PHP process: it can use any PHP function, read any file the user can read and open any connection PHP allows. Treat every Composer dependency as code that runs with those rights, and keep composer.lock under review.
Limits the host enforces
Section titled “Limits the host enforces”The host modules have their own limits, independent of what PHP itself could do:
| Area | Enforced |
|---|---|
| HTTP module | HTTPS only (plain HTTP for loopback, or any host under dev); certificates checked against the system store; redirects never followed; 1 MiB request and 900 KiB response bodies; timeouts. |
| WebSocket | wss:// only (except loopback or dev); no credentials in URLs; at most 4 connections; bounded queues. |
| Files module | Every path is confined to pam-files/ of the data directory; .. and symbolic links that leave it are refused. Files::save() writes only where the user chose in the dialog, atomically. |
| Downloads | Absolute HTTPS URLs without credentials; 64 MiB by default, 256 MiB at most. |
| Secure storage | Secrets only in the system keychain or encrypted with AES-256-GCM under a key that is itself a keychain entry. Never stored in the clear: without a keychain, every call fails. |
| Frames and payloads | Explicit size limits on frames, messages, module payloads and query results; over a limit fails instead of growing a buffer. |
| Templates | Expressions are a safe subset evaluated by the framework, never eval(). Only public, non-static, non-magic methods can be called on values. |
In production (strict) mode, components that use dynamic property access ($this->{$name}) or eval/extract are refused at boot. pam desktop check reports them as PAM2104 and PAM2105 before you ship.
Web views
Section titled “Web views”A WebView shows content you do not control:
- Restrict navigation with
allowedHosts(); other hosts are refused. - Treat every
onMessagepayload as untrusted input: validate it before acting on it. - Never build
injectedJavaScript()from untrusted strings withoutjson_encode(). - Prefer opening external sites in the user’s browser with
Linking::open()over embedding them.
Links and files from outside
Section titled “Links and files from outside”Deep links (Linking::initial(), Linking::listen()), dropped files (onFilesDrop()), clipboard text and paths from file dialogs all come from outside your application. Parse links strictly against the routes you expect, and never execute or include a path you received.
Verified downloads
Section titled “Verified downloads”| What | Verification |
|---|---|
| The native host | vendor/bin/pam-desktop downloads the host of the installed package version from the GitHub release and verifies its published SHA-256. |
| The PAM runtime (Linux, macOS) | Installed only with consent. The release manifest’s Ed25519 signature is checked against the pinned PAM release key, the archive against the signed size and SHA-256, and it is unpacked in Rust with bounded, ownerless entries. |
| PHP on Windows | Installed only with consent. The archive must match both the SHA-256 windows.php.net publishes and the one PAM Desktop pins. |
| Application updates | An Ed25519-signed feed, signed size and SHA-256, per-file verification against the bundle manifest, atomic swap with rollback. See Signed Updates. |
Bundles
Section titled “Bundles”- The build excludes
.envand.env.*,.gitand development state, but ships other files in the project. Keep secrets out of the project directory and useexcludefor development files. - Bundled
php.inisetsexpose_php=Offanddisplay_errors=Off, and the configuration of the machine the application runs on is not read. - Sign macOS and Windows artifacts with
--sign; users and the operating systems trust signed applications. Linux bundles rely on the per-file manifest and your signed update feed. - An API key or client secret shipped in a desktop application is not secret. Keep secrets on your server, and use OAuth with PKCE (
Pam\Desktop\Auth) for user sign-in.
Screen capture protection
Section titled “Screen capture protection”Screen::secure() asks the system to exclude windows from screenshots on macOS and Windows; Linux does not enforce it. It reduces accidental exposure, not deliberate capture: never rely on it as a security control.
Reporting a vulnerability
Section titled “Reporting a vulnerability”Report security issues privately, never in public issues. See the security policy.