pentect 0.0.25
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/LICENSE +21 -0
- package/README.md +173 -0
- package/package.json +29 -0
- package/packaging/npm/bin/pentect.js +14 -0
- package/packaging/npm/install.js +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EdamAme-x
|
|
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
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Pentect
|
|
2
|
+
|
|
3
|
+
Pentect is a local security boundary for AI coding tools. It replaces secrets
|
|
4
|
+
and sensitive data with opaque handles before requests reach a model provider,
|
|
5
|
+
then resolves those handles only at trusted client tool boundaries.
|
|
6
|
+
|
|
7
|
+
Pentect currently supports Codex CLI, Claude Code, OpenCode, Pi, Codex App, and
|
|
8
|
+
Claude Desktop. It also provides standalone masking commands and sandboxed
|
|
9
|
+
WebAssembly plugins.
|
|
10
|
+
|
|
11
|
+
> Pentect is pre-1.0 security software. Unknown provider formats are blocked by
|
|
12
|
+
> default, but no filter can promise perfect detection. Keep provider and tool
|
|
13
|
+
> permissions narrow and review the documented limitations before production
|
|
14
|
+
> use.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Windows PowerShell:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
irm https://pentect.dev/install | iex
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Linux and macOS:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
curl -fsSL https://pentect.dev/install.sh | sh
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The installers detect the platform, download a GitHub Release asset, and verify
|
|
31
|
+
its SHA-256 checksum. Run `pentect doctor` after installation. Version-specific
|
|
32
|
+
installation is supported with `-Version X.Y.Z` in PowerShell or
|
|
33
|
+
`--version X.Y.Z` for `install.sh`.
|
|
34
|
+
|
|
35
|
+
Package managers are also supported:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
# Homebrew (macOS or Linux)
|
|
39
|
+
brew install EdamAme-x/pentect/pentect
|
|
40
|
+
|
|
41
|
+
# Nix
|
|
42
|
+
nix profile install github:EdamAme-x/pentect
|
|
43
|
+
|
|
44
|
+
# Nix, temporary shell
|
|
45
|
+
nix shell github:EdamAme-x/pentect
|
|
46
|
+
|
|
47
|
+
# Nix, pinned to a Pentect release
|
|
48
|
+
nix profile install github:EdamAme-x/pentect/nix-vX.Y.Z
|
|
49
|
+
|
|
50
|
+
# npm (downloads a checksummed release binary)
|
|
51
|
+
npm install --global github:EdamAme-x/pentect
|
|
52
|
+
|
|
53
|
+
# Cargo (builds from source)
|
|
54
|
+
cargo install --git https://github.com/EdamAme-x/pentect --locked pentect-cli
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Debian and Ubuntu users can configure the signed Pentect repository and install
|
|
58
|
+
the package with one command:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
curl -fsSL https://pentect.dev/install-apt.sh | sudo sh
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
When installed by Homebrew, Nix, or apt, use that package manager to update or
|
|
65
|
+
remove Pentect. The CLI detects managed installations and will not overwrite
|
|
66
|
+
package-owned files.
|
|
67
|
+
|
|
68
|
+
## Use
|
|
69
|
+
|
|
70
|
+
Launch a supported CLI through Pentect:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
pentect codex
|
|
74
|
+
pentect claude
|
|
75
|
+
pentect opencode --model openai/gpt-5
|
|
76
|
+
pentect pi --model openai/gpt-5
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Use a Responses- or Messages-compatible gateway without changing permanent
|
|
80
|
+
client configuration:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
pentect codex --upstream http://127.0.0.1:8080/openai/v1
|
|
84
|
+
pentect claude --upstream http://127.0.0.1:8080/anthropic
|
|
85
|
+
pentect opencode --model anthropic/claude-sonnet --upstream http://127.0.0.1:8080/openai/v1
|
|
86
|
+
pentect pi --model anthropic/claude-sonnet --upstream http://127.0.0.1:8080/openai/v1
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Launch a desktop app only when explicitly requested:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
pentect codex app
|
|
93
|
+
pentect claude app
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
These commands protect Codex mode and supported Claude Desktop Chat, Code, and
|
|
97
|
+
attachment traffic; they do not claim coverage for every Chat, Work, Cowork,
|
|
98
|
+
Voice, or future opaque route.
|
|
99
|
+
|
|
100
|
+
Mask text from stdin while preserving opaque handles:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
cat .env | pentect mask
|
|
104
|
+
cat terraform.tfvars | pentect mask
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
PowerShell:
|
|
108
|
+
|
|
109
|
+
```powershell
|
|
110
|
+
Get-Content .env -Raw | pentect mask
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Common maintenance commands:
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
pentect doctor [--json | --fix [--yes]]
|
|
117
|
+
pentect update [VERSION] [--check | --force]
|
|
118
|
+
pentect uninstall
|
|
119
|
+
pentect log [--json]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## What is protected
|
|
123
|
+
|
|
124
|
+
- Prompts and local tool results sent through supported model gateways
|
|
125
|
+
- Completed model tool-call arguments, resolved only for the local client tool
|
|
126
|
+
- dotenv, Terraform, Kubernetes, kubeconfig, AWS, npm, PyPI, JSON, and other
|
|
127
|
+
recognized structured configuration
|
|
128
|
+
- Inline images and documents that Pentect can inspect safely
|
|
129
|
+
- Supported UTF-8 Files API uploads
|
|
130
|
+
|
|
131
|
+
Binary uploads that Pentect cannot inspect or safely rewrite are blocked. File
|
|
132
|
+
IDs and remote URLs are accepted only when Pentect can establish safe coverage;
|
|
133
|
+
otherwise the configured unscanned-content policy applies.
|
|
134
|
+
|
|
135
|
+
Unknown provider endpoints, content blocks, and malformed provider JSON are
|
|
136
|
+
blocked by default. A user may explicitly select compatibility mode in the
|
|
137
|
+
global configuration, but project configuration cannot weaken this policy.
|
|
138
|
+
|
|
139
|
+
See [compatibility](COMPATIBILITY.md) for the release-tested client matrix.
|
|
140
|
+
|
|
141
|
+
## Plugins
|
|
142
|
+
|
|
143
|
+
Plugins are either declarative regex rules or portable WebAssembly middleware.
|
|
144
|
+
Wasm plugins run without WASI, filesystem, environment, process, or raw socket
|
|
145
|
+
access. Network destinations and payload-changing permissions require explicit
|
|
146
|
+
approval.
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
pentect plugins new NAME
|
|
150
|
+
pentect plugins dev PATH
|
|
151
|
+
pentect plugins publish PATH
|
|
152
|
+
pentect plugins add github:@owner/repository/path
|
|
153
|
+
pentect plugins list
|
|
154
|
+
pentect plugins inspect NAME
|
|
155
|
+
pentect plugins test NAME
|
|
156
|
+
pentect plugins update NAME
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
See [PLUGINS.md](PLUGINS.md) for plugin authoring and security details.
|
|
160
|
+
The Rust SDK is published as
|
|
161
|
+
[`pentect-plugin`](https://crates.io/crates/pentect-plugin).
|
|
162
|
+
The first-party catalog includes a one-file regex example and an optional
|
|
163
|
+
[OpenAI Privacy Filter adapter](https://pentect.dev/plugins/official/).
|
|
164
|
+
|
|
165
|
+
## Security and development
|
|
166
|
+
|
|
167
|
+
Report vulnerabilities privately as described in [SECURITY.md](SECURITY.md).
|
|
168
|
+
Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
169
|
+
|
|
170
|
+
Pentect is licensed under the [MIT License](LICENSE).
|
|
171
|
+
Third-party notices, including the bundled OCR model attribution, are available
|
|
172
|
+
in [`THIRD_PARTY_LICENSES.txt`](THIRD_PARTY_LICENSES.txt) and are attached to
|
|
173
|
+
each GitHub Release.
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pentect",
|
|
3
|
+
"version": "0.0.25",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Local secret masking boundary for AI agents",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/EdamAme-x/pentect.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://pentect.dev",
|
|
12
|
+
"bugs": "https://github.com/EdamAme-x/pentect/issues",
|
|
13
|
+
"bin": {
|
|
14
|
+
"pentect": "packaging/npm/bin/pentect.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"packaging/npm/bin/pentect.js",
|
|
18
|
+
"packaging/npm/install.js",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"postinstall": "node packaging/npm/install.js",
|
|
24
|
+
"test": "node --test packaging/npm/*.test.js"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const executable = fileURLToPath(new URL(`../vendor/${process.platform === 'win32' ? 'pentect.exe' : 'pentect'}`, import.meta.url));
|
|
6
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: 'inherit' });
|
|
7
|
+
if (result.error) {
|
|
8
|
+
console.error(`pentect: ${result.error.message}`);
|
|
9
|
+
process.exitCode = 1;
|
|
10
|
+
} else if (result.signal) {
|
|
11
|
+
process.kill(process.pid, result.signal);
|
|
12
|
+
} else {
|
|
13
|
+
process.exitCode = result.status ?? 1;
|
|
14
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { chmod, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { gunzipSync } from 'node:zlib';
|
|
6
|
+
|
|
7
|
+
const repository = 'EdamAme-x/pentect';
|
|
8
|
+
const packageRoot = fileURLToPath(new URL('../..', import.meta.url));
|
|
9
|
+
const destination = join(packageRoot, 'packaging', 'npm', 'vendor', process.platform === 'win32' ? 'pentect.exe' : 'pentect');
|
|
10
|
+
|
|
11
|
+
export function releaseAsset(platform = process.platform, architecture = process.arch) {
|
|
12
|
+
const assets = {
|
|
13
|
+
'win32-x64': 'pentect-windows-x86_64.exe',
|
|
14
|
+
'linux-x64': 'pentect-linux-x86_64',
|
|
15
|
+
'linux-arm64': 'pentect-linux-aarch64',
|
|
16
|
+
'darwin-x64': 'pentect-macos-x86_64',
|
|
17
|
+
'darwin-arm64': 'pentect-macos-aarch64',
|
|
18
|
+
};
|
|
19
|
+
const asset = assets[`${platform}-${architecture}`];
|
|
20
|
+
if (!asset) throw new Error(`Pentect does not provide a binary for ${platform}/${architecture}`);
|
|
21
|
+
return asset;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function expectedChecksum(text) {
|
|
25
|
+
const match = text.trim().match(/^([a-fA-F0-9]{64})(?:\s+\*?[^\s]+)?$/);
|
|
26
|
+
if (!match) throw new Error('The release checksum is invalid');
|
|
27
|
+
return match[1].toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function download(url, signal) {
|
|
31
|
+
const response = await fetch(url, {
|
|
32
|
+
redirect: 'follow',
|
|
33
|
+
headers: { 'user-agent': 'pentect-npm-installer' },
|
|
34
|
+
signal,
|
|
35
|
+
});
|
|
36
|
+
if (!response.ok) throw new Error(`Download failed (${response.status} ${response.statusText})`);
|
|
37
|
+
return Buffer.from(await response.arrayBuffer());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function downloadBinary(base, asset, signal) {
|
|
41
|
+
const compressed = await fetch(`${base}/${asset}.gz`, {
|
|
42
|
+
redirect: 'follow',
|
|
43
|
+
headers: { 'user-agent': 'pentect-npm-installer' },
|
|
44
|
+
signal,
|
|
45
|
+
});
|
|
46
|
+
if (compressed.ok) return gunzipSync(Buffer.from(await compressed.arrayBuffer()));
|
|
47
|
+
if (compressed.status !== 404) {
|
|
48
|
+
throw new Error(`Download failed (${compressed.status} ${compressed.statusText})`);
|
|
49
|
+
}
|
|
50
|
+
return download(`${base}/${asset}`, signal);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function install() {
|
|
54
|
+
const asset = releaseAsset();
|
|
55
|
+
const metadata = JSON.parse(await readFile(join(packageRoot, 'package.json'), 'utf8'));
|
|
56
|
+
const version = (process.env.PENTECT_VERSION || metadata.version)?.replace(/^v/, '');
|
|
57
|
+
const tag = version ? `v${version}` : 'latest';
|
|
58
|
+
const base = tag === 'latest'
|
|
59
|
+
? `https://github.com/${repository}/releases/latest/download`
|
|
60
|
+
: `https://github.com/${repository}/releases/download/${tag}`;
|
|
61
|
+
const signal = AbortSignal.timeout(90_000);
|
|
62
|
+
const [binary, checksumFile] = await Promise.all([
|
|
63
|
+
downloadBinary(base, asset, signal),
|
|
64
|
+
download(`${base}/${asset}.sha256`, signal),
|
|
65
|
+
]);
|
|
66
|
+
const expected = expectedChecksum(checksumFile.toString('utf8'));
|
|
67
|
+
const actual = createHash('sha256').update(binary).digest('hex');
|
|
68
|
+
if (actual !== expected) throw new Error('The release checksum does not match the downloaded binary');
|
|
69
|
+
|
|
70
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
71
|
+
const temporary = `${destination}.${process.pid}.tmp`;
|
|
72
|
+
try {
|
|
73
|
+
await writeFile(temporary, binary, { mode: 0o755, flag: 'wx' });
|
|
74
|
+
await rm(destination, { force: true });
|
|
75
|
+
await rename(temporary, destination);
|
|
76
|
+
if (process.platform !== 'win32') await chmod(destination, 0o755);
|
|
77
|
+
} finally {
|
|
78
|
+
await rm(temporary, { force: true });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const invokedDirectly = process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1]);
|
|
83
|
+
if (invokedDirectly) {
|
|
84
|
+
install().catch((error) => {
|
|
85
|
+
console.error(`pentect: ${error.message}`);
|
|
86
|
+
process.exitCode = 1;
|
|
87
|
+
});
|
|
88
|
+
}
|