@pretense/cli 0.6.17 → 0.6.18
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.
|
@@ -17,7 +17,7 @@ function versionFromPackageJson() {
|
|
|
17
17
|
return void 0;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
var PRETENSE_VERSION = (true ? "0.6.
|
|
20
|
+
var PRETENSE_VERSION = (true ? "0.6.18" : void 0) ?? versionFromPackageJson() ?? "0.0.0-unknown";
|
|
21
21
|
|
|
22
22
|
export {
|
|
23
23
|
PRETENSE_VERSION
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
PRETENSE_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QT5E625F.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM,
|
|
@@ -16514,11 +16514,11 @@ function versionFromCliPackageJson() {
|
|
|
16514
16514
|
return void 0;
|
|
16515
16515
|
}
|
|
16516
16516
|
function productVersion() {
|
|
16517
|
-
return override ?? (true ? "0.6.
|
|
16517
|
+
return override ?? (true ? "0.6.18" : void 0) ?? versionFromCliPackageJson() ?? "0.0.0-unknown";
|
|
16518
16518
|
}
|
|
16519
16519
|
var UNKNOWN_COMMIT = "unknown";
|
|
16520
16520
|
function bakedCommitSha() {
|
|
16521
|
-
return "
|
|
16521
|
+
return "220d098b1829361f3d0043fb24275e5fdfb84429".length > 0 ? "220d098b1829361f3d0043fb24275e5fdfb84429" : UNKNOWN_COMMIT;
|
|
16522
16522
|
}
|
|
16523
16523
|
var FEATURE_TIERS = {
|
|
16524
16524
|
compliance_export: "pro",
|
|
@@ -17269,6 +17269,57 @@ function toSecretFindings(matches) {
|
|
|
17269
17269
|
function isBase64Blob(text) {
|
|
17270
17270
|
return text.length >= 256 && !/\s/.test(text) && /^[A-Za-z0-9+/_=-]+$/.test(text);
|
|
17271
17271
|
}
|
|
17272
|
+
var BLOB_SECRET_INDICATORS = [
|
|
17273
|
+
/AKIA[0-9A-Z]{16}/,
|
|
17274
|
+
// AWS access key id
|
|
17275
|
+
/ASIA[0-9A-Z]{16}/,
|
|
17276
|
+
// AWS temporary access key id
|
|
17277
|
+
/gh[opsu]_[A-Za-z0-9]{36}/,
|
|
17278
|
+
// GitHub PAT / OAuth / app / refresh
|
|
17279
|
+
/github_pat_[0-9A-Za-z_]{22,}/,
|
|
17280
|
+
// GitHub fine-grained PAT
|
|
17281
|
+
/sk-ant-[A-Za-z0-9_-]{24,}/,
|
|
17282
|
+
// Anthropic API key
|
|
17283
|
+
/sk_live_[A-Za-z0-9]{20,}/,
|
|
17284
|
+
// Stripe live secret key
|
|
17285
|
+
/rk_live_[A-Za-z0-9]{20,}/,
|
|
17286
|
+
// Stripe live restricted key
|
|
17287
|
+
/AIza[0-9A-Za-z_-]{35}/,
|
|
17288
|
+
// Google API key
|
|
17289
|
+
/xox[baprs]-[0-9A-Za-z-]{10,}/,
|
|
17290
|
+
// Slack token
|
|
17291
|
+
/npm_[A-Za-z0-9]{36}/,
|
|
17292
|
+
// npm token
|
|
17293
|
+
/glpat-[0-9A-Za-z_-]{20}/,
|
|
17294
|
+
// GitLab PAT
|
|
17295
|
+
/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/
|
|
17296
|
+
// PEM private key banner
|
|
17297
|
+
];
|
|
17298
|
+
function blobSecretIndicator(text) {
|
|
17299
|
+
for (const re of BLOB_SECRET_INDICATORS) {
|
|
17300
|
+
if (re.test(text)) return re.source.slice(0, 24);
|
|
17301
|
+
}
|
|
17302
|
+
return null;
|
|
17303
|
+
}
|
|
17304
|
+
var BLOB_DECODE_SCAN_MAX_CHARS = 4 * 1024 * 1024;
|
|
17305
|
+
function decodedTextIfLikelyText(text) {
|
|
17306
|
+
if (text.length > BLOB_DECODE_SCAN_MAX_CHARS) return null;
|
|
17307
|
+
let buf;
|
|
17308
|
+
try {
|
|
17309
|
+
buf = Buffer.from(text.replace(/-/g, "+").replace(/_/g, "/"), "base64");
|
|
17310
|
+
} catch {
|
|
17311
|
+
return null;
|
|
17312
|
+
}
|
|
17313
|
+
if (buf.length === 0) return null;
|
|
17314
|
+
const sample = Math.min(buf.length, 4096);
|
|
17315
|
+
let printable = 0;
|
|
17316
|
+
for (let i = 0; i < sample; i++) {
|
|
17317
|
+
const b = buf[i] ?? 0;
|
|
17318
|
+
if (b === 9 || b === 10 || b === 13 || b >= 32 && b <= 126) printable++;
|
|
17319
|
+
}
|
|
17320
|
+
if (printable / sample < 0.85) return null;
|
|
17321
|
+
return buf.toString("utf8");
|
|
17322
|
+
}
|
|
17272
17323
|
var CONTROL_CHAR_RE = /[\u0000-\u001f]/;
|
|
17273
17324
|
var CONTROL_CHAR_RE_G = /[\u0000-\u001f]/g;
|
|
17274
17325
|
function tokenizeBodyDeep(body, scanText, derivation) {
|
|
@@ -17306,11 +17357,39 @@ function tokenizeBodyDeep(body, scanText, derivation) {
|
|
|
17306
17357
|
}
|
|
17307
17358
|
return out;
|
|
17308
17359
|
};
|
|
17309
|
-
const
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
|
|
17360
|
+
const redactWholeBlob = (text, type) => {
|
|
17361
|
+
const { content, mutations } = mutateSecrets(
|
|
17362
|
+
text,
|
|
17363
|
+
[{ value: text, offset: 0, length: text.length, type }],
|
|
17364
|
+
derivation
|
|
17365
|
+
);
|
|
17366
|
+
for (const mu of mutations) {
|
|
17367
|
+
if (!secretMap.has(mu.replacement)) secretMap.set(mu.replacement, mu.original);
|
|
17313
17368
|
}
|
|
17369
|
+
foundTypes.add(type);
|
|
17370
|
+
secretsTokenized++;
|
|
17371
|
+
return content;
|
|
17372
|
+
};
|
|
17373
|
+
const scanBlobLeaf = (text) => {
|
|
17374
|
+
const ind = blobSecretIndicator(text);
|
|
17375
|
+
if (ind) return redactWholeBlob(text, `unscannable-blob:${ind}`);
|
|
17376
|
+
const decoded = decodedTextIfLikelyText(text);
|
|
17377
|
+
if (decoded !== null) {
|
|
17378
|
+
const s = scanText(decoded);
|
|
17379
|
+
if (s.incomplete) {
|
|
17380
|
+
scanIncomplete = true;
|
|
17381
|
+
droppedFindings += s.limits.droppedFindings;
|
|
17382
|
+
for (const r of s.limits.reasons) incompleteReasons.add(r);
|
|
17383
|
+
}
|
|
17384
|
+
if (toSecretFindings(s.matches).length > 0) {
|
|
17385
|
+
return redactWholeBlob(text, "unscannable-blob:encoded-secret");
|
|
17386
|
+
}
|
|
17387
|
+
}
|
|
17388
|
+
skippedUnscannable++;
|
|
17389
|
+
return text;
|
|
17390
|
+
};
|
|
17391
|
+
const tokenizeLeaf = (text) => {
|
|
17392
|
+
if (isBase64Blob(text)) return scanBlobLeaf(text);
|
|
17314
17393
|
return tokenizeText(text);
|
|
17315
17394
|
};
|
|
17316
17395
|
const stack = [body];
|
package/dist/postinstall.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pretense/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
4
4
|
"description": "Local-first AI firewall that mutates proprietary code before sending to LLM APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"tsx": "^4.0.0",
|
|
24
24
|
"typescript": "^5.4.0",
|
|
25
25
|
"vitest": "^1.0.0",
|
|
26
|
-
"@pretense/compliance-engine": "0.1.0",
|
|
27
|
-
"@pretense/protocol": "0.1.0",
|
|
28
26
|
"@pretense/billing": "0.1.0",
|
|
27
|
+
"@pretense/protocol": "0.1.0",
|
|
28
|
+
"@pretense/compliance-engine": "0.1.0",
|
|
29
29
|
"@pretense/learner": "0.2.0",
|
|
30
30
|
"@pretense/mutator": "0.2.0",
|
|
31
31
|
"@pretense/proxy": "0.1.0",
|
|
32
|
+
"@pretense/scanner": "0.2.0",
|
|
32
33
|
"@pretense/scanner-rs": "0.2.0",
|
|
33
|
-
"@pretense/store": "0.2.0"
|
|
34
|
-
"@pretense/scanner": "0.2.0"
|
|
34
|
+
"@pretense/store": "0.2.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public",
|