sentinello 3.7.5 → 3.7.6

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 (2) hide show
  1. package/dist/cli.cjs +20 -4
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -39873,6 +39873,7 @@ function isNonEmptyString(v) {
39873
39873
  var DEFAULT_FEED_BASE = "https://osv-vulnerabilities.storage.googleapis.com";
39874
39874
  var BATCH_SIZE = 2e3;
39875
39875
  var OSV_INCREMENTAL_MAX_IDS = 2e4;
39876
+ var OSV_INCREMENTAL_STUCK_MS = 48 * 60 * 60 * 1e3;
39876
39877
  function feedBase() {
39877
39878
  const fromEnv = process.env.SENTINELLO_OSV_FEED_URL;
39878
39879
  if (fromEnv && fromEnv.trim().length > 0) return fromEnv.trim();
@@ -54591,6 +54592,7 @@ async function refreshOsv(options, meta3, item) {
54591
54592
  }
54592
54593
  const append = [];
54593
54594
  let failure2 = null;
54595
+ let failedId = null;
54594
54596
  for (const id of changed.ids) {
54595
54597
  if (options.abortSignal && options.abortSignal.aborted) {
54596
54598
  failure2 = "the refresh was cancelled before every changed advisory was re-read";
@@ -54601,17 +54603,30 @@ async function refreshOsv(options, meta3, item) {
54601
54603
  for (const row of rows) append.push(row);
54602
54604
  } catch (err) {
54603
54605
  failure2 = id + " could not be re-read (" + errText(err) + ")";
54606
+ if (!(options.abortSignal && options.abortSignal.aborted)) failedId = id;
54604
54607
  break;
54605
54608
  }
54606
54609
  }
54607
54610
  if (failure2 !== null) {
54608
- if (state) state.etag = null;
54611
+ let message = failure2 + "; the previous OSV data is kept until a refresh re-reads all " + changed.ids.length + " changed advisories";
54612
+ if (state) {
54613
+ state.etag = null;
54614
+ if (failedId !== null) {
54615
+ const now = Date.now();
54616
+ const failingSince = state.incrementalFailingSince ?? now;
54617
+ if (now - failingSince >= OSV_INCREMENTAL_STUCK_MS) {
54618
+ return await seedOsv(options, meta3, { ...item, kind: "seed" });
54619
+ }
54620
+ state.incrementalFailingSince = failingSince;
54621
+ message += ". Refreshes have failed since " + new Date(failingSince).toISOString() + "; if " + failedId + " still cannot be re-read at " + new Date(failingSince + OSV_INCREMENTAL_STUCK_MS).toISOString() + ", the next run re-downloads the full OSV export";
54622
+ }
54623
+ }
54609
54624
  return {
54610
54625
  source: "osv",
54611
54626
  ecosystem: item.ecosystem,
54612
54627
  status: "error",
54613
54628
  rowCount: state?.recordCount ?? 0,
54614
- message: failure2 + "; the previous OSV data is kept until a refresh re-reads all " + changed.ids.length + " changed advisories"
54629
+ message
54615
54630
  };
54616
54631
  }
54617
54632
  const path = advisoryFilePath(options.cacheDir, "osv", item.ecosystem);
@@ -54722,6 +54737,7 @@ function touch(meta3, source, ecosystem, etag) {
54722
54737
  if (!state) return;
54723
54738
  state.refreshedAt = Date.now();
54724
54739
  if (etag !== void 0) state.etag = etag;
54740
+ delete state.incrementalFailingSince;
54725
54741
  }
54726
54742
  function touchGemnasiumSha(state, headSha) {
54727
54743
  state.refreshedAt = Date.now();
@@ -55679,8 +55695,8 @@ function createUi(options) {
55679
55695
 
55680
55696
  // src/help.ts
55681
55697
  var CLI_VERSION = (function resolveVersion() {
55682
- if ("3.7.5".length > 0) {
55683
- return "3.7.5";
55698
+ if ("3.7.6".length > 0) {
55699
+ return "3.7.6";
55684
55700
  }
55685
55701
  const fromEnv = process.env.SENTINELLO_VERSION;
55686
55702
  if (fromEnv && fromEnv.trim().length > 0) return fromEnv.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sentinello",
3
- "version": "3.7.5",
3
+ "version": "3.7.6",
4
4
  "license": "MIT",
5
5
  "description": "Scan the projects in a folder for vulnerable dependencies and write an advisory an agent can act on.",
6
6
  "keywords": [