tewip-ai 0.18.3 → 0.18.4

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.
@@ -34,6 +34,8 @@ export function npmAudit(root) {
34
34
  id: String(via?.url?.split('/').pop() ?? via?.source ?? ''),
35
35
  title: String(via?.title ?? `${name} has a known vulnerability`),
36
36
  fixedIn: entry.fixAvailable && typeof entry.fixAvailable === 'object' ? String(entry.fixAvailable.version ?? '') : '',
37
+ fixExists: entry.fixAvailable === true || (entry.fixAvailable && typeof entry.fixAvailable === 'object'),
38
+ direct: entry.isDirect === true,
37
39
  source: 'npm audit',
38
40
  dev: Boolean(entry.isDirect === false ? false : entry.dev ?? false) || Boolean(entry.effects?.length === 0 && entry.dev),
39
41
  });
@@ -82,6 +84,10 @@ export function osvScan(root) {
82
84
  id: String(v.id ?? ''),
83
85
  title: String(v.summary ?? '').slice(0, 200),
84
86
  fixedIn: '',
87
+ // osv-scanner's output says neither which version fixes it nor whether the project
88
+ // declares the package, so neither is claimed.
89
+ fixExists: false,
90
+ direct: false,
85
91
  source: 'osv-scanner',
86
92
  dev: false,
87
93
  });
@@ -116,7 +116,15 @@ export function triageDependency(finding, root, sources, accepted) {
116
116
  where,
117
117
  source: finding.source,
118
118
  };
119
- const upgrade = finding.fixedIn ? `upgrade ${finding.package} to ${finding.fixedIn}` : `no fixed version is published yet: watch ${finding.id || 'the advisory'} and consider replacing the package`;
119
+ // npm answers `fixAvailable: true` when `npm audit fix` can resolve something without naming a
120
+ // version. Reading only the version form made Tewip say "no fixed version is published yet,
121
+ // consider replacing the package" about three packages npm could have fixed in one command -
122
+ // found by running this against real advisories for lodash, minimist and marked.
123
+ const upgrade = finding.fixedIn
124
+ ? `upgrade ${finding.package} to ${finding.fixedIn}`
125
+ : finding.fixExists
126
+ ? `a fix is available: run \`npm audit fix\` (the scanner did not name a version)`
127
+ : `no fixed version is published yet: watch ${finding.id || 'the advisory'} and consider replacing the package`;
120
128
  if (accepted.has(`dependency ${finding.package}`) || accepted.has(`dependency ${where}`)) {
121
129
  return { ...base, verdict: 'accepted', why: 'a person marked this one accepted in .tewip/security-accepted.txt', next: 'nothing: it was reviewed' };
122
130
  }
@@ -134,8 +142,12 @@ export function triageDependency(finding, root, sources, accepted) {
134
142
  ...base,
135
143
  verdict: 'not-reachable',
136
144
  severity: base.severity === 'critical' ? 'medium' : 'low',
137
- why: `nothing in this project imports ${finding.package}: it is pulled in by another package, so the vulnerable code may never run here`,
138
- next: `${upgrade}, or check which dependency requires it (npm why ${finding.package}) before spending time on it`,
145
+ why: finding.direct
146
+ ? `this project declares ${finding.package} but no file imports it, so the vulnerable code may never run here`
147
+ : `nothing in this project imports ${finding.package}: it is pulled in by another package, so the vulnerable code may never run here`,
148
+ next: finding.direct
149
+ ? `${upgrade}, or remove ${finding.package} from the project if nothing uses it any more`
150
+ : `${upgrade}, or check which dependency requires it (npm why ${finding.package}) before spending time on it`,
139
151
  };
140
152
  }
141
153
  return { ...base, verdict: 'real-risk', why: `this project imports ${finding.package} directly, and the advisory applies to the installed version`, next: upgrade };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tewip-ai",
3
- "version": "0.18.3",
3
+ "version": "0.18.4",
4
4
  "description": "Tewip finds why each failing test failed - real bug, flaky test, environment, test data or changed selector - for any stack, from the command line, CI, or your editor.",
5
5
  "keywords": [
6
6
  "test-failures",