@node9/proxy 2.34.0 → 2.35.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.
@@ -8446,6 +8446,13 @@ var init_blast = __esm({
8446
8446
  }
8447
8447
  });
8448
8448
 
8449
+ // src/auth/decision-record.ts
8450
+ var init_decision_record = __esm({
8451
+ "src/auth/decision-record.ts"() {
8452
+ "use strict";
8453
+ }
8454
+ });
8455
+
8449
8456
  // src/auth/daemon.ts
8450
8457
  import fs4 from "fs";
8451
8458
  import path5 from "path";
@@ -8473,6 +8480,7 @@ var ACTIVITY_SOCKET_PATH, DEFAULT_DAEMON_PORT, DAEMON_PORT, DAEMON_HOST;
8473
8480
  var init_daemon = __esm({
8474
8481
  "src/auth/daemon.ts"() {
8475
8482
  "use strict";
8483
+ init_decision_record();
8476
8484
  ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : path5.join(os5.tmpdir(), "node9-activity.sock");
8477
8485
  DEFAULT_DAEMON_PORT = 7391;
8478
8486
  DAEMON_PORT = resolveDaemonPort();
@@ -10521,6 +10529,18 @@ function classifyDecision(a, b) {
10521
10529
  }
10522
10530
  if (d === "dlp") return { outcome: "info", label: "Finding", raw };
10523
10531
  if (d === "mcp-discovered") return { outcome: "info", label: "Info", raw };
10532
+ const decidedBy = isRow ? a.decidedBy : void 0;
10533
+ if (typeof decidedBy === "string") {
10534
+ const allowed = d === "allow" || d === "allowed" || d.startsWith("trust:");
10535
+ const denied = d === "deny" || d === "auto-deny" || d === "block";
10536
+ if (allowed || denied) {
10537
+ if (decidedBy === "person")
10538
+ return allowed ? { outcome: "allow", label: "Approved", raw } : { outcome: "deny", label: "Denied", raw };
10539
+ if (decidedBy === "timer" || decidedBy === "abandoned")
10540
+ return { outcome: "deny", label: "Timed out", raw };
10541
+ return allowed ? { outcome: "allow", label: "Auto-allowed", raw } : { outcome: "deny", label: "Blocked", raw };
10542
+ }
10543
+ }
10524
10544
  if (d === "allow" || d === "allowed") {
10525
10545
  if (src === "post-hook") return { outcome: "allow", label: "Ran", raw };
10526
10546
  if (HUMAN_SOURCES.has(src)) {
@@ -11175,11 +11195,15 @@ function aggregateReportFromAudit(period, opts = {}) {
11175
11195
  let dimAppsBlocked = 0;
11176
11196
  let dimPinMismatch = 0;
11177
11197
  let dimInjectionBlocked = 0;
11198
+ const hookCardIds = new Set(
11199
+ entries.filter((e) => e.source !== "daemon" && e.cardId).map((e) => e.cardId)
11200
+ );
11178
11201
  for (const e of entries) {
11202
+ if (e.source === "daemon" && e.cardId && hookCardIds.has(e.cardId)) continue;
11179
11203
  if (superseded.has(supersedeKey(e))) continue;
11180
11204
  const view = viewOf(e);
11181
11205
  const dateKey = e.ts.slice(0, 10);
11182
- const userInteracted = e.source === "daemon";
11206
+ const userInteracted = e.decidedBy ? e.decidedBy === "person" : e.source === "daemon";
11183
11207
  if (view.observed) {
11184
11208
  if (e.checkedBy === "observe-mode-dlp-would-block") observeDlp++;
11185
11209
  } else if (view.info) {
@@ -11187,7 +11211,8 @@ function aggregateReportFromAudit(period, opts = {}) {
11187
11211
  if (view.ran) userApproved++;
11188
11212
  else userDenied++;
11189
11213
  } else if (view.blocked) {
11190
- if (e.checkedBy === "timeout") timedOut++;
11214
+ if (e.checkedBy === "timeout" || e.decidedBy === "timer" || e.decidedBy === "abandoned")
11215
+ timedOut++;
11191
11216
  else if (isDlp(e.checkedBy)) dlpBlocked++;
11192
11217
  else if (e.checkedBy === "local-decision") userDenied++;
11193
11218
  else if (e.checkedBy !== "loop-detected") hardBlocked++;
@@ -12975,6 +13000,13 @@ function normalizeTs(ts) {
12975
13000
  }
12976
13001
  return (/* @__PURE__ */ new Date()).toISOString();
12977
13002
  }
13003
+ function monitorDecisionBody(decision) {
13004
+ return {
13005
+ decision,
13006
+ source: "monitor",
13007
+ ...decision === "trust" && { trustDuration: "30m" }
13008
+ };
13009
+ }
12978
13010
  function submitDecision(id, decision) {
12979
13011
  return new Promise((resolve) => {
12980
13012
  const token = getInternalToken();
@@ -12982,9 +13014,7 @@ function submitDecision(id, decision) {
12982
13014
  resolve({ ok: false, error: "daemon not running" });
12983
13015
  return;
12984
13016
  }
12985
- const bodyObj = { decision, source: "dashboard" };
12986
- if (decision === "trust") bodyObj.persist = true;
12987
- const body = JSON.stringify(bodyObj);
13017
+ const body = JSON.stringify(monitorDecisionBody(decision));
12988
13018
  const req = http.request(
12989
13019
  {
12990
13020
  hostname: DAEMON_HOST,
@@ -13477,7 +13507,7 @@ function renderApproval(event, status) {
13477
13507
  /* @__PURE__ */ jsx(Text, { color: COL.liveOff, children: "[d]" }),
13478
13508
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: "eny " }),
13479
13509
  /* @__PURE__ */ jsx(Text, { color: COL.panelHigh, children: "[t]" }),
13480
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "rust " }),
13510
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "rust 30m " }),
13481
13511
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: "[Esc]" })
13482
13512
  ] });
13483
13513
  }