@codyswann/lisa 6.0.8 → 6.0.10

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.
Files changed (111) hide show
  1. package/all/copy-overwrite/scripts/lisa-audit.mjs +1 -1
  2. package/all/copy-overwrite/scripts/lisa-hooks/sonar-secrets.sh +130 -47
  3. package/dist/configs/eslint/expo.d.ts.map +1 -1
  4. package/dist/configs/eslint/expo.js +11 -3
  5. package/dist/configs/eslint/expo.js.map +1 -1
  6. package/dist/configs/eslint/slow-expo.d.ts +15 -6
  7. package/dist/configs/eslint/slow-expo.d.ts.map +1 -1
  8. package/dist/configs/eslint/slow-expo.js +48 -19
  9. package/dist/configs/eslint/slow-expo.js.map +1 -1
  10. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  11. package/dist/core/lisa-owned-hash-ledger.js +6 -0
  12. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  13. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  14. package/dist/core/nightly-e2e-guard-behavior-certificate.js.map +1 -1
  15. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  16. package/dist/core/upstream-evidence-manifest.js +11 -12
  17. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  18. package/dist/migrations/index.d.ts +0 -1
  19. package/dist/migrations/index.d.ts.map +1 -1
  20. package/dist/migrations/index.js +0 -3
  21. package/dist/migrations/index.js.map +1 -1
  22. package/expo/copy-overwrite/eslint.expo.ts +11 -3
  23. package/expo/package-lisa/package.lisa.json +2 -1
  24. package/package.json +8 -7
  25. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  27. package/plugins/lisa/.codex-plugin/skills/lisa-security-audit-handling/SKILL.md +25 -25
  28. package/plugins/lisa/hooks/sonar-secrets.sh +130 -47
  29. package/plugins/lisa/rules/reference/security-audit-handling.md +9 -1
  30. package/plugins/lisa/skills/lisa-security-audit-handling/SKILL.md +25 -25
  31. package/plugins/lisa/skills/lisa-security-audit-handling/agents/openai.yaml +2 -2
  32. package/plugins/lisa-agy/plugin.json +1 -1
  33. package/plugins/lisa-agy/skills/lisa-security-audit-handling/SKILL.md +25 -25
  34. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  36. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  37. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  41. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-copilot/hooks/sonar-secrets.sh +130 -47
  43. package/plugins/lisa-copilot/rules/reference/security-audit-handling.md +9 -1
  44. package/plugins/lisa-copilot/skills/lisa-security-audit-handling/SKILL.md +25 -25
  45. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-cursor/hooks/sonar-secrets.sh +130 -47
  47. package/plugins/lisa-cursor/rules/security-audit-handling-reference.mdc +9 -1
  48. package/plugins/lisa-cursor/skills/lisa-security-audit-handling/SKILL.md +25 -25
  49. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  51. package/plugins/lisa-devin/hooks/sonar-secrets.sh +130 -47
  52. package/plugins/lisa-devin/rules/reference/security-audit-handling.md +9 -1
  53. package/plugins/lisa-devin/skills/lisa-security-audit-handling/SKILL.md +25 -25
  54. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  56. package/plugins/lisa-expo-agy/plugin.json +1 -1
  57. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  61. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  63. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  64. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  68. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  70. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  71. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  75. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  77. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  78. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  82. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  84. package/plugins/lisa-rails-agy/plugin.json +1 -1
  85. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  89. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  91. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  92. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  96. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  98. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  99. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  100. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  103. package/plugins/src/base/hooks/sonar-secrets.sh +130 -47
  104. package/plugins/src/base/rules/reference/security-audit-handling.md +9 -1
  105. package/plugins/src/base/skills/lisa-security-audit-handling/SKILL.md +25 -25
  106. package/scripts/lisa-audit.mjs +1 -1
  107. package/typescript/copy-overwrite/audit.ignore.config.json +1 -140
  108. package/dist/migrations/ensure-audit-ignore-local-exclusions.d.ts +0 -51
  109. package/dist/migrations/ensure-audit-ignore-local-exclusions.d.ts.map +0 -1
  110. package/dist/migrations/ensure-audit-ignore-local-exclusions.js +0 -245
  111. package/dist/migrations/ensure-audit-ignore-local-exclusions.js.map +0 -1
@@ -1,142 +1,3 @@
1
1
  {
2
- "exclusions": [
3
- {
4
- "id": "GHSA-5j98-mcp5-4vw2",
5
- "cve": "CVE-2025-64756",
6
- "package": "glob",
7
- "reason": "Command injection exploitable only via the `glob` CLI `-c`/`--cmd` flag; library API callers are unaffected and no deployable code paths invoke the CLI"
8
- },
9
- {
10
- "id": "GHSA-8qq5-rm4j-mr97",
11
- "package": "tar",
12
- "reason": "Arbitrary file overwrite/symlink poisoning during tar extraction; requires extracting attacker-controlled archives, which no production code path does"
13
- },
14
- {
15
- "id": "GHSA-37qj-frw5-hhjh",
16
- "package": "fast-xml-parser",
17
- "reason": "RangeError DoS triggered only when parsing attacker-controlled XML with numeric entities; no production code parses untrusted XML"
18
- },
19
- {
20
- "id": "GHSA-3ppc-4f35-3m26",
21
- "package": "minimatch",
22
- "reason": "ReDoS via repeated wildcards in attacker-supplied glob patterns; no runtime code path passes untrusted input to minimatch"
23
- },
24
- {
25
- "id": "GHSA-7r86-cg39-jmmj",
26
- "package": "minimatch",
27
- "reason": "ReDoS via multiple non-adjacent GLOBSTAR segments in attacker-supplied glob patterns; no runtime code path passes untrusted input to minimatch"
28
- },
29
- {
30
- "id": "GHSA-23c5-xmqv-rm74",
31
- "package": "minimatch",
32
- "reason": "ReDoS via nested extglob patterns; requires attacker-supplied glob input which no runtime code path accepts"
33
- },
34
- {
35
- "id": "GHSA-2g4f-4pwh-qvx6",
36
- "package": "ajv",
37
- "reason": "ReDoS requires the `$data` keyword option enabled in a schema; no projects enable `$data` or accept untrusted schemas at runtime"
38
- },
39
- {
40
- "id": "GHSA-jmr7-xgp7-cmfj",
41
- "package": "fast-xml-parser",
42
- "reason": "DoS via DOCTYPE entity expansion; requires parsing attacker-controlled XML with DOCTYPE, which no production code path does"
43
- },
44
- {
45
- "id": "GHSA-m7jm-9gc2-mpf2",
46
- "package": "fast-xml-parser",
47
- "reason": "Entity encoding bypass via regex injection in DOCTYPE entity names; requires parsing attacker-controlled XML, which no production code path does"
48
- },
49
- {
50
- "id": "GHSA-8gc5-j5rx-235r",
51
- "package": "fast-xml-parser",
52
- "reason": "Numeric entity expansion bypass; requires parsing attacker-controlled XML with expansion limits in play, which no production code path does"
53
- },
54
- {
55
- "id": "GHSA-r6q2-hw4h-h46w",
56
- "package": "tar",
57
- "reason": "Race condition during tar extraction on macOS APFS; requires extracting attacker-controlled archives, which no production code path does"
58
- },
59
- {
60
- "id": "GHSA-34x7-hfp2-rc4v",
61
- "package": "tar",
62
- "reason": "Arbitrary file creation via hardlink path traversal during extraction; requires extracting attacker-controlled archives, which no production code path does"
63
- },
64
- {
65
- "id": "GHSA-83g3-92jg-28cx",
66
- "package": "tar",
67
- "reason": "Arbitrary file read/write via hardlink target escape during extraction; requires extracting attacker-controlled archives, which no production code path does"
68
- },
69
- {
70
- "id": "GHSA-3h5v-q93c-6h6q",
71
- "package": "ws",
72
- "reason": "DoS requires attacker-controlled HTTP header volume against a `ws` WebSocket server. Keep this exclusion only if your project's ingress controls (e.g., gateway, load balancer, reverse proxy) enforce header count limits before traffic reaches the Node process."
73
- },
74
- {
75
- "id": "GHSA-w532-jxjh-hjhj",
76
- "cve": "CVE-2025-29907",
77
- "package": "jspdf",
78
- "reason": "ReDoS requires attacker-controlled input to `addImage`. Keep this exclusion only if `addImage` is never called with untrusted image paths or buffers sourced from user input."
79
- },
80
- {
81
- "id": "GHSA-8mvj-3j78-4qmw",
82
- "cve": "CVE-2025-57810",
83
- "package": "jspdf",
84
- "reason": "DoS requires attacker-controlled input to `addImage`. Keep this exclusion only if `addImage` is never called with untrusted image paths or buffers sourced from user input."
85
- },
86
- {
87
- "id": "GHSA-36jr-mh4h-2g58",
88
- "package": "d3-color",
89
- "reason": "ReDoS requires attacker-controlled color strings passed to d3-color's parser. Keep this exclusion only if no runtime code path passes untrusted input (e.g., user-supplied color values) to d3-color functions."
90
- },
91
- {
92
- "id": "GHSA-chqc-8p9q-pq6q",
93
- "package": "basic-ftp",
94
- "reason": "FTP command injection via CRLF requires attacker-controlled FTP command construction. Keep this exclusion only if no production code path uses FTP or passes untrusted input to FTP command parameters."
95
- },
96
- {
97
- "id": "GHSA-6v7q-wjvx-w8wg",
98
- "package": "basic-ftp",
99
- "reason": "FTP command injection via CRLF in credentials/MKD commands requires attacker-controlled FTP parameters. Transitive via @lhci/cli > proxy-agent > pac-proxy-agent > get-uri > basic-ftp. Keep this exclusion only if no production code path uses FTP or passes untrusted input to FTP command parameters."
100
- },
101
- {
102
- "id": "GHSA-r5fr-rjxr-66jc",
103
- "package": "lodash",
104
- "reason": "Code injection via `_.template` requires attacker-controlled input to `_.template` interpolation. Keep this exclusion only if no runtime code path invokes `_.template` with untrusted data."
105
- },
106
- {
107
- "id": "GHSA-jg4p-7fhp-p32p",
108
- "package": "@hapi/content",
109
- "reason": "ReDoS requires attacker-controlled HTTP Content-Type or Content-Disposition headers parsed by @hapi/content. Keep this exclusion only if no deployable code paths parse untrusted HTTP headers using this package."
110
- },
111
- {
112
- "id": "GHSA-3p68-rc4w-qgx5",
113
- "package": "axios",
114
- "reason": "SSRF via NO_PROXY hostname normalization bypass requires attacker influence over proxy configuration. Keep this exclusion only if proxy settings (NO_PROXY, HTTP_PROXY, etc.) are never derived from untrusted input."
115
- },
116
- {
117
- "id": "GHSA-fvcv-3m26-pcqx",
118
- "package": "axios",
119
- "reason": "Cloud metadata exfiltration requires attacker-controlled outbound request header values. Keep this exclusion only if axios request headers are never sourced from untrusted input."
120
- },
121
- {
122
- "id": "GHSA-2v35-w6hq-6mfw",
123
- "package": "@xmldom/xmldom",
124
- "reason": "Uncontrolled recursion in XML serialization leading to DoS. Transitive via expo > @expo/config-plugins > @expo/plist; only serializes developer-authored plist files at build/prebuild time, no runtime code path parses or serializes attacker-controlled XML."
125
- },
126
- {
127
- "id": "GHSA-f6ww-3ggp-fr8h",
128
- "package": "@xmldom/xmldom",
129
- "reason": "XML injection via unvalidated DocumentType serialization. Transitive via expo > @expo/config-plugins > @expo/plist; only serializes developer-authored plist files at build/prebuild time, no runtime code path serializes attacker-controlled XML."
130
- },
131
- {
132
- "id": "GHSA-x6wf-f3px-wcqx",
133
- "package": "@xmldom/xmldom",
134
- "reason": "XML node injection via unvalidated processing instruction serialization. Transitive via expo > @expo/config-plugins > @expo/plist; only serializes developer-authored plist files at build/prebuild time, no runtime code path serializes attacker-controlled XML."
135
- },
136
- {
137
- "id": "GHSA-j759-j44w-7fr8",
138
- "package": "@xmldom/xmldom",
139
- "reason": "XML node injection via unvalidated comment serialization. Transitive via expo > @expo/config-plugins > @expo/plist; only serializes developer-authored plist files at build/prebuild time, no runtime code path serializes attacker-controlled XML."
140
- }
141
- ]
2
+ "exclusions": []
142
3
  }
@@ -1,51 +0,0 @@
1
- import type { Migration, MigrationContext, MigrationResult } from "./migration.interface.js";
2
- /**
3
- * Migration: relocate project-specific exclusions from `audit.ignore.config.json`
4
- * (Lisa-owned, copy-overwrite) into `audit.ignore.local.json` (project-owned,
5
- * create-only) so they survive future Lisa postinstall runs.
6
- *
7
- * Without this migration, projects that add transient-dependency exclusions to
8
- * the Lisa-owned config see them silently stripped every install, producing
9
- * noisy diffs and tempting users to commit the regression.
10
- *
11
- * Mirrors the shape of `EnsureTsconfigLocalIncludesMigration`:
12
- * - `beforeStrategies` snapshots the project's pre-strategy exclusions that
13
- * are not in the Lisa template (i.e., project-specific additions).
14
- * - `apply` (post-strategy) writes any snapshotted exclusions missing from
15
- * `audit.ignore.local.json` into that file.
16
- */
17
- export declare class EnsureAuditIgnoreLocalExclusionsMigration implements Migration {
18
- readonly name = "ensure-audit-ignore-local-exclusions";
19
- readonly description = "Relocate project-specific audit exclusions from audit.ignore.config.json into audit.ignore.local.json";
20
- private snapshot;
21
- /**
22
- * Snapshot project-specific exclusions that would otherwise be stripped by
23
- * the copy-overwrite strategy. An exclusion is "project-specific" when its
24
- * `id` is present in the project's audit.ignore.config.json but absent from
25
- * the Lisa template for the same project type.
26
- *
27
- * When no valid Lisa template can be found for the detected project type the
28
- * method returns without snapshotting anything. This is intentionally
29
- * conservative: without a template we cannot distinguish Lisa-owned from
30
- * project-specific exclusions, so migrating could copy Lisa-owned entries
31
- * into audit.ignore.local.json.
32
- * @param ctx - Migration context
33
- */
34
- beforeStrategies(ctx: MigrationContext): Promise<void>;
35
- /**
36
- * The migration applies when at least one snapshotted project-specific
37
- * exclusion is missing from `audit.ignore.local.json`.
38
- * @param ctx - Migration context
39
- * @returns True when there is work to do
40
- */
41
- applies(ctx: MigrationContext): Promise<boolean>;
42
- /**
43
- * Merge snapshotted project-specific exclusions into audit.ignore.local.json,
44
- * skipping any whose id is already present. Deduplicates within the snapshot
45
- * itself so that duplicate source entries are only written once.
46
- * @param ctx - Migration context
47
- * @returns Result describing the action taken
48
- */
49
- apply(ctx: MigrationContext): Promise<MigrationResult>;
50
- }
51
- //# sourceMappingURL=ensure-audit-ignore-local-exclusions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensure-audit-ignore-local-exclusions.d.ts","sourceRoot":"","sources":["../../src/migrations/ensure-audit-ignore-local-exclusions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AA0IlC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,yCAA0C,YAAW,SAAS;IACzE,QAAQ,CAAC,IAAI,0CAA0C;IACvD,QAAQ,CAAC,WAAW,2GACsF;IAE1G,OAAO,CAAC,QAAQ,CAA4B;IAE5C;;;;;;;;;;;;OAYG;IACG,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC5D;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAuBtD;;;;;;OAMG;IACG,KAAK,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;CAiE7D"}
@@ -1,245 +0,0 @@
1
- import * as path from "node:path";
2
- import * as fse from "fs-extra";
3
- import { gte, minVersion, valid } from "semver";
4
- import { readJson, readJsonOrNull, writeJson } from "../utils/json-utils.js";
5
- const AUDIT_CONFIG = "audit.ignore.config.json";
6
- const AUDIT_LOCAL = "audit.ignore.local.json";
7
- const ESBUILD_ADVISORY = "GHSA-gv7w-rqvm-qjhr";
8
- const ESBUILD_PATCHED_VERSION = "0.28.1";
9
- /**
10
- * Preferred order of project types for sourcing the Lisa audit template.
11
- * First matching type wins.
12
- */
13
- const TEMPLATE_PRIORITY = [
14
- "typescript",
15
- "expo",
16
- "cdk",
17
- "nestjs",
18
- "npm-package",
19
- ];
20
- /**
21
- * Find the Lisa template audit.ignore.config.json path for the detected project.
22
- * The Lisa-owned audit config lives under `<type>/copy-overwrite/audit.ignore.config.json`.
23
- * Only returns a path when the file actually exists on disk; continues to the
24
- * next priority type otherwise to avoid treating a missing template as an empty
25
- * baseline.
26
- * @param lisaDir - Lisa installation directory
27
- * @param detectedTypes - Project types detected for the destination project
28
- * @returns Template path, or null when no matching type ships one
29
- */
30
- async function findTemplateConfigPath(lisaDir, detectedTypes) {
31
- for (const type of TEMPLATE_PRIORITY) {
32
- if (!detectedTypes.includes(type)) {
33
- continue;
34
- }
35
- const candidate = path.join(lisaDir, type, "copy-overwrite", AUDIT_CONFIG);
36
- if (await fse.pathExists(candidate)) {
37
- return candidate;
38
- }
39
- }
40
- return null;
41
- }
42
- /**
43
- * Extract the set of exclusion ids from a parsed audit ignore file.
44
- * Entries missing an `id` are ignored (they cannot be de-duplicated safely).
45
- * @param file - Parsed audit ignore file
46
- * @returns Set of exclusion ids found in the file
47
- */
48
- function collectIds(file) {
49
- if (!file || !Array.isArray(file.exclusions)) {
50
- return new Set();
51
- }
52
- const ids = file.exclusions
53
- .map(entry => entry.id)
54
- .filter((id) => typeof id === "string" && id.length > 0);
55
- return new Set(ids);
56
- }
57
- /**
58
- * Read a project-owned local JSON file, distinguishing between a missing file
59
- * (returns null) and a malformed file (throws). This prevents silent data loss
60
- * when a file exists but contains invalid JSON.
61
- * @param filePath - Path to the JSON file
62
- * @returns Parsed content, or null when the file does not exist
63
- */
64
- async function readLocalJson(filePath) {
65
- if (!(await fse.pathExists(filePath))) {
66
- return null;
67
- }
68
- return readJson(filePath);
69
- }
70
- /**
71
- * Report whether the host both enforces and has installed a patched esbuild.
72
- * Requiring both signals prevents removal while the dependency tree is stale or
73
- * a permissive package-manager constraint could still select a vulnerable build.
74
- * @param projectDir - Host project receiving the migration
75
- * @returns Whether constraints and installed package are both patched
76
- */
77
- async function hasPatchedEsbuild(projectDir) {
78
- const packageJson = await readJsonOrNull(path.join(projectDir, "package.json"));
79
- const installed = await readJsonOrNull(path.join(projectDir, "node_modules", "esbuild", "package.json"));
80
- const ranges = [
81
- packageJson?.overrides?.esbuild,
82
- packageJson?.resolutions?.esbuild,
83
- ].filter((range) => typeof range === "string");
84
- if (ranges.length === 0 || !valid(installed?.version)) {
85
- return false;
86
- }
87
- const constraintsArePatched = ranges.every(range => {
88
- try {
89
- const minimum = minVersion(range);
90
- return minimum !== null && gte(minimum, ESBUILD_PATCHED_VERSION);
91
- }
92
- catch {
93
- return false;
94
- }
95
- });
96
- return (constraintsArePatched &&
97
- gte(installed?.version ?? "0.0.0", ESBUILD_PATCHED_VERSION));
98
- }
99
- /**
100
- * Migration: relocate project-specific exclusions from `audit.ignore.config.json`
101
- * (Lisa-owned, copy-overwrite) into `audit.ignore.local.json` (project-owned,
102
- * create-only) so they survive future Lisa postinstall runs.
103
- *
104
- * Without this migration, projects that add transient-dependency exclusions to
105
- * the Lisa-owned config see them silently stripped every install, producing
106
- * noisy diffs and tempting users to commit the regression.
107
- *
108
- * Mirrors the shape of `EnsureTsconfigLocalIncludesMigration`:
109
- * - `beforeStrategies` snapshots the project's pre-strategy exclusions that
110
- * are not in the Lisa template (i.e., project-specific additions).
111
- * - `apply` (post-strategy) writes any snapshotted exclusions missing from
112
- * `audit.ignore.local.json` into that file.
113
- */
114
- export class EnsureAuditIgnoreLocalExclusionsMigration {
115
- name = "ensure-audit-ignore-local-exclusions";
116
- description = "Relocate project-specific audit exclusions from audit.ignore.config.json into audit.ignore.local.json";
117
- snapshot = [];
118
- /**
119
- * Snapshot project-specific exclusions that would otherwise be stripped by
120
- * the copy-overwrite strategy. An exclusion is "project-specific" when its
121
- * `id` is present in the project's audit.ignore.config.json but absent from
122
- * the Lisa template for the same project type.
123
- *
124
- * When no valid Lisa template can be found for the detected project type the
125
- * method returns without snapshotting anything. This is intentionally
126
- * conservative: without a template we cannot distinguish Lisa-owned from
127
- * project-specific exclusions, so migrating could copy Lisa-owned entries
128
- * into audit.ignore.local.json.
129
- * @param ctx - Migration context
130
- */
131
- async beforeStrategies(ctx) {
132
- this.snapshot = [];
133
- const projectConfigPath = path.join(ctx.projectDir, AUDIT_CONFIG);
134
- const projectConfig = await readJsonOrNull(projectConfigPath);
135
- if (!projectConfig || !Array.isArray(projectConfig.exclusions)) {
136
- return;
137
- }
138
- const templatePath = await findTemplateConfigPath(ctx.lisaDir, ctx.detectedTypes);
139
- const template = templatePath
140
- ? await readJsonOrNull(templatePath)
141
- : null;
142
- if (!template) {
143
- return;
144
- }
145
- const templateIds = collectIds(template);
146
- const projectSpecific = projectConfig.exclusions.filter(entry => {
147
- if (typeof entry.id !== "string" || entry.id.length === 0) {
148
- return false;
149
- }
150
- return !templateIds.has(entry.id);
151
- });
152
- this.snapshot = projectSpecific;
153
- }
154
- /**
155
- * The migration applies when at least one snapshotted project-specific
156
- * exclusion is missing from `audit.ignore.local.json`.
157
- * @param ctx - Migration context
158
- * @returns True when there is work to do
159
- */
160
- async applies(ctx) {
161
- const localPath = path.join(ctx.projectDir, AUDIT_LOCAL);
162
- const local = await readLocalJson(localPath);
163
- const patchedEsbuild = await hasPatchedEsbuild(ctx.projectDir);
164
- if (patchedEsbuild &&
165
- local?.exclusions?.some(entry => entry.id === ESBUILD_ADVISORY)) {
166
- return true;
167
- }
168
- const snapshot = patchedEsbuild
169
- ? this.snapshot.filter(entry => entry.id !== ESBUILD_ADVISORY)
170
- : this.snapshot;
171
- if (snapshot.length === 0) {
172
- return false;
173
- }
174
- const localIds = collectIds(local);
175
- return snapshot.some(entry => {
176
- const id = entry.id;
177
- return typeof id === "string" && !localIds.has(id);
178
- });
179
- }
180
- /**
181
- * Merge snapshotted project-specific exclusions into audit.ignore.local.json,
182
- * skipping any whose id is already present. Deduplicates within the snapshot
183
- * itself so that duplicate source entries are only written once.
184
- * @param ctx - Migration context
185
- * @returns Result describing the action taken
186
- */
187
- async apply(ctx) {
188
- const localPath = path.join(ctx.projectDir, AUDIT_LOCAL);
189
- const local = await readLocalJson(localPath);
190
- const existing = Array.isArray(local?.exclusions) ? local.exclusions : [];
191
- const patchedEsbuild = await hasPatchedEsbuild(ctx.projectDir);
192
- const retained = patchedEsbuild
193
- ? existing.filter(entry => entry.id !== ESBUILD_ADVISORY)
194
- : existing;
195
- const removed = existing.length - retained.length;
196
- const localIds = collectIds({ exclusions: retained });
197
- const seenIds = new Set(localIds);
198
- const additions = this.snapshot.filter(entry => {
199
- const id = entry.id;
200
- if (typeof id !== "string" ||
201
- seenIds.has(id) ||
202
- (patchedEsbuild && id === ESBUILD_ADVISORY)) {
203
- return false;
204
- }
205
- seenIds.add(id);
206
- return true;
207
- });
208
- if (additions.length === 0 && removed === 0) {
209
- return { name: this.name, action: "noop" };
210
- }
211
- const merged = {
212
- ...local,
213
- exclusions: [...retained, ...additions],
214
- };
215
- const addedIds = additions
216
- .map(entry => entry.id)
217
- .filter((id) => typeof id === "string");
218
- const actions = [
219
- additions.length > 0
220
- ? `relocated ${additions.length} exclusion(s) (${addedIds.join(", ")})`
221
- : "",
222
- removed > 0 ? `removed ${removed} patched esbuild exclusion(s)` : "",
223
- ].filter(Boolean);
224
- const message = `${actions.join(" and ")} in audit.ignore.local.json`;
225
- if (ctx.dryRun) {
226
- ctx.logger.dry(`Would ${actions.join(" and ")}`);
227
- return {
228
- name: this.name,
229
- action: "applied",
230
- changedFiles: [AUDIT_LOCAL],
231
- message,
232
- };
233
- }
234
- await fse.ensureDir(path.dirname(localPath));
235
- await writeJson(localPath, merged);
236
- ctx.logger.success(message);
237
- return {
238
- name: this.name,
239
- action: "applied",
240
- changedFiles: [AUDIT_LOCAL],
241
- message,
242
- };
243
- }
244
- }
245
- //# sourceMappingURL=ensure-audit-ignore-local-exclusions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensure-audit-ignore-local-exclusions.js","sourceRoot":"","sources":["../../src/migrations/ensure-audit-ignore-local-exclusions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAO7E,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAChD,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAC9C,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAC/C,MAAM,uBAAuB,GAAG,QAAQ,CAAC;AA8BzC;;;GAGG;AACH,MAAM,iBAAiB,GAA2B;IAChD,YAAY;IACZ,MAAM;IACN,KAAK;IACL,QAAQ;IACR,aAAa;CACd,CAAC;AAEF;;;;;;;;;GASG;AACH,KAAK,UAAU,sBAAsB,CACnC,OAAe,EACf,aAAqC;IAErC,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,SAAS;QACX,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAC3E,IAAI,MAAM,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACpC,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CA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