/*
* SysDeck - Encryption Vault Panel
* Author: Jeremy Anderson (https://dcos.net)
*
* Lists LUKS-encrypted block devices via `lsblk -J`. The bridge parser
* filters to fstype=crypto_LUKS and surfaces device name + size.
*
* v0.1.4 SECURITY: lsblk fields (names, labels, mountpoints) and spawn
* error strings are untrusted output — now escaped before innerHTML
* (0.3.0 audit).
*/
function escapeHtml(s) {
return String(s == null ? '' : s)
.replace(/&/g, '&')
.replace(//g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
export async function mount(panel, { bridge, EventBus }) {
panel.innerHTML = renderSkeleton();
let luks = [];
try {
luks = await bridge.vault.listLuks();
} catch (err) {
panel.innerHTML = renderError(err);
return;
}
panel.innerHTML = `
${luks.length} LUKS volumes detectedEncryption Vault
| Device | FSType | Mountpoint | Size |
|---|---|---|---|
| ${escapeHtml(d.name)} | ${escapeHtml(d.fstype)} | ${escapeHtml(d.mountpoint ?? '—')} | ${escapeHtml(d.size ?? '—')} |
| No LUKS volumes found. | |||
${escapeHtml(err.message || err)}.