Registry / http-networking / policyfile

policyfile

JSON →
library0.0.6jsnpmunverified

The `policyfile` package provides a server designed to respond to Adobe Flash Player's cross-domain socket policy requests. It allows developers to specify which origins are permitted to connect to a Flash application, effectively managing security for older Flash-based projects. The current stable version is 0.0.6, indicating a very early stage of development, and it appears to have seen no significant updates in over a decade. Its release cadence is effectively non-existent. A key differentiator was its ability to either run as a dedicated server, typically on port 843, or integrate inline with an existing HTTP server (e.g., on port 80) to handle policy requests when Flash Player falls back from its primary policy port. This package is built directly on Node.js's native `net` and `http` modules. However, with Adobe Flash Player reaching End-of-Life in 2020, this package is now largely obsolete and should not be used for new projects or in production environments.

npm install policyfile
INSTALL
IMPORT
SIG · POLICYFILE
P
policyfile
http-networkingjavascriptv0.0.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createServer
const policyfile = require('policyfile'); const server = policyfile.createServer();
import { createServer } from 'policyfile';
This package is CommonJS-only and relies on `require()`. Attempting to use ESM `import` statements will result in a runtime error. Flash Player reached EOL in 2020, making this package obsolete.
PolicyFileServer
const PolicyFileServer = require('policyfile'); const server = new PolicyFileServer.createServer();
const { PolicyFileServer } = require('policyfile');
The primary export is a function `createServer` directly attached to the module export, not a class or named export `PolicyFileServer`.

Demonstrates how to create a Flash Socket Policy File server, listen on a specific port, and optionally integrate it to serve policy requests over an existing HTTP server, addressing Flash Player's fallback mechanism, along with dynamic origin management.

const policyfile = require('policyfile'); const http = require('http'); // Create a new policy file server instance. // By default, it allows all origins ('*:*') but can be restricted. const pf = policyfile.createServer({ log: true }, ['localhost:8080', 'myflashapp.com:443']); // Start a regular HTTP server. Flash Player will query this if port 843 fails. const httpServer = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello from the main HTTP server!\n'); }); const httpPort = process.env.HTTP_PORT ?? 8080; httpServer.listen(httpPort, () => { console.log(`HTTP Server listening on port ${httpPort}`); }); // Start the policy server. // The default port is 843, which often requires root. Using 1337 for demonstration. const policyPort = process.env.POLICY_PORT ?? 1337; pf.listen(policyPort, httpServer, function() { console.log(`Flash Policy File Server listening on port ${policyPort}`); console.log(`Configured origins: ${pf.options.origins.join(', ')}`); }); // Add more origins dynamically setTimeout(() => { pf.add('anotherdomain.net:80'); console.log('Added anotherdomain.net:80'); }, 3000); // Clean up on process exit process.on('SIGINT', () => { console.log('Shutting down servers...'); pf.close(); httpServer.close(() => { console.log('HTTP server closed.'); process.exit(0); }); });
Debug
Known issues
breakingAdobe Flash Player reached End-of-Life (EOL) on December 31, 2020, and major browser vendors have removed support. This package is therefore obsolete and should not be used for new development or in production environments as its core functionality is no longer relevant or functional.
fix
Migrate away from Flash-dependent technologies. For new projects, use modern web standards like WebSockets for real-time communication.
affects: >=0.0.1
gotchaThe default port for Flash Socket Policy Files is 843. On Linux/macOS, ports below 1024 typically require root privileges to bind. Attempting to listen on port 843 without sufficient permissions will cause an 'EACCES' error.
fix
Either run the Node.js process with elevated privileges (e.g., using `sudo`), or configure port forwarding from port 843 to a non-privileged port (e.g., 1024 or higher) where the server can run without root. Alternatively, the Flash Player will fall back to querying policy on the HTTP server's port (e.g., 80 or 443).
affects: >=0.0.1
deprecatedThis package is effectively abandoned. The last commit was over a decade ago, and it's on version 0.0.6, indicating it never reached a stable 1.0 release. There will be no further updates, bug fixes, or security patches.
fix
Avoid using this package. If you are somehow still maintaining a Flash application, consider migrating to a modern equivalent or implementing a very simple, custom server for the specific policy file needed, if absolutely unavoidable.
affects: >=0.0.1
Errors
Common errors & fixes
Error: listen EADDRINUSE :::843
The default port 843 (or a specified custom port) is already in use by another process on the system.
fix
Identify and stop the process currently using the port, or configure the `policyfile` server to listen on a different, available port using `pf.listen(YOUR_PORT_NUMBER, ...)`.
Error: listen EACCES: permission denied 0.0.0.0:843
The server is attempting to listen on a privileged port (e.g., 843, 80) without sufficient user permissions (e.g., not running as root).
fix
Run the Node.js application with administrator/root privileges (e.g., `sudo node app.js`), or change the `listen` port to a non-privileged port (e.g., 1024 or higher). For port 843, port forwarding is often used in production.
ReferenceError: require is not defined
Attempting to use `require()` syntax within an ECMAScript Module (ESM) context in Node.js.
fix
This package is CommonJS-only. Ensure your project is configured for CommonJS (e.g., by omitting `"type": "module"` in `package.json` or by using a `.cjs` file extension for the file importing `policyfile`). Alternatively, consider that this package is obsolete due to Flash EOL.
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
10
OpenAI (training)
1
Resources
policyfile — npm install policyfile · libregistry