@snyxex/pipex 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +220 -2
- package/SECURITY.md +41 -0
- package/dist/index.d.mts +765 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/docs/architecture.md +124 -0
- package/docs/encryption-v4-migration.md +45 -0
- package/docs/enterprise.md +280 -0
- package/package.json +91 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Changes are documented here for users and downstream maintainers. Versioned releases are also listed under [GitHub Releases](https://github.com/Snyxex/PipeX/releases). This file is not a claim that the package has been published on npm.
|
|
4
|
+
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
- Maintained Jenkins CI now validates current Node.js 22, 24, and 26 lines.
|
|
8
|
+
- Release checks cover package tarballs, clean consumers, a dependency audit, and repository AI-skill validation.
|
|
9
|
+
- Added open-source security, contribution, conduct, and release documentation.
|
|
10
|
+
- Retired unused Docker-based CI scripts that still referenced Node.js 20.
|
|
11
|
+
- Prepared a minimal consumer-facing npm tarball with release metadata and verified packaging tests.
|
|
12
|
+
|
|
13
|
+
## 1.0.2 — release candidate (not published to npm)
|
|
14
|
+
|
|
15
|
+
- Prepared the first npm distribution under the scoped name `@snyxex/pipex`; the unrelated unscoped `pipex` package is not this project.
|
|
16
|
+
- Kept the Standard Core ESM entrypoint and `@snyxex/pipex/plugins/kms` subpath, and aligned downstream examples and consumer tests.
|
|
17
|
+
- Added a protected, read-only release-candidate verification pipeline that audits dependencies, checks Git history, verifies packed consumers and archives the tarball digest.
|
|
18
|
+
- Fixed the GitHub dependency consumer smoke test by running a syntax-checked ESM fixture instead of an embedded import expression.
|
|
19
|
+
- Publication is pending separate verification and maintainer authorization.
|
|
20
|
+
|
|
21
|
+
## [1.0.1] - 2026-09-12
|
|
22
|
+
|
|
23
|
+
- Improved reliability of KMS provider timeout handling.
|
|
24
|
+
|
|
25
|
+
## [1.0.0] - 2026-09-12
|
|
26
|
+
|
|
27
|
+
- First stable Standard Core release, including bounded binary, stream and file transformations and security-focused plugin infrastructure.
|
|
28
|
+
|
|
29
|
+
[1.0.1]: https://github.com/Snyxex/PipeX/releases/tag/v1.0.1
|
|
30
|
+
[1.0.0]: https://github.com/Snyxex/PipeX/releases/tag/v1.0.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 snyxe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,221 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PipeX
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
PipeX is a typed Node.js data-transformation engine for composing compression, authenticated encryption, integrity checks, validation, and custom plugins across buffers, files, and streams.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 22 or newer (Jenkins tests current 22.x, 24.x and 26.x)
|
|
8
|
+
- ESM (`"type": "module"`)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
The npm package is being prepared as `@snyxex/pipex`; publication and
|
|
13
|
+
scope ownership must be verified before installing it from the registry.
|
|
14
|
+
|
|
15
|
+
After publication:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @snyxex/pipex
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Until then, install the development version directly from this repository:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install github:Snyxex/PipeX
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The older unscoped package `pipex` belongs to a different npm publisher.
|
|
28
|
+
Do not install it expecting this project.
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { randomBytes } from 'node:crypto';
|
|
34
|
+
import { DataEngine, CompressionPlugin, EncryptionPlugin } from '@snyxex/pipex';
|
|
35
|
+
|
|
36
|
+
const engine = new DataEngine({
|
|
37
|
+
maxInputBytes: 64 * 1024 * 1024,
|
|
38
|
+
operationTimeoutMs: 30_000,
|
|
39
|
+
})
|
|
40
|
+
.use(new CompressionPlugin({ type: 'gzip', level: 6 }))
|
|
41
|
+
.use(new EncryptionPlugin({ algorithm: 'aes-256-gcm', key: randomBytes(32) }));
|
|
42
|
+
|
|
43
|
+
const result = await engine.binary.run({ id: 1, username: 'dev' });
|
|
44
|
+
const restored = await engine.binary.undo(result, { timeoutMs: 30_000 });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Keep encryption keys outside source control and load them from a secret manager or KMS in production.
|
|
48
|
+
Generic KMS adapters expose queryable operation capabilities and receive an
|
|
49
|
+
`AbortSignal` governed by the engine deadline. See
|
|
50
|
+
[Production operations](./docs/enterprise.md#encryption-and-key-management).
|
|
51
|
+
|
|
52
|
+
## Choosing the right API
|
|
53
|
+
|
|
54
|
+
| Use case | API | Notes |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Transform an object or buffer in memory | `binary.run()` / `binary.undo()` | Applies the configured plugin chain |
|
|
57
|
+
| Encode or decode MessagePack | `binary.pack()` / `binary.unpack()` | Serialization only; no plugins |
|
|
58
|
+
| Transform an existing file | `file.process()` / `file.reverse()` | Atomic output replacement and bounded streaming |
|
|
59
|
+
| Encode object frames to a file | `file.pack()` / `file.unpack()` | Serialization only; includes a manifest |
|
|
60
|
+
| Transform Node.js byte streams | `stream.pipe()` | Applies plugins with backpressure |
|
|
61
|
+
| Encode object streams | `stream.pack()` / `stream.unpack()` | Serialization only; includes a manifest |
|
|
62
|
+
|
|
63
|
+
`pack()` and `unpack()` never encrypt, compress, or hash. Use `run()`/`undo()`, `process()`/`reverse()`, or `stream.pipe()` for plugin transformations.
|
|
64
|
+
|
|
65
|
+
For results received over a transport or reconstructed from storage, specify an
|
|
66
|
+
application-owned type: `engine.binary.undo(received, { expectedType: 'object' })`.
|
|
67
|
+
Never derive `expectedType` or the raw-buffer `forceType` from untrusted metadata.
|
|
68
|
+
Locally produced results retain an implicit trusted type while their Buffer
|
|
69
|
+
identity is preserved. This tightens the decoding contract without changing the
|
|
70
|
+
ciphertext format; modified type metadata is rejected before decryption.
|
|
71
|
+
|
|
72
|
+
## Files
|
|
73
|
+
|
|
74
|
+
Output paths are constrained to `allowedRoot`. When it is omitted, PipeX uses the current working directory. Parent directories must already exist.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
await engine.file.process('./data/input.bin', './data/input.pipex', './data', { timeoutMs: 60_000 });
|
|
78
|
+
await engine.file.reverse('./data/input.pipex', './data/restored.bin', './data');
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
PipeX rejects traversal, symlink escapes, special files, and identical or hard-linked
|
|
82
|
+
input/output files. File sessions acquire native handles before plugins run.
|
|
83
|
+
Windows uses root-relative opens and handle-based replacement; POSIX uses
|
|
84
|
+
no-follow directory-relative opens and a private temporary directory. Outputs
|
|
85
|
+
are replaced only after successful processing. Koffi supplies the native bindings
|
|
86
|
+
and is loaded only when using the file controller. Keep roots under the service
|
|
87
|
+
account's exclusive control; see [File-system boundary](./docs/enterprise.md#file-system-boundary).
|
|
88
|
+
|
|
89
|
+
## Streams and cancellation
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { createReadStream, createWriteStream } from 'node:fs';
|
|
93
|
+
|
|
94
|
+
const controller = new AbortController();
|
|
95
|
+
await engine.stream.pipe(
|
|
96
|
+
createReadStream('./input.bin'),
|
|
97
|
+
createWriteStream('./output.pipex'),
|
|
98
|
+
false,
|
|
99
|
+
{ signal: controller.signal, timeoutMs: 30_000 },
|
|
100
|
+
);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Encryption streams use the versioned `PXAE` format and authenticate bounded
|
|
104
|
+
frames before releasing each frame. A final authenticated frame detects
|
|
105
|
+
truncation, while sequence numbers detect reordering and duplication. HMAC
|
|
106
|
+
verification still withholds the complete bounded message because its appended
|
|
107
|
+
digest authenticates the stream only at EOF.
|
|
108
|
+
|
|
109
|
+
`EncryptionPlugin` defaults to 64 KiB plaintext frames (constrained by
|
|
110
|
+
`maxFrameBytes`). Its v4 writer never emits the old unversioned format. The
|
|
111
|
+
legacy reader is enabled temporarily for migration and can be disabled with
|
|
112
|
+
`allowLegacyDecrypt: false`. See [Encryption v4 migration](./docs/encryption-v4-migration.md).
|
|
113
|
+
|
|
114
|
+
## Configuration
|
|
115
|
+
|
|
116
|
+
Built-in plugins are registered automatically:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
const engine = await DataEngine.fromConfig({
|
|
120
|
+
limits: { maxInputBytes: 32 * 1024 * 1024, operationTimeoutMs: 15_000 },
|
|
121
|
+
logger,
|
|
122
|
+
auditLogger,
|
|
123
|
+
plugins: [
|
|
124
|
+
{ name: 'compression', options: { type: 'brotli', level: 5 } },
|
|
125
|
+
{ name: 'hashing', options: { algorithm: 'sha256', secret: process.env.PIPEX_HMAC_SECRET } },
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
console.log(engine.pipeline);
|
|
130
|
+
// ['compression@3.0.0', 'hashing@3.0.0']
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Available names are `compression`, `encryption`, `hashing`, `benchmark`, `worker-pool`, `validation`, and `kms-encryption`. Options containing runtime objects, such as Zod schemas or KMS providers, must be supplied programmatically.
|
|
134
|
+
|
|
135
|
+
The local `worker-pool` plugin executes caller-owned worker module exports with
|
|
136
|
+
bounded threads, queue admission, task deadlines, and deterministic shutdown.
|
|
137
|
+
See [Local worker pools](./docs/enterprise.md#local-worker-pools).
|
|
138
|
+
|
|
139
|
+
`fromConfig()` also accepts `limits`, `logger`, `tracer`, `auditLogger`, `dlq`, `schema`, and `schemaRegistry`. `dlq` is the compatibility name for an optional caller-provided failure sink; PipeX does not persist or replay its contents. Integration objects are validated immediately so configuration mistakes fail during startup.
|
|
140
|
+
|
|
141
|
+
Register a custom plugin with `DataEngine.registerPlugin('redact', RedactPlugin)`.
|
|
142
|
+
|
|
143
|
+
`engine.plugins` and `engine.pipeline` return immutable snapshots. Configure the pipeline before starting work; `use()` rejects changes while any operation is active.
|
|
144
|
+
|
|
145
|
+
## Custom plugins
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
import { BasePlugin, type ProcessorContext } from '@snyxex/pipex';
|
|
149
|
+
|
|
150
|
+
class PrefixPlugin extends BasePlugin {
|
|
151
|
+
readonly name = 'prefix';
|
|
152
|
+
readonly version = '1.0.0';
|
|
153
|
+
|
|
154
|
+
process(data: Buffer, _context: ProcessorContext): Buffer {
|
|
155
|
+
return Buffer.concat([Buffer.from('PX:'), data]);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
reverse(data: Buffer, _context: ProcessorContext): Buffer {
|
|
159
|
+
return data.subarray(3);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Plugins without `createStream()` use a chunk-based fallback. They must be safe to run independently for every stream chunk. Plugins that need whole-message semantics should implement a framed native stream or use the binary API.
|
|
165
|
+
|
|
166
|
+
## Operational hooks
|
|
167
|
+
|
|
168
|
+
PipeX supports structured logging, audit logging, tracing, progress events,
|
|
169
|
+
bounded retries, deadlines, concurrency limits, and an optional caller-provided
|
|
170
|
+
failure sink. The existing `dlq`/`setDlq()` names remain supported for
|
|
171
|
+
compatibility. See [Failure-sink semantics](./docs/enterprise.md#retries-and-caller-provided-failure-sink)
|
|
172
|
+
before routing potentially sensitive chunks. Observer callback failures are
|
|
173
|
+
isolated from data processing.
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
engine.setLogger(logger).setAuditLogger(auditLogger).on('error', (error, requestId) => {
|
|
177
|
+
console.error({ requestId, error: error.message });
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
See [Architecture](./docs/architecture.md) and [Production operations](./docs/enterprise.md).
|
|
182
|
+
|
|
183
|
+
## Development
|
|
184
|
+
|
|
185
|
+
Use Node.js 22 or newer with npm (Jenkins validates current Node.js 22, 24, and 26 releases).
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm ci --ignore-scripts --no-audit --no-fund
|
|
189
|
+
npm run quality:ci
|
|
190
|
+
npm audit --audit-level=high
|
|
191
|
+
npm pack --dry-run --json --ignore-scripts
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`npm run quality:ci` executes the production typecheck, build, tooling, unit,
|
|
195
|
+
integration, security, package, consumer, and short performance suites.
|
|
196
|
+
Jenkins is the only configured CI system; the root `Jenkinsfile` tests PRs
|
|
197
|
+
and branches and archives an npm tarball but does not publish it.
|
|
198
|
+
|
|
199
|
+
For release planning see [Release procedure](docs/releasing.md) and
|
|
200
|
+
[Release readiness](docs/npm-release-readiness.md). Perform a full secret scan,
|
|
201
|
+
verify the npm publishing identity, and use a separately protected release job
|
|
202
|
+
before distributing any tarball.
|
|
203
|
+
|
|
204
|
+
Large throughput benchmarking is intentionally excluded from `npm test` and
|
|
205
|
+
CI. Run it manually with `npm run benchmark:large` and
|
|
206
|
+
`PIPEX_BENCHMARK_BYTES` as needed.
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT © Snyxex
|
|
211
|
+
|
|
212
|
+
## Contributing and security
|
|
213
|
+
|
|
214
|
+
- [Contributing guide](CONTRIBUTING.md)
|
|
215
|
+
- [Support](SUPPORT.md)
|
|
216
|
+
- [Security policy and responsible disclosure](SECURITY.md)
|
|
217
|
+
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
218
|
+
- [Changelog](CHANGELOG.md)
|
|
219
|
+
- [Release preparation](docs/releasing.md)
|
|
220
|
+
|
|
221
|
+
Use GitHub issues for ordinary bugs and features, **not** for undisclosed vulnerabilities. Jenkins is the project CI system; no GitHub Actions workflows are configured.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
PipeX handles potentially sensitive application data and includes cryptographic, file-system, and streaming operations. Security reports are taken seriously.
|
|
4
|
+
|
|
5
|
+
## Supported versions
|
|
6
|
+
|
|
7
|
+
| Version | Security fixes |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `main` | Active development and security fixes |
|
|
10
|
+
| Latest stable 1.0.x release | Best-effort fixes for verified vulnerabilities |
|
|
11
|
+
| Older releases | No guaranteed backports |
|
|
12
|
+
|
|
13
|
+
Use the latest maintained version. Supported Node.js major versions are 22, 24, and 26; the minimum declared runtime version is Node.js 22.
|
|
14
|
+
|
|
15
|
+
## Report a vulnerability privately
|
|
16
|
+
|
|
17
|
+
**Do not create a public issue, discussion, or pull request containing an undisclosed vulnerability, exploit, credential, or personal information.**
|
|
18
|
+
|
|
19
|
+
Use [GitHub's private vulnerability reporting for PipeX](https://github.com/Snyxex/PipeX/security/advisories/new), **if the repository has private reporting enabled**. If that form is unavailable, open a public issue requesting a private reporting channel **without including technical vulnerability details**, and wait for a secure route before submitting the report.
|
|
20
|
+
|
|
21
|
+
A useful report includes the affected versions and environment, impact, concise reproduction steps or a proof of concept, and mitigations if known. Do not submit real user data, production secrets, or live credentials.
|
|
22
|
+
|
|
23
|
+
Maintainers will triage reports on a best-effort basis, coordinate remediation and disclosure with reporters, and publish a GitHub Security Advisory when appropriate. No guaranteed response or patch SLA is offered. Please allow time for a fix before public disclosure.
|
|
24
|
+
|
|
25
|
+
If you discover exposed credentials, treat them as compromised: revoke or rotate them at their provider immediately. Removing a file in a new commit does not remove it from Git history.
|
|
26
|
+
|
|
27
|
+
## Security boundaries
|
|
28
|
+
|
|
29
|
+
- `binary.pack()`, `binary.unpack()`, and the stream/file pack/unpack APIs are serialization, **not encryption**.
|
|
30
|
+
- Encrypted data should use authenticated encryption with properly generated, managed keys; never commit keys.
|
|
31
|
+
- Treat data and metadata received from another system as untrusted. Supply the expected result type from trusted application logic when undoing remotely sourced binary results.
|
|
32
|
+
- File operations require an application-controlled `allowedRoot`. Keep allowed roots writable only by trusted principals.
|
|
33
|
+
- Set appropriate size, concurrency, timeout, and framing limits; handle cancellation and stream backpressure.
|
|
34
|
+
- `dlq` / `setDlq()` are caller-owned failure sinks, not persistent replay or a queue.
|
|
35
|
+
- Consult [enterprise security guidance](docs/enterprise.md) and [encryption migration guidance](docs/encryption-v4-migration.md).
|
|
36
|
+
|
|
37
|
+
## Supply-chain practices
|
|
38
|
+
|
|
39
|
+
Jenkins is the only project CI system; no GitHub Actions workflow is used. Pull requests with untrusted code must not receive credentials or privileged shared-host access. Release credentials must be isolated from ordinary CI builds.
|
|
40
|
+
|
|
41
|
+
The history review and its limitations are recorded in [docs/security-history-review.md](docs/security-history-review.md). A regex review does **not** certify the repository or its full Git object database as secret-free.
|