Files
wekan/server/lib/adminRouteAudit.js
T
Lauri Ojansivu 1319f01e17 Data access in the Audit log, and AUDIT_LOG_STDOUT=json for a SIEM.
docs/Compliance/README.md WP-11 (rows 4.2 and 4.3 b):

- Admin Panel / People / Audit log has a Data access tab: who downloaded
  what - a board as JSON, CSV, Excel, PDF or ZIP, a chart, a card, every
  board, a person's data, an Admin Panel list - one row per person, day,
  kind and target with a count, the first and last time and the last
  address, never a row per download. A raw middleware in front of every
  route (server/lib/dataAccessLog.js) counts each export that answers 200,
  and a test fails when an export route is not in its list. Kept as the
  audit log (ADMIN_AUDIT_RETENTION_DAYS); erasing an account removes its
  username and address from it. Export CSV on the tab.
- AUDIT_LOG_STDOUT=json writes every audit row, security problem and data
  access also to stdout as one JSON line ({"wekan":"audit"|"security"|
  "data-access", ...}), with only the fields the Admin Panel shows - the
  arguments as stored, already redacted (models/lib/auditStdout.js). On
  every platform's settings, the snap and the Helm chart.
- The admin CSV exports obey Admin Panel's switch that turns all export
  off.

Five new strings, translated in every language. Low confidence: ace, ak,
ay, bi, bm, bo, bua, chr, csb, cv, dz, ee, ff, fj, gn, gv, haw, fur, co, ba,
bho, as, br, an, ast-ES, ha, ht, fo, iu, kl, ks, kw, nah, lld, rup, qu, sah,
se, szl, nap, scn, sc, rm, pap, lg, rn, nd, ss, nso, st, sn, ny, om, mai,
kok, la, sm, mi, tig, ve-PP, vo, wal, tlh, zgh, uz-AR, to, tpi, ts, ve, wa,
wa-RR, wo, yo, yi.

Thanks to xet7 !
2026-11-24 04:17:13 +02:00

31 lines
1.2 KiB
JavaScript

// An administrator's action taken through an HTTP route rather than a Meteor
// method - the personal-data export of another account (WP-5) - recorded in
// the same Admin Panel / People / Audit log as the audited methods
// (server/adminAudit.js), with the address the request came from.
import { AdminAuditLog } from '/server/adminAudit';
const { auditArgs } = require('/models/lib/adminAudit');
export function recordAdminRouteAction(actor, method, args, ip, error) {
const failed = e => console.error('[admin-audit] could not record', method, e && e.message);
try {
const doc = {
at: new Date(),
actorId: actor._id,
actorUsername: actor.username || '',
method,
args: auditArgs(method, args),
ok: !error,
error: error ? String(error.message || error).slice(0, 200) : undefined,
ip: ip || '',
};
// AUDIT_LOG_STDOUT=json (WP-11): the same row, as stored, on stdout.
require('/models/lib/auditStdout').writeStdout('audit', doc);
return AdminAuditLog.insertAsync(doc).catch(failed);
} catch (e) {
// The audit trail must never change what the route did or answered.
failed(e);
return Promise.resolve();
}
}