@dotrino/vaultd 0.193.0 → 0.193.1

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.
@@ -5,4 +5,4 @@
5
5
  * si no coincide con la del paquete: una versión anunciada que no es la que corre es peor
6
6
  * que no anunciar ninguna.
7
7
  */
8
- export const LIB_VERSION = '0.121.0'
8
+ export const LIB_VERSION = '0.121.1'
@@ -75,7 +75,7 @@ export function openNotices ({ disk, now = Date.now }) {
75
75
  * administrador). `product`: qué (`@dotrino/vaultd` es la propia bóveda);
76
76
  * `deviceId`/`label`: el aparato, si fue uno.
77
77
  */
78
- add (ev, { version, from = null, product = '@dotrino/vaultd', deviceId = null, label = null, devices = null, logSeq = null, head = null, tsa = null, ns = null, kind = null, outcome = null, by = null, request = null }) {
78
+ add (ev, { version, from = null, product = '@dotrino/vaultd', deviceId = null, label = null, devices = null, logSeq = null, head = null, tsa = null, ns = null, kind = null, outcome = null, by = null, byLabel = null, request = null }) {
79
79
  if (!NOTICE_EVS.includes(ev)) throw fail('bad-notice', `unknown notice: ${ev}`)
80
80
  if (ev === 'delivered') {
81
81
  if (!DELIVERED_KINDS.includes(kind)) throw fail('bad-notice', `${ev}: kind must be one of ${DELIVERED_KINDS.join(', ')}`)
@@ -106,6 +106,7 @@ export function openNotices ({ disk, now = Date.now }) {
106
106
  deviceId: typeof deviceId === 'string' ? deviceId : null,
107
107
  label: typeof label === 'string' ? label : '',
108
108
  by: typeof by === 'string' && by ? by : null,
109
+ byLabel: typeof byLabel === 'string' ? byLabel : '',
109
110
  request: typeof request === 'string' ? request : null,
110
111
  ts: now()
111
112
  }
@@ -207,9 +207,12 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
207
207
  *
208
208
  * No cambia lo que se decidió: si no se puede apuntar se dice en el log, y la respuesta sigue.
209
209
  */
210
- function noteAnswered (pend, outcome, by = null) {
210
+ function noteAnswered (pend, outcome, by = null, byPub = null) {
211
211
  try {
212
- notices.add('answered', { outcome, kind: pend.kind || 'read', ns: pend.ns || null, deviceId: pend.deviceId || null, label: pend.label || '', by, request: pend.id || null })
212
+ // Quien contestó, con su ALIAS además del ID (dueño, 2026-11-05: «no solo debe ir el Id
213
+ // sino también el alias»). El alias sale del acta, como el de quien pidió.
214
+ const byLabel = byPub ? (actaCache?.members || []).find((m) => m.pub === byPub)?.label || '' : ''
215
+ notices.add('answered', { outcome, kind: pend.kind || 'read', ns: pend.ns || null, deviceId: pend.deviceId || null, label: pend.label || '', by, byLabel, request: pend.id || null })
213
216
  } catch (e) { log(`[vault] could not note that request ${pend.id} was ${outcome}: ${e.message}`) }
214
217
  }
215
218
  /**
@@ -2223,7 +2226,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2223
2226
  }
2224
2227
  if (op === 'deny') {
2225
2228
  audit('incident.ignored', { device: pend.deviceId, kind: pend.ctx?.kind || null, id, by })
2226
- noteAnswered(pend, 'ignored', by)
2229
+ noteAnswered(pend, 'ignored', by, chk.device)
2227
2230
  log(`[vault] incident ${id} about ${pend.deviceId} ignored by ${by}`)
2228
2231
  return answer({ op: 'deny.result', id, ok: true })
2229
2232
  }
@@ -2232,7 +2235,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2232
2235
  // le quedaba sería un bloqueo de mentira.
2233
2236
  const cut = grants.revokeAll({ device: pend.device })
2234
2237
  audit('blocked', { device: pend.deviceId, kind: pend.ctx?.kind || null, id, by, grants: cut })
2235
- noteAnswered(pend, 'blocked', by)
2238
+ noteAnswered(pend, 'blocked', by, chk.device)
2236
2239
  log(`[vault] BLOCKED ${pend.deviceId}${pend.label ? ` (${pend.label})` : ''} by ${by} after incident ${id} · unblock with: dotrino-vault unblock ${pend.deviceId}`)
2237
2240
  // Se avisa a todos: los agentes (la terminal) traen la lista con el acta al recibirlo
2238
2241
  // y le cierran la sesión que tenga abierta. Sin esto el bloqueo esperaba al tic de 5 min.
@@ -2249,7 +2252,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2249
2252
  const ok = op === 'approve'
2250
2253
  const what = pend.kind === 'write' ? 'vars' : pend.kind === 'update' ? 'update' : 'passwords'
2251
2254
  audit(ok ? `${what}.approved` : `${what}.denied`, { device: pend.deviceId, ns: pend.ns, id, by })
2252
- noteAnswered(pend, ok ? 'approved' : 'denied', by)
2255
+ noteAnswered(pend, ok ? 'approved' : 'denied', by, chk.device)
2253
2256
  log(`[vault] ${what}: request ${pend.id} of ${pend.deviceId} ${ok ? 'approved' : 'DENIED'} by ${by}`)
2254
2257
  // Lo aprobado SE HACE AQUÍ (una escritura se aplica ahora), y si falla quien aprobó
2255
2258
  // tiene que enterarse: decirle «hecho» a algo que no se guardó es el peor resultado.
@@ -2262,7 +2265,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2262
2265
  }
2263
2266
  if (op === 'deny') {
2264
2267
  audit('secrets.denied', { device: pend.deviceId, ns: pend.ns, id, by })
2265
- noteAnswered(pend, 'denied', by)
2268
+ noteAnswered(pend, 'denied', by, chk.device)
2266
2269
  log(`[vault] ${pend.ns}: request of ${pend.deviceId} DENIED by ${by}`)
2267
2270
  try {
2268
2271
  const plain = { type: MSG.ERROR, error: `unauthorized: denied — the "${pend.ns}" request was denied from ${by}` }
@@ -2284,7 +2287,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2284
2287
  // que unos pedidos dejan de timbrar y otros no, sin ninguna explicación a mano.
2285
2288
  const grant = grants.grant({ ns: pend.ns, device: pend.device, deviceId: pend.deviceId, ctx: pend.ctx, by })
2286
2289
  audit('secrets.approved', { device: pend.deviceId, ns: pend.ns, id, by, ...(grant ? { grant: grant.id } : {}) })
2287
- noteAnswered(pend, 'approved', by)
2290
+ noteAnswered(pend, 'approved', by, chk.device)
2288
2291
  log(`[vault] ${pend.ns}: request of ${pend.deviceId} approved by ${by}`)
2289
2292
  log(grant
2290
2293
  ? `[vault] ${pend.ns}: "${commandLine(pend.ctx, 80)}" approved for ${Math.round(GRANT_TTL_MS / 60000)} min from its last use (grant ${grant.id})`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/vaultd",
3
- "version": "0.193.0",
3
+ "version": "0.193.1",
4
4
  "type": "module",
5
5
  "description": "Certificador personal de Dotrino: daemon headless que custodia la clave maestra y delega capacidades a tus dispositivos por el proxy. Tu CA propia.",
6
6
  "bin": {