infracensus-collector 1.6.13 → 1.6.14

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.
@@ -3,7 +3,7 @@ import {
3
3
  collectorVersion,
4
4
  findModule,
5
5
  restartNeededNotice
6
- } from "./chunk-YIMZFP5U.js";
6
+ } from "./chunk-US6GOYDU.js";
7
7
  import {
8
8
  redactLocal
9
9
  } from "./chunk-DIS3S4SY.js";
@@ -312,4 +312,4 @@ export {
312
312
  condenseLogTail,
313
313
  buildUiStatus
314
314
  };
315
- //# sourceMappingURL=chunk-ICHSZE34.js.map
315
+ //# sourceMappingURL=chunk-ETBBYFNQ.js.map
@@ -161,8 +161,8 @@ function findModule(key) {
161
161
  import { readFileSync } from "node:fs";
162
162
  import { join } from "node:path";
163
163
  function collectorVersion() {
164
- if ("1.6.13".length > 0) {
165
- return "1.6.13";
164
+ if ("1.6.14".length > 0) {
165
+ return "1.6.14";
166
166
  }
167
167
  return installedVersion();
168
168
  }
@@ -188,4 +188,4 @@ export {
188
188
  installedVersion,
189
189
  restartNeededNotice
190
190
  };
191
- //# sourceMappingURL=chunk-YIMZFP5U.js.map
191
+ //# sourceMappingURL=chunk-US6GOYDU.js.map
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  COLLECTOR_MODULES,
11
11
  collectorVersion,
12
12
  findModule
13
- } from "./chunk-YIMZFP5U.js";
13
+ } from "./chunk-US6GOYDU.js";
14
14
  import "./chunk-VQAXWSBA.js";
15
15
  import "./chunk-DIS3S4SY.js";
16
16
  import "./chunk-A5WDSTPU.js";
@@ -129,7 +129,7 @@ async function printStatus() {
129
129
  }
130
130
  }
131
131
  lines.push(`daemon : ${daemonLine}`);
132
- const { moduleStatusesFromLedger } = await import("./status-XO6RJFD5.js");
132
+ const { moduleStatusesFromLedger } = await import("./status-UQJVWTBT.js");
133
133
  const rows = moduleStatusesFromLedger();
134
134
  lines.push(`modules :`);
135
135
  for (const m of rows) {
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  readDisabledModules,
10
10
  readTail,
11
11
  setModuleEnabled
12
- } from "./chunk-ICHSZE34.js";
12
+ } from "./chunk-ETBBYFNQ.js";
13
13
  import {
14
14
  ArmClient,
15
15
  buildAzureInventory,
@@ -28,7 +28,7 @@ import {
28
28
  findModule,
29
29
  installedVersion,
30
30
  restartNeededNotice
31
- } from "./chunk-YIMZFP5U.js";
31
+ } from "./chunk-US6GOYDU.js";
32
32
  import {
33
33
  CREDENTIAL_KIND_SHAPE,
34
34
  CreateLocalCredentialSetBody,
@@ -6214,6 +6214,20 @@ function sddEntryCommand() {
6214
6214
  }
6215
6215
  return { file: process.execPath, args: [tsxCli, source] };
6216
6216
  }
6217
+ function runOnlyLogins(set) {
6218
+ if (!set) return [];
6219
+ if (set.kind === "smb") {
6220
+ return (set.secret.domain?.credentials ?? []).map((c) => ({ username: c.username, password: c.password }));
6221
+ }
6222
+ if (set.kind === "network") {
6223
+ return (set.secret.network?.windowsCredentials ?? []).map((c) => ({
6224
+ username: c.username,
6225
+ password: c.password,
6226
+ ...c.domain ? { domain: c.domain } : {}
6227
+ }));
6228
+ }
6229
+ return [];
6230
+ }
6217
6231
  function runSddJob(opts) {
6218
6232
  const { cfg, job, log, signal } = opts;
6219
6233
  const hosts = sddHostsFromTargets(job.targets, cfg.allowLargeScans);
@@ -6224,6 +6238,7 @@ function runSddJob(opts) {
6224
6238
  });
6225
6239
  }
6226
6240
  const cmd = sddEntryCommand();
6241
+ const runOnly = runOnlyLogins(opts.ephemeral ?? null);
6227
6242
  return new Promise((resolve) => {
6228
6243
  if (signal.aborted) return resolve({ status: "cancelled", message: "cancelled before it started" });
6229
6244
  let lastLine = "";
@@ -6248,6 +6263,7 @@ function runSddJob(opts) {
6248
6263
  // The parent reports this run's status; the child must not announce a
6249
6264
  // second job for the same walk (sensitive-data-index.ts checks this).
6250
6265
  SDD_JOB_ID: job.id,
6266
+ ...runOnly.length > 0 ? { SDD_RUN_CREDENTIALS_JSON: JSON.stringify(runOnly) } : {},
6251
6267
  // The child is a job, not a shell session: no colour, no prompts.
6252
6268
  NO_COLOR: "1"
6253
6269
  },
@@ -10334,7 +10350,16 @@ async function runJob(cfg, job, log, signal, ctxIn) {
10334
10350
  `claimed job ${job.id} (site ${job.siteId}, tenant ${job.tenantId}, domain ${domain}, ${job.targets.length} target(s))`
10335
10351
  );
10336
10352
  const con = useLog ? createLocalConsole({ log, useLog }) : void 0;
10337
- ctx.scanProgress?.begin({ jobId: job.id, domain, siteId: job.siteId });
10353
+ ctx.scanProgress?.begin({
10354
+ jobId: job.id,
10355
+ domain,
10356
+ siteId: job.siteId,
10357
+ // The console's Cancel button: the same abort the plane's cancel takes.
10358
+ cancel: () => {
10359
+ cancelled = true;
10360
+ controller.abort();
10361
+ }
10362
+ });
10338
10363
  con?.started({
10339
10364
  mode: `daemon:${domain}`,
10340
10365
  controlPlaneUrl: cfg.controlPlaneUrl,
@@ -10444,6 +10469,7 @@ async function runJob(cfg, job, log, signal, ctxIn) {
10444
10469
  job,
10445
10470
  log,
10446
10471
  signal: controller.signal,
10472
+ ephemeral: ctx.ephemeralCredentials ?? null,
10447
10473
  onLine: (line) => {
10448
10474
  const update = {
10449
10475
  phase: "sensitive-data",
@@ -16642,7 +16668,9 @@ ${tokenCss()}
16642
16668
  these phases; they went to the use log and the control plane and
16643
16669
  never to the screen on the host being scanned from. -->
16644
16670
  <div class="section" id="liveWrap" hidden>
16645
- <div class="shead">Scan in progress <span class="stag" id="liveWhat"></span></div>
16671
+ <div class="shead">Scan in progress <span class="stag" id="liveWhat"></span>
16672
+ <button type="button" id="liveCancel" class="secondary" style="margin-left:auto">Cancel Scan</button>
16673
+ </div>
16646
16674
  <div class="sbody">
16647
16675
  <div id="livePhases"></div>
16648
16676
  <div class="hint" id="liveTarget"></div>
@@ -18844,6 +18872,17 @@ ${tokenCss()}
18844
18872
  return site && site.orgId ? site.orgId : "";
18845
18873
  }
18846
18874
 
18875
+ $("liveCancel").addEventListener("click", async () => {
18876
+ const btn = $("liveCancel");
18877
+ btn.disabled = true;
18878
+ btn.textContent = "Cancelling\u2026";
18879
+ try {
18880
+ const res = await fetch("/ui/api/scan/cancel", { method: "POST" });
18881
+ if (!res.ok) { const b = await res.json().catch(() => ({})); $("liveTarget").textContent = b.error || "could not cancel"; }
18882
+ } catch (e) { $("liveTarget").textContent = "could not reach the collector"; }
18883
+ finally { setTimeout(() => { btn.disabled = false; btn.textContent = "Cancel Scan"; }, 3000); }
18884
+ });
18885
+
18847
18886
  function clearRunCredentials() {
18848
18887
  $("runCredWrap").open = false;
18849
18888
  renderRunCredFields();
@@ -19640,8 +19679,15 @@ function createManualRunQueue() {
19640
19679
  var MAX_PHASES = 32;
19641
19680
  function createScanProgressStore(now = () => /* @__PURE__ */ new Date()) {
19642
19681
  let live = null;
19682
+ let cancelLive = null;
19643
19683
  return {
19684
+ cancel() {
19685
+ if (!live || !cancelLive) return false;
19686
+ cancelLive();
19687
+ return true;
19688
+ },
19644
19689
  begin(run2) {
19690
+ cancelLive = run2.cancel ?? null;
19645
19691
  live = {
19646
19692
  jobId: run2.jobId,
19647
19693
  domain: run2.domain,
@@ -19673,6 +19719,7 @@ function createScanProgressStore(now = () => /* @__PURE__ */ new Date()) {
19673
19719
  },
19674
19720
  finish() {
19675
19721
  live = null;
19722
+ cancelLive = null;
19676
19723
  },
19677
19724
  state() {
19678
19725
  if (!live) return null;
@@ -20599,6 +20646,11 @@ async function startUiServer(deps, port = resolveUiPort()) {
20599
20646
  }
20600
20647
  return;
20601
20648
  }
20649
+ if (url === "/ui/api/scan/cancel" && method === "POST") {
20650
+ const stopped = deps.cancelScan?.() ?? false;
20651
+ json(res, stopped ? 202 : 409, stopped ? { ok: true } : { error: "no scan is running on this collector" });
20652
+ return;
20653
+ }
20602
20654
  if (url === "/ui/api/restart" && method === "POST") {
20603
20655
  json(res, 202, { ok: true });
20604
20656
  deps.restart();
@@ -20731,6 +20783,7 @@ async function startCollectorUi(opts) {
20731
20783
  defaults: { siteId: config.siteId, scanTargets: config.scanTargets }
20732
20784
  }),
20733
20785
  restart: createRestart(log),
20786
+ cancelScan: () => scanProgress.cancel(),
20734
20787
  credentials,
20735
20788
  schedules,
20736
20789
  sites,