@node9/policy-engine 2.33.1 → 2.34.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 CHANGED
@@ -404,6 +404,8 @@ interface FileAccess {
404
404
  operation: 'read' | 'write' | 'remove' | 'create';
405
405
  path: string;
406
406
  cwd?: string;
407
+ /** A read whose content leaves the machine as a request body or an upload. */
408
+ upload?: true;
407
409
  /** Unquoted shell pattern. Quoted metacharacters are escaped in this value. */
408
410
  glob?: string;
409
411
  /** The pattern is find's, not the shell's: `*` also selects dotfiles. */
@@ -999,12 +1001,18 @@ declare function redactText(text: string): {
999
1001
  found: string[];
1000
1002
  };
1001
1003
 
1002
- type PackageEcosystem = 'npm' | 'PyPI';
1004
+ /**
1005
+ * The OSV ecosystem name, verbatim: it is the index directory, the bucket path
1006
+ * of the OSV archive and the `ecosystem` of the online query at once. `VSCode`
1007
+ * covers both marketplaces (OSV files Open VSX records as
1008
+ * `VSCode:https://open-vsx.org` inside the same archive).
1009
+ */
1010
+ type PackageEcosystem = 'npm' | 'PyPI' | 'RubyGems' | 'crates.io' | 'Go' | 'NuGet' | 'Maven' | 'Packagist' | 'VSCode';
1003
1011
  interface PackageInstallRequest {
1004
1012
  ecosystem: PackageEcosystem;
1005
1013
  /** The front-end that would install it: npm, pnpm, yarn, bun, npx, pip, uv, poetry … */
1006
1014
  manager: string;
1007
- /** Registry name, normalised: npm as written (scope kept); PyPI per PEP 503. */
1015
+ /** Registry name: npm as written (scope kept); PyPI per PEP 503; the others as written. */
1008
1016
  name: string;
1009
1017
  /** Exact pinned version when the spec names one; otherwise undefined. */
1010
1018
  version?: string;
@@ -1249,22 +1257,28 @@ declare function normalizeTrustedEntry(raw: unknown): string | null;
1249
1257
  /** What a person reads for an entry: the masked part, without the hash. */
1250
1258
  declare function entryDisplay(entry: string): string;
1251
1259
  /**
1252
- * IBANs (mod-97), card numbers (exactly what detectPii reports, so not the
1253
- * fractional part of a number), account numbers (a whole IBAN-shaped value,
1254
- * or a number under an account key) and email addresses inside a text,
1255
- * masked the way destinations are. No quote or backslash is introduced or
1256
- * removed, so a JSON string stays a JSON string; a card written as a bare
1257
- * JSON number does not stay a number, so arguments go through
1258
- * maskPersonalValue instead.
1260
+ * IBANs (mod-97), card numbers (the detector's patterns and Luhn check),
1261
+ * account numbers (a whole IBAN-shaped value, or a number under an account
1262
+ * key) and email addresses inside a text, masked the way destinations are.
1263
+ * Masking is stricter than detection: a card is masked even where detectPii
1264
+ * exempts it as the fractional part of a number ("1.<card>", "0,<card>"),
1265
+ * since a hidden fraction in a log costs nothing and a shown card leaks; so
1266
+ * a Luhn-valid fractional part inside text is masked too. No quote or
1267
+ * backslash is introduced or removed, so a JSON string stays a JSON string;
1268
+ * a card written as a bare JSON number does not stay a number, so arguments
1269
+ * go through maskPersonalValue instead.
1259
1270
  */
1260
1271
  declare function maskPersonalData(text: string): string;
1261
1272
  /**
1262
1273
  * maskPersonalData over a JSON-shaped value (tool arguments), leaf by leaf, so
1263
- * the result is always a value: a string leaf is masked in its JSON form under
1264
- * its own key (the account-key and whole-value rules still see both), an
1265
- * object key is masked as text, and a number whose text holds personal data (a
1266
- * card passed as a number) becomes the masked string. Anything deeper than 64
1267
- * levels is replaced by '[REDACTED]'. Pure, never throws.
1274
+ * the result is always a value. A string leaf is masked twice: as raw text
1275
+ * first (a real newline or tab stays a word boundary, so a card or IBAN that
1276
+ * begins a line is found, as detectArgsPii finds it), then in its JSON form
1277
+ * under its own key (the account-key and whole-value rules see both). An
1278
+ * object key is masked as text; two keys that mask alike are told apart by a
1279
+ * `#2`, `#3` suffix so no entry is lost. A number whose text holds a card
1280
+ * becomes the masked string; a fraction stays the same number. Anything
1281
+ * deeper than 64 levels is replaced by '[REDACTED]'. Pure, never throws.
1268
1282
  */
1269
1283
  declare function maskPersonalValue(value: unknown): unknown;
1270
1284
 
@@ -2007,7 +2021,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
2007
2021
  * and fails CI when the hash drifts without a version bump — forgetting
2008
2022
  * is loud, not silent.
2009
2023
  */
2010
- declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
2024
+ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v28";
2011
2025
  /**
2012
2026
  * SHA-256 prefix of the detector-source files
2013
2027
  * (canonical.ts + pii.ts + destructive-regex.ts).
@@ -2018,7 +2032,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
2018
2032
  * files changed, this hash must change too, and you must consciously
2019
2033
  * decide whether to bump CANONICAL_EXTRACTOR_VERSION."
2020
2034
  */
2021
- declare const CANONICAL_EXTRACTOR_HASH = "a358f47eacca6e14";
2035
+ declare const CANONICAL_EXTRACTOR_HASH = "11df698796585cbe";
2022
2036
  declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
2023
2037
  declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
2024
2038
  /**
package/dist/index.d.ts CHANGED
@@ -404,6 +404,8 @@ interface FileAccess {
404
404
  operation: 'read' | 'write' | 'remove' | 'create';
405
405
  path: string;
406
406
  cwd?: string;
407
+ /** A read whose content leaves the machine as a request body or an upload. */
408
+ upload?: true;
407
409
  /** Unquoted shell pattern. Quoted metacharacters are escaped in this value. */
408
410
  glob?: string;
409
411
  /** The pattern is find's, not the shell's: `*` also selects dotfiles. */
@@ -999,12 +1001,18 @@ declare function redactText(text: string): {
999
1001
  found: string[];
1000
1002
  };
1001
1003
 
1002
- type PackageEcosystem = 'npm' | 'PyPI';
1004
+ /**
1005
+ * The OSV ecosystem name, verbatim: it is the index directory, the bucket path
1006
+ * of the OSV archive and the `ecosystem` of the online query at once. `VSCode`
1007
+ * covers both marketplaces (OSV files Open VSX records as
1008
+ * `VSCode:https://open-vsx.org` inside the same archive).
1009
+ */
1010
+ type PackageEcosystem = 'npm' | 'PyPI' | 'RubyGems' | 'crates.io' | 'Go' | 'NuGet' | 'Maven' | 'Packagist' | 'VSCode';
1003
1011
  interface PackageInstallRequest {
1004
1012
  ecosystem: PackageEcosystem;
1005
1013
  /** The front-end that would install it: npm, pnpm, yarn, bun, npx, pip, uv, poetry … */
1006
1014
  manager: string;
1007
- /** Registry name, normalised: npm as written (scope kept); PyPI per PEP 503. */
1015
+ /** Registry name: npm as written (scope kept); PyPI per PEP 503; the others as written. */
1008
1016
  name: string;
1009
1017
  /** Exact pinned version when the spec names one; otherwise undefined. */
1010
1018
  version?: string;
@@ -1249,22 +1257,28 @@ declare function normalizeTrustedEntry(raw: unknown): string | null;
1249
1257
  /** What a person reads for an entry: the masked part, without the hash. */
1250
1258
  declare function entryDisplay(entry: string): string;
1251
1259
  /**
1252
- * IBANs (mod-97), card numbers (exactly what detectPii reports, so not the
1253
- * fractional part of a number), account numbers (a whole IBAN-shaped value,
1254
- * or a number under an account key) and email addresses inside a text,
1255
- * masked the way destinations are. No quote or backslash is introduced or
1256
- * removed, so a JSON string stays a JSON string; a card written as a bare
1257
- * JSON number does not stay a number, so arguments go through
1258
- * maskPersonalValue instead.
1260
+ * IBANs (mod-97), card numbers (the detector's patterns and Luhn check),
1261
+ * account numbers (a whole IBAN-shaped value, or a number under an account
1262
+ * key) and email addresses inside a text, masked the way destinations are.
1263
+ * Masking is stricter than detection: a card is masked even where detectPii
1264
+ * exempts it as the fractional part of a number ("1.<card>", "0,<card>"),
1265
+ * since a hidden fraction in a log costs nothing and a shown card leaks; so
1266
+ * a Luhn-valid fractional part inside text is masked too. No quote or
1267
+ * backslash is introduced or removed, so a JSON string stays a JSON string;
1268
+ * a card written as a bare JSON number does not stay a number, so arguments
1269
+ * go through maskPersonalValue instead.
1259
1270
  */
1260
1271
  declare function maskPersonalData(text: string): string;
1261
1272
  /**
1262
1273
  * maskPersonalData over a JSON-shaped value (tool arguments), leaf by leaf, so
1263
- * the result is always a value: a string leaf is masked in its JSON form under
1264
- * its own key (the account-key and whole-value rules still see both), an
1265
- * object key is masked as text, and a number whose text holds personal data (a
1266
- * card passed as a number) becomes the masked string. Anything deeper than 64
1267
- * levels is replaced by '[REDACTED]'. Pure, never throws.
1274
+ * the result is always a value. A string leaf is masked twice: as raw text
1275
+ * first (a real newline or tab stays a word boundary, so a card or IBAN that
1276
+ * begins a line is found, as detectArgsPii finds it), then in its JSON form
1277
+ * under its own key (the account-key and whole-value rules see both). An
1278
+ * object key is masked as text; two keys that mask alike are told apart by a
1279
+ * `#2`, `#3` suffix so no entry is lost. A number whose text holds a card
1280
+ * becomes the masked string; a fraction stays the same number. Anything
1281
+ * deeper than 64 levels is replaced by '[REDACTED]'. Pure, never throws.
1268
1282
  */
1269
1283
  declare function maskPersonalValue(value: unknown): unknown;
1270
1284
 
@@ -2007,7 +2021,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
2007
2021
  * and fails CI when the hash drifts without a version bump — forgetting
2008
2022
  * is loud, not silent.
2009
2023
  */
2010
- declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
2024
+ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v28";
2011
2025
  /**
2012
2026
  * SHA-256 prefix of the detector-source files
2013
2027
  * (canonical.ts + pii.ts + destructive-regex.ts).
@@ -2018,7 +2032,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v27";
2018
2032
  * files changed, this hash must change too, and you must consciously
2019
2033
  * decide whether to bump CANONICAL_EXTRACTOR_VERSION."
2020
2034
  */
2021
- declare const CANONICAL_EXTRACTOR_HASH = "a358f47eacca6e14";
2035
+ declare const CANONICAL_EXTRACTOR_HASH = "11df698796585cbe";
2022
2036
  declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
2023
2037
  declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
2024
2038
  /**