@node9/policy-engine 2.53.0 → 2.54.0
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/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +24 -4
- package/dist/index.mjs +24 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1356,6 +1356,8 @@ interface LegacyPolicyKnobs {
|
|
|
1356
1356
|
registrySignals?: boolean;
|
|
1357
1357
|
newPackage?: string;
|
|
1358
1358
|
installScript?: string;
|
|
1359
|
+
lookalike?: string;
|
|
1360
|
+
establishedAge?: string;
|
|
1359
1361
|
maxAgeHours?: number;
|
|
1360
1362
|
onlineFallback?: boolean;
|
|
1361
1363
|
allow?: string[];
|
|
@@ -1447,11 +1449,12 @@ declare function levelCheckValue(mode: string | undefined, id: string): Verdict
|
|
|
1447
1449
|
/** Every check a level changes, with its value. */
|
|
1448
1450
|
declare function levelChecks(mode: string | undefined): Readonly<Record<string, Verdict>>;
|
|
1449
1451
|
/** The package registry signals (`loading.malicious-package` tuning), which
|
|
1450
|
-
* allow only review or off
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1452
|
+
* allow only review or off, as a level sets them: Soft turns every signal off;
|
|
1453
|
+
* Strict and Block all ask about a young release of an established package
|
|
1454
|
+
* too (`establishedAge`, node9Firewall#385 wave 3); Standard and Audit keep
|
|
1455
|
+
* the defaults. Only the keys returned are written. */
|
|
1456
|
+
declare function levelPackageSignals(mode: string | undefined): Partial<Record<PackageSignal, 'review' | 'off'>> | undefined;
|
|
1457
|
+
type PackageSignal = 'newPackage' | 'installScript' | 'lookalike' | 'establishedAge';
|
|
1455
1458
|
|
|
1456
1459
|
interface PipeChainAnalysis {
|
|
1457
1460
|
isPipeline: boolean;
|
|
@@ -2446,7 +2449,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v39";
|
|
|
2446
2449
|
* files changed, this hash must change too, and you must consciously
|
|
2447
2450
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
2448
2451
|
*/
|
|
2449
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
2452
|
+
declare const CANONICAL_EXTRACTOR_HASH = "5ec00461a49e1858";
|
|
2450
2453
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
2451
2454
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
2452
2455
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1356,6 +1356,8 @@ interface LegacyPolicyKnobs {
|
|
|
1356
1356
|
registrySignals?: boolean;
|
|
1357
1357
|
newPackage?: string;
|
|
1358
1358
|
installScript?: string;
|
|
1359
|
+
lookalike?: string;
|
|
1360
|
+
establishedAge?: string;
|
|
1359
1361
|
maxAgeHours?: number;
|
|
1360
1362
|
onlineFallback?: boolean;
|
|
1361
1363
|
allow?: string[];
|
|
@@ -1447,11 +1449,12 @@ declare function levelCheckValue(mode: string | undefined, id: string): Verdict
|
|
|
1447
1449
|
/** Every check a level changes, with its value. */
|
|
1448
1450
|
declare function levelChecks(mode: string | undefined): Readonly<Record<string, Verdict>>;
|
|
1449
1451
|
/** The package registry signals (`loading.malicious-package` tuning), which
|
|
1450
|
-
* allow only review or off
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1452
|
+
* allow only review or off, as a level sets them: Soft turns every signal off;
|
|
1453
|
+
* Strict and Block all ask about a young release of an established package
|
|
1454
|
+
* too (`establishedAge`, node9Firewall#385 wave 3); Standard and Audit keep
|
|
1455
|
+
* the defaults. Only the keys returned are written. */
|
|
1456
|
+
declare function levelPackageSignals(mode: string | undefined): Partial<Record<PackageSignal, 'review' | 'off'>> | undefined;
|
|
1457
|
+
type PackageSignal = 'newPackage' | 'installScript' | 'lookalike' | 'establishedAge';
|
|
1455
1458
|
|
|
1456
1459
|
interface PipeChainAnalysis {
|
|
1457
1460
|
isPipeline: boolean;
|
|
@@ -2446,7 +2449,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v39";
|
|
|
2446
2449
|
* files changed, this hash must change too, and you must consciously
|
|
2447
2450
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
2448
2451
|
*/
|
|
2449
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
2452
|
+
declare const CANONICAL_EXTRACTOR_HASH = "5ec00461a49e1858";
|
|
2450
2453
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
2451
2454
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
2452
2455
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2711,7 +2711,7 @@ var CHECK_TEXT = {
|
|
|
2711
2711
|
advice: "Fixed at Block. A person accepts the change on the machine (node9 mcp pin update)."
|
|
2712
2712
|
},
|
|
2713
2713
|
"loading.malicious-package": {
|
|
2714
|
-
plain: "The agent installs a package that the public malicious-package database (OSV) lists, or one published minutes ago. Covers npm, PyPI, RubyGems, crates.io, Go, NuGet, Maven, Packagist and VS Code extensions; the publish-age and install-script signals are npm and PyPI only. A new release built from the same repository as the one before it (registry provenance) and an install script the package has always run do not stop; a release that lost the provenance its previous release had does.",
|
|
2714
|
+
plain: "The agent installs a package that the public malicious-package database (OSV) lists, or one published minutes ago. Covers npm, PyPI, RubyGems, crates.io, Go, NuGet, Maven, Packagist and VS Code extensions; the publish-age and install-script signals are npm and PyPI only. A new release built from the same repository as the one before it (registry provenance) and an install script the package has always run do not stop; a release that lost the provenance its previous release had does. A name that looks like a popular package and has no standing of its own, a name no package on npm or PyPI has, or a package npm removed as malicious also stops for review (the lookalike tuning). A fresh release of a package over a year old that released within the last six months is its normal cadence: Standard lets it through, Strict asks (the establishedAge tuning).",
|
|
2715
2715
|
example: "npm install of a package flagged as malware",
|
|
2716
2716
|
advice: "Keep Block for known-malicious packages; brand-new packages already stop for Review."
|
|
2717
2717
|
},
|
|
@@ -2815,7 +2815,12 @@ function levelChecks(mode) {
|
|
|
2815
2815
|
return LEVEL_CHECKS[levelOf(mode)];
|
|
2816
2816
|
}
|
|
2817
2817
|
function levelPackageSignals(mode) {
|
|
2818
|
-
|
|
2818
|
+
const level = levelOf(mode);
|
|
2819
|
+
if (level === "soft") {
|
|
2820
|
+
return { newPackage: "off", installScript: "off", lookalike: "off", establishedAge: "off" };
|
|
2821
|
+
}
|
|
2822
|
+
if (level === "strict" || level === "block-all") return { establishedAge: "review" };
|
|
2823
|
+
return void 0;
|
|
2819
2824
|
}
|
|
2820
2825
|
|
|
2821
2826
|
// src/owasp.ts
|
|
@@ -17162,6 +17167,16 @@ var TUNING_FIELDS = [
|
|
|
17162
17167
|
name: "installScript",
|
|
17163
17168
|
legacy: ["packageCheck", "installScript"]
|
|
17164
17169
|
},
|
|
17170
|
+
{
|
|
17171
|
+
checkId: "loading.malicious-package",
|
|
17172
|
+
name: "lookalike",
|
|
17173
|
+
legacy: ["packageCheck", "lookalike"]
|
|
17174
|
+
},
|
|
17175
|
+
{
|
|
17176
|
+
checkId: "loading.malicious-package",
|
|
17177
|
+
name: "establishedAge",
|
|
17178
|
+
legacy: ["packageCheck", "establishedAge"]
|
|
17179
|
+
},
|
|
17165
17180
|
{
|
|
17166
17181
|
checkId: "loading.malicious-package",
|
|
17167
17182
|
name: "onlineFallback",
|
|
@@ -17191,7 +17206,11 @@ function tuningFromLegacyPolicy(policy) {
|
|
|
17191
17206
|
const out = {};
|
|
17192
17207
|
const p = policy;
|
|
17193
17208
|
if (policy.packageCheck?.registrySignals === false) {
|
|
17194
|
-
out["loading.malicious-package"] = {
|
|
17209
|
+
out["loading.malicious-package"] = {
|
|
17210
|
+
newPackage: "off",
|
|
17211
|
+
installScript: "off",
|
|
17212
|
+
lookalike: "off"
|
|
17213
|
+
};
|
|
17195
17214
|
}
|
|
17196
17215
|
for (const f of TUNING_FIELDS) {
|
|
17197
17216
|
const [block, key] = f.legacy;
|
|
@@ -17210,6 +17229,7 @@ function tuningToLegacyPolicy(policy, tuning) {
|
|
|
17210
17229
|
if (normalized.registrySignals === false) {
|
|
17211
17230
|
normalized.newPackage ??= "off";
|
|
17212
17231
|
normalized.installScript ??= "off";
|
|
17232
|
+
normalized.lookalike ??= "off";
|
|
17213
17233
|
}
|
|
17214
17234
|
delete normalized.registrySignals;
|
|
17215
17235
|
}
|
|
@@ -20608,7 +20628,7 @@ function matchCanaryArgs(args, values) {
|
|
|
20608
20628
|
// src/scan/canonical.ts
|
|
20609
20629
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
20610
20630
|
var CANONICAL_EXTRACTOR_VERSION = "canonical-v39";
|
|
20611
|
-
var CANONICAL_EXTRACTOR_HASH = "
|
|
20631
|
+
var CANONICAL_EXTRACTOR_HASH = "5ec00461a49e1858";
|
|
20612
20632
|
var DEDUPE_PREVIEW_LEN = 120;
|
|
20613
20633
|
function extractCanonicalFindings(call, ctx) {
|
|
20614
20634
|
const out = [];
|
package/dist/index.mjs
CHANGED
|
@@ -2448,7 +2448,7 @@ var CHECK_TEXT = {
|
|
|
2448
2448
|
advice: "Fixed at Block. A person accepts the change on the machine (node9 mcp pin update)."
|
|
2449
2449
|
},
|
|
2450
2450
|
"loading.malicious-package": {
|
|
2451
|
-
plain: "The agent installs a package that the public malicious-package database (OSV) lists, or one published minutes ago. Covers npm, PyPI, RubyGems, crates.io, Go, NuGet, Maven, Packagist and VS Code extensions; the publish-age and install-script signals are npm and PyPI only. A new release built from the same repository as the one before it (registry provenance) and an install script the package has always run do not stop; a release that lost the provenance its previous release had does.",
|
|
2451
|
+
plain: "The agent installs a package that the public malicious-package database (OSV) lists, or one published minutes ago. Covers npm, PyPI, RubyGems, crates.io, Go, NuGet, Maven, Packagist and VS Code extensions; the publish-age and install-script signals are npm and PyPI only. A new release built from the same repository as the one before it (registry provenance) and an install script the package has always run do not stop; a release that lost the provenance its previous release had does. A name that looks like a popular package and has no standing of its own, a name no package on npm or PyPI has, or a package npm removed as malicious also stops for review (the lookalike tuning). A fresh release of a package over a year old that released within the last six months is its normal cadence: Standard lets it through, Strict asks (the establishedAge tuning).",
|
|
2452
2452
|
example: "npm install of a package flagged as malware",
|
|
2453
2453
|
advice: "Keep Block for known-malicious packages; brand-new packages already stop for Review."
|
|
2454
2454
|
},
|
|
@@ -2552,7 +2552,12 @@ function levelChecks(mode) {
|
|
|
2552
2552
|
return LEVEL_CHECKS[levelOf(mode)];
|
|
2553
2553
|
}
|
|
2554
2554
|
function levelPackageSignals(mode) {
|
|
2555
|
-
|
|
2555
|
+
const level = levelOf(mode);
|
|
2556
|
+
if (level === "soft") {
|
|
2557
|
+
return { newPackage: "off", installScript: "off", lookalike: "off", establishedAge: "off" };
|
|
2558
|
+
}
|
|
2559
|
+
if (level === "strict" || level === "block-all") return { establishedAge: "review" };
|
|
2560
|
+
return void 0;
|
|
2556
2561
|
}
|
|
2557
2562
|
|
|
2558
2563
|
// src/owasp.ts
|
|
@@ -16899,6 +16904,16 @@ var TUNING_FIELDS = [
|
|
|
16899
16904
|
name: "installScript",
|
|
16900
16905
|
legacy: ["packageCheck", "installScript"]
|
|
16901
16906
|
},
|
|
16907
|
+
{
|
|
16908
|
+
checkId: "loading.malicious-package",
|
|
16909
|
+
name: "lookalike",
|
|
16910
|
+
legacy: ["packageCheck", "lookalike"]
|
|
16911
|
+
},
|
|
16912
|
+
{
|
|
16913
|
+
checkId: "loading.malicious-package",
|
|
16914
|
+
name: "establishedAge",
|
|
16915
|
+
legacy: ["packageCheck", "establishedAge"]
|
|
16916
|
+
},
|
|
16902
16917
|
{
|
|
16903
16918
|
checkId: "loading.malicious-package",
|
|
16904
16919
|
name: "onlineFallback",
|
|
@@ -16928,7 +16943,11 @@ function tuningFromLegacyPolicy(policy) {
|
|
|
16928
16943
|
const out = {};
|
|
16929
16944
|
const p = policy;
|
|
16930
16945
|
if (policy.packageCheck?.registrySignals === false) {
|
|
16931
|
-
out["loading.malicious-package"] = {
|
|
16946
|
+
out["loading.malicious-package"] = {
|
|
16947
|
+
newPackage: "off",
|
|
16948
|
+
installScript: "off",
|
|
16949
|
+
lookalike: "off"
|
|
16950
|
+
};
|
|
16932
16951
|
}
|
|
16933
16952
|
for (const f of TUNING_FIELDS) {
|
|
16934
16953
|
const [block, key] = f.legacy;
|
|
@@ -16947,6 +16966,7 @@ function tuningToLegacyPolicy(policy, tuning) {
|
|
|
16947
16966
|
if (normalized.registrySignals === false) {
|
|
16948
16967
|
normalized.newPackage ??= "off";
|
|
16949
16968
|
normalized.installScript ??= "off";
|
|
16969
|
+
normalized.lookalike ??= "off";
|
|
16950
16970
|
}
|
|
16951
16971
|
delete normalized.registrySignals;
|
|
16952
16972
|
}
|
|
@@ -20345,7 +20365,7 @@ function matchCanaryArgs(args, values) {
|
|
|
20345
20365
|
// src/scan/canonical.ts
|
|
20346
20366
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
20347
20367
|
var CANONICAL_EXTRACTOR_VERSION = "canonical-v39";
|
|
20348
|
-
var CANONICAL_EXTRACTOR_HASH = "
|
|
20368
|
+
var CANONICAL_EXTRACTOR_HASH = "5ec00461a49e1858";
|
|
20349
20369
|
var DEDUPE_PREVIEW_LEN = 120;
|
|
20350
20370
|
function extractCanonicalFindings(call, ctx) {
|
|
20351
20371
|
const out = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/policy-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.54.0",
|
|
4
4
|
"description": "Shared policy evaluation engine for node9 — DLP, smart rules, AST shell parsing, shields, loop detection. Pure functions, no I/O. Used by both node9-proxy and the node9 SaaS firewall.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://node9.ai",
|