Files
wekan/server/lib/adminRouteAudit.js
T
Lauri Ojansivu 77986e1d65 Emergency access, a hash-chained audit log, a minimum age on sign-up, and a records of processing draft.
From docs/Compliance/README.md's P3 list and row 2.2:

- Emergency access: Admin Panel / People's user popup has "Emergency
  access" with a note before Impersonate. It is kept as reason emergency
  with the note (shown in the Impersonation Report), and every other
  administrator who can sign in gets an e-mail at once; a failed e-mail
  never stops the impersonation (models/lib/emergencyAccess.js).
- The administrators' audit log is hash-chained: each row carries its
  place, the previous row's hash and its own. Its _id is its place, so two
  servers writing at once cannot both take it - the unique _id refuses the
  second, which takes the next. A daily check, and verifyAdminAuditChain,
  walk it from the oldest row kept and report an edited or removed row in
  Problems / Filesystem integrity (models/lib/auditChain.js).
- REGISTRATION_MINIMUM_AGE: the sign-up form asks "I am at least N years
  old" and a password sign-up without it is refused; administrators'
  accounts and identity providers' are not asked, and nothing is stored
  (models/lib/registrationAge.js). On every platform and the Helm chart.
- Records of processing (draft) in Admin Panel / Settings / Legal pages:
  every collection holding personal data, why, how long with this server's
  values, and the outside services this server really uses, as Markdown to
  complete (models/lib/ropaDraft.js).

Seven new strings, translated in every language. Low confidence: chr, dz,
bo, gv, ak, ay, bm, ee, ff, fj, gn, haw, bua, cv, ba, csb, ace, bi, fur, an,
ast-ES, co, fo, hsb, gd, ht, bho, as, iu, kl, kw, ks, nah, rup, sah, lld,
szl, sm, ss, nd, qu, om, pap, lg, rn, rw, nso, st, sn, ny, mai, kok, sc,
scn, nap, mg, la, ig, ky, ja-HI, tig, tlh, vo, ve-PP, wal, zgh, uz-AR, to,
tpi, ts, tn, ve, wa, wa-RR, wo, wuu-Hans, yi, yo, tk_TM, ug, tt, ti, oc, rm,
sd, ps. The wrong-language catalog values the translators saw are in
TODO.md.

Thanks to xet7 !
2026-11-24 05:35:15 +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.
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);
// Hash-chained like every audit row (models/lib/auditChain.js, P3).
return require('/server/lib/auditChainAppend').appendAuditRow(doc).catch(failed);
} catch (e) {
// The audit trail must never change what the route did or answered.
failed(e);
return Promise.resolve();
}
}