@dotrino/vault 0.28.0 → 0.29.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.
- package/package.json +1 -1
- package/src/admin.js +5 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/vault",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Usa ESTE dispositivo (navegador) como bóveda/CA del ecosistema Dotrino: atiende enrolamientos por el proxy y firma certificados de delegación a tus máquinas. Incluye el cliente de SERVICIO (Node): un proyecto se enrola una vez y jala sus credenciales del vault en vez del .env (`import '@dotrino/vault/config'`).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/admin.js
CHANGED
|
@@ -41,12 +41,11 @@ export const ADMIN_OPS = Object.freeze([
|
|
|
41
41
|
// no debe poder dejar sin configuración a los servicios.
|
|
42
42
|
// `var.setMany` es la MISMA operación con varias variables dentro de un solo sobre: no
|
|
43
43
|
// añade permisos, quita reinicios (ver el enrutado abajo).
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
'var.reveal', 'var.history'
|
|
44
|
+
// Ver un valor, su histórico o volver a una versión NO están, y es a propósito: un
|
|
45
|
+
// aparato que administra no tiene sobres de lo privado (solo el servicio dueño y la
|
|
46
|
+
// recuperación). Eso lo hace la bóveda en su máquina (`secret show/history/revert`).
|
|
47
|
+
// No lo cablees.
|
|
48
|
+
'vars', 'var.set', 'var.setMany'
|
|
50
49
|
])
|
|
51
50
|
|
|
52
51
|
/** Cuánto se recuerda un nonce ya usado (el doble de la ventana de frescura). */
|
|
@@ -217,34 +216,6 @@ export function createAdminDesk ({
|
|
|
217
216
|
return { ok: true, result: result || { ok: true } }
|
|
218
217
|
}
|
|
219
218
|
|
|
220
|
-
// VER un valor (y sus versiones anteriores). La bóveda entrega material sellado a
|
|
221
|
-
// ESTE aparato; abrirlo es cosa suya. Se AUDITA, porque leer un secreto a distancia
|
|
222
|
-
// es exactamente lo que hay que poder revisar después.
|
|
223
|
-
if (data.op === 'var.reveal' || data.op === 'var.history') {
|
|
224
|
-
if (!vars) return { ok: false, error: 'admin: this vault does not serve environment variables' }
|
|
225
|
-
if (typeof vars.reveal !== 'function') return { ok: false, error: 'admin: this vault cannot show values (update it)' }
|
|
226
|
-
const toScope = typeof data.ns === 'string' && !!data.ns
|
|
227
|
-
const toDevice = typeof data.pub === 'string' && !!data.pub
|
|
228
|
-
if (toScope === toDevice) return { ok: false, error: 'admin: it needs exactly one target (ns or pub)' }
|
|
229
|
-
const target = { ns: toScope ? data.ns : null, pub: toDevice ? data.pub : null }
|
|
230
|
-
|
|
231
|
-
if (data.op === 'var.history') {
|
|
232
|
-
const result = await vars.history({ ...target, key: typeof data.key === 'string' ? data.key : null })
|
|
233
|
-
audit('admin.var.history', { by, ns: target.ns, key: data.key || null })
|
|
234
|
-
return { ok: true, result }
|
|
235
|
-
}
|
|
236
|
-
if (typeof data.key !== 'string' || !data.key) return { ok: false, error: 'admin: var.reveal needs a key' }
|
|
237
|
-
const result = await vars.reveal({
|
|
238
|
-
...target,
|
|
239
|
-
key: data.key,
|
|
240
|
-
ts: Number.isFinite(data.ts) ? data.ts : null,
|
|
241
|
-
device: chk.device,
|
|
242
|
-
by
|
|
243
|
-
})
|
|
244
|
-
audit('admin.var.reveal', { by, ns: target.ns, key: data.key, ...(data.ts ? { ts: data.ts } : {}) })
|
|
245
|
-
return { ok: true, result }
|
|
246
|
-
}
|
|
247
|
-
|
|
248
219
|
// QUITAR UN DISPOSITIVO se hace por `sub` (su llave): sale del acta Y se le retiran
|
|
249
220
|
// todos los certificados. Las dos cosas o ninguna.
|
|
250
221
|
//
|