identityscope 0.28.3 → 0.28.5
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/LICENSE +21 -21
- package/README.md +914 -917
- package/SECURITY.md +56 -56
- package/dist/node/cli.js +26 -26
- package/dist/node/monthly.js +17 -17
- package/package.json +2 -2
- package/reports/access-profile-members.yaml +29 -29
- package/reports/access-profile-membership-counts.yaml +17 -17
- package/reports/access-profiles-without-owner.yaml +16 -16
- package/reports/access-request-audit-trail.yaml +36 -36
- package/reports/accounts-by-source.yaml +19 -19
- package/reports/active-identities-without-manager.yaml +22 -22
- package/reports/aggregation-failures.yaml +29 -29
- package/reports/aggregation-history.yaml +27 -27
- package/reports/all-sources.yaml +16 -16
- package/reports/application-accounts.yaml +32 -32
- package/reports/application-entitlements.yaml +31 -31
- package/reports/campaign-progress.yaml +23 -23
- package/reports/certification-decisions.yaml +31 -31
- package/reports/direct-reports-per-manager.yaml +20 -20
- package/reports/disabled-accounts-of-active-people.yaml +33 -33
- package/reports/duplicate-emails.yaml +16 -16
- package/reports/entitlement-holders.yaml +35 -35
- package/reports/entitlements-held-by-inactive-identities.yaml +31 -31
- package/reports/entitlements-without-owner.yaml +28 -28
- package/reports/identities-by-lifecycle-state.yaml +15 -15
- package/reports/identities-missing-key-attributes.yaml +27 -27
- package/reports/identities-with-processing-errors.yaml +19 -19
- package/reports/identity-attribute-mappings.yaml +27 -27
- package/reports/machine-accounts.yaml +28 -28
- package/reports/managers-and-direct-reports.yaml +23 -23
- package/reports/most-access.yaml +18 -18
- package/reports/new-identities.yaml +24 -24
- package/reports/old-passwords.yaml +35 -35
- package/reports/pending-reviews-by-reviewer.yaml +20 -20
- package/reports/person-access.yaml +31 -31
- package/reports/privileged-access.yaml +29 -29
- package/reports/provisioning-error-causes.yaml +27 -27
- package/reports/provisioning-errors.yaml +32 -32
- package/reports/provisioning-failures.yaml +28 -28
- package/reports/recent-access-requests.yaml +22 -22
- package/reports/recent-activity.yaml +32 -32
- package/reports/recent-leavers.yaml +34 -34
- package/reports/role-members.yaml +29 -29
- package/reports/role-membership-counts.yaml +18 -18
- package/reports/roles-without-owner.yaml +17 -17
- package/reports/sources-needing-attention.yaml +23 -23
- package/reports/stuck-access-requests.yaml +29 -29
- package/reports/team-access.yaml +30 -30
- package/reports/terminated-users-with-active-accounts.yaml +46 -46
- package/reports/uncorrelated-accounts.yaml +38 -38
- package/ui/js/00-setup.js +6 -6
- package/ui/js/01-small-helpers.js +143 -143
- package/ui/js/02-connection.js +150 -150
- package/ui/js/03-health-check.js +17 -17
- package/ui/js/04-library.js +135 -135
- package/ui/js/05-pickers.js +163 -163
- package/ui/js/06-report-view.js +157 -157
- package/ui/js/07-fields.js +85 -85
- package/ui/js/08-designer.js +360 -360
- package/ui/js/09-yaml.js +22 -22
- package/ui/js/10-instant-check.js +171 -171
- package/ui/js/11-lookup.js +161 -161
- package/ui/js/12-tenant.js +115 -115
- package/ui/js/13-source-configuration-and-diagnostics.js +64 -64
- package/ui/js/14-certifications.js +68 -68
- package/ui/js/15-monthly-report.js +24 -24
- package/ui/js/16-ownership.js +39 -39
- package/ui/js/17-compare-tenants.js +102 -102
- package/ui/js/18-audit.js +181 -181
- package/ui/js/19-insights.js +108 -108
- package/ui/js/20-role-mining.js +35 -35
- package/ui/js/21-share-reports.js +45 -45
- package/ui/js/22-partner-overview-all-customer-tenants.js +228 -228
- package/ui/js/23-in-app-guidance.js +217 -217
- package/ui/js/24-role-tools.js +220 -220
- package/ui/js/25-schedules.js +264 -264
- package/ui/js/26-start.js +7 -7
- package/ui/js/27-warnings.js +224 -224
- package/ui/js/28-audit-readiness.js +99 -99
- package/ui/js/29-lifecycle.js +182 -182
- package/ui/js/30-labs.js +265 -265
- package/ui/js/31-build.js +203 -203
- package/ui/js/32-lab-examples.js +148 -148
- package/ui/js/33-finder.js +89 -89
- package/ui/js/34-governance.js +129 -129
- package/ui/js/35-watch.js +266 -266
- package/ui/js/36-model.js +247 -247
- package/ui/js/37-logs-and-watch.js +224 -224
- package/ui/shell.html +112 -112
- package/ui/style.css +350 -350
package/ui/js/29-lifecycle.js
CHANGED
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
// ---------- Joiner, mover and leaver gaps; admin accounts; accepted exceptions ----------
|
|
2
|
-
function lcState() {
|
|
3
|
-
if (!state.lc) state.lc = { joiners: { graceDays: 3, share: 90, startDateAttribute: '' }, leavers: { kind: 'all' }, movers: { groupBy: 'department', maxShare: 5 }, accounts: { words: 'admin, adm, svc, service, test, tst, sa, root, sys, shared, generic' }, exceptions: {} };
|
|
4
|
-
return state.lc;
|
|
5
|
-
}
|
|
6
|
-
function lcRunBar(w, H, path, label, desc, extras, body, rerender) {
|
|
7
|
-
w.appendChild(el('div', { className: 'bar', style: 'margin-bottom:14px' }, el('span', { className: 'muted', style: 'flex:1;min-width:260px', text: desc }), extras || null,
|
|
8
|
-
el('button', { className: 'btn primary', disabled: !!H.busy, onclick: function () { runJobInto(H, '/api/lifecycle/' + path + '/run', body ? body() : {}, rerender); } }, icon('play'), H.data ? 'Read again' : label)));
|
|
9
|
-
if (H.busy) { w.appendChild(busyBox(H.busy)); return false; }
|
|
10
|
-
if (H.error) { w.appendChild(el('div', { className: 'error', text: H.error })); return false; }
|
|
11
|
-
if (!H.data) return false;
|
|
12
|
-
(H.data.notes || []).forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
function filteredTable(H, rows, headers, toCells, label, extraBar) {
|
|
16
|
-
var f = el('input', { className: 'input', placeholder: 'Filter...', value: H.q || '', style: 'max-width:280px', 'aria-label': 'Filter ' + label });
|
|
17
|
-
var box = el('div');
|
|
18
|
-
var draw = function () {
|
|
19
|
-
var q = (H.q || '').toLowerCase();
|
|
20
|
-
var list = rows.filter(function (r) { return !q || JSON.stringify(r).toLowerCase().indexOf(q) >= 0; });
|
|
21
|
-
box.textContent = '';
|
|
22
|
-
box.appendChild(list.length ? simpleTable(headers, list.slice(0, 2000).map(toCells), label) : el('p', { className: 'muted', text: 'Nothing matches.' }));
|
|
23
|
-
if (list.length > 2000 || H.data.more) box.appendChild(el('p', { className: 'muted small', text: 'Showing the first 2,000. The download has all of them.' }));
|
|
24
|
-
};
|
|
25
|
-
f.addEventListener('input', function () { H.q = f.value; draw(); });
|
|
26
|
-
draw();
|
|
27
|
-
return el('div', {}, el('div', { className: 'bar', style: 'margin-bottom:10px' }, f, extraBar || null, el('span', { style: 'flex:1' }), downloads(H.job)), box);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Warnings > Missed joiners
|
|
31
|
-
function wnJoiners(w, _H, desc) {
|
|
32
|
-
var H = lcState().joiners;
|
|
33
|
-
var extras = el('div', { className: 'bar' },
|
|
34
|
-
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Birthright when held by' }), numSelect(H, 'share', [[80, '80% of the profile'], [90, '90% of the profile'], [95, '95% of the profile']], 'Birthright share')),
|
|
35
|
-
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Grace period' }), numSelect(H, 'graceDays', [[1, '1 day'], [3, '3 days'], [7, '7 days'], [14, '14 days']], 'Grace period')),
|
|
36
|
-
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Also check joiners of the last' }), numSelect(H, 'recentDays', [[7, '7 days'], [30, '30 days'], [90, '90 days']], 'Recent joiners')),
|
|
37
|
-
attrInput(H, 'startDateAttribute', 'Start-date attribute (optional)', 'startDate'));
|
|
38
|
-
if (!H.recentDays) H.recentDays = 30;
|
|
39
|
-
if (!lcRunBar(w, H, 'joiners', 'Find missed joiners', desc, extras, function () { return { share: H.share, graceDays: H.graceDays, recentDays: H.recentDays, startDateAttribute: H.startDateAttribute || undefined }; }, renderWarnings)) return;
|
|
40
|
-
var d = H.data, E = d.evidence;
|
|
41
|
-
if (!E) {
|
|
42
|
-
var started = d.rows.filter(function (r) { return !r.missing.length; }).length;
|
|
43
|
-
w.appendChild(el('div', { className: 'bigstats' }, stat(d.rows.length - started, 'missing a birthright account', 'lose'), stat(started, 'past start date, still pre-hire', 'lose'), stat(d.checked, 'active people checked')));
|
|
44
|
-
if (d.rows.length) w.appendChild(section('Missed joiners', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Person', 'Identity profile', 'Created', 'Why', 'Missing accounts on'], function (r) {
|
|
45
|
-
return [el('span', {}, r.person, r.email ? el('div', { className: 'muted small', text: r.email }) : null), r.profile, r.created ? r.created.slice(0, 10) : null, r.reason, r.missing.length ? el('span', {}, r.missing.map(function (m) { return pill(m, 'lose'); })) : null];
|
|
46
|
-
}, 'Missed joiners')));
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
var T = E.totals, bad = T['Criteria met, state not applied'] + T['Joiner ran, provisioning failed'] + T['No joiner activity recorded'] + T['Joiner ran, access not in place'];
|
|
50
|
-
w.appendChild(el('div', { className: 'bigstats' },
|
|
51
|
-
stat(T['Criteria met, state not applied'], 'criteria met, state not applied', 'lose'), stat(T['Joiner ran, provisioning failed'], 'joiner ran, provisioning failed', 'lose'),
|
|
52
|
-
stat(T['No joiner activity recorded'] + T['Joiner ran, access not in place'], 'access missing, no create recorded', 'lose'), stat(T['Joiner ran, still in progress'], 'still in progress'),
|
|
53
|
-
stat(T['Joiner complete'], 'joiner complete'), stat(T.checked, 'people checked')));
|
|
54
|
-
w.appendChild(el('p', { className: 'muted', text: 'ISC has no single "joiner triggered" event, so each person is checked three ways: what their lifecycle state is set up to grant, whether the identity profile\'s lifecycle mapping puts them in that state today (worked out with the Transform lab engine), and what ISC recorded (lifecycle changes, account activities, account creates passed or failed).' }));
|
|
55
|
-
if (E.states.length) w.appendChild(section('What each lifecycle state grants', E.states.length, simpleTable(['Identity profile', 'Lifecycle state', 'Access profiles', 'Enables accounts on'], E.states.map(function (x) {
|
|
56
|
-
return [x.profile, x.name + (x.enabled ? '' : ' (disabled)'), x.accessProfiles.map(function (a) { return a.name + (a.source ? ' (' + a.source + ')' : ''); }).join(', ') || '—', x.enableSources.map(function (a) { return a.name; }).join(', ') || '—'];
|
|
57
|
-
}), 'Lifecycle state configuration')));
|
|
58
|
-
if (d.birthright.length) w.appendChild(section('Accounts most of each profile has', d.birthright.length, simpleTable(['Identity profile', 'Active people', 'Sources nearly everyone has'], d.birthright.map(function (b) {
|
|
59
|
-
return [b.profile, b.people, b.sources.length ? b.sources.map(function (s) { return s.source + ' (' + s.share + '%)'; }).join(', ') : '—'];
|
|
60
|
-
}), 'Birthright accounts per identity profile')));
|
|
61
|
-
if (!bad && !T['State does not match the criteria']) w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No missed joiners: every person checked has what their lifecycle state grants, or it is in progress' })));
|
|
62
|
-
var tone = function (v) { return v === 'Joiner complete' ? 'gain' : v === 'Joiner ran, still in progress' || v === 'Could not tell' ? 'keep-other' : 'lose'; };
|
|
63
|
-
w.appendChild(section('People checked', E.rows.length, filteredTable(H, E.rows, ['Person', 'Lifecycle state', 'Verdict', 'Why', 'Recorded by ISC'], function (r) {
|
|
64
|
-
var ev = r.evidence.length ? el('details', {}, el('summary', { text: r.evidence.length + ' record' + (r.evidence.length === 1 ? '' : 's') }),
|
|
65
|
-
el('ul', { className: 'evlist' }, r.evidence.map(function (e) { return el('li', {}, el('span', { className: 'muted small', text: e.when ? e.when.slice(0, 16).replace('T', ' ') + ' ' : '' }), e.what, e.status ? ' ' : null, e.status ? pill(e.status.toLowerCase(), /fail|error/i.test(e.status) ? 'lose' : /pass|complete|commit/i.test(e.status) ? 'gain' : 'keep-other') : null, e.detail ? el('div', { className: 'small', text: e.detail }) : null); })))
|
|
66
|
-
: el('span', { className: 'muted', text: 'nothing' });
|
|
67
|
-
return [el('span', {}, r.person, el('div', { className: 'muted small', text: r.profile + (r.created ? ' · created ' + r.created.slice(0, 10) : '') })),
|
|
68
|
-
el('span', {}, r.lifecycle || '—', r.criteria ? el('div', { className: 'small' + (r.criteria === r.lifecycle ? ' muted' : ''), text: 'criteria: ' + r.criteria }) : r.criteriaNote ? el('div', { className: 'muted small', text: r.criteriaNote }) : null),
|
|
69
|
-
el('span', {}, pill(r.verdict, tone(r.verdict)), el('div', { className: 'muted small', text: r.reason })), r.why, ev];
|
|
70
|
-
}, 'Joiner check')));
|
|
71
|
-
w.appendChild(el('p', { className: 'muted small', text: 'Checked: people missing what their lifecycle state grants, people flagged by the birthright pattern (a source most of their identity profile has), past start dates, and everyone who joined in the period chosen. Birthright access given by roles with membership criteria is covered by the pattern, not the lifecycle state.' }));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Warnings > Missed leavers
|
|
75
|
-
function wnLeavers(w, _H, desc) {
|
|
76
|
-
var H = lcState().leavers;
|
|
77
|
-
if (!lcRunBar(w, H, 'leavers', 'Find missed leavers', desc, null, null, renderWarnings)) return;
|
|
78
|
-
var d = H.data, T = d.totals;
|
|
79
|
-
w.appendChild(el('div', { className: 'bigstats' }, stat(T.hrDisabled, 'HR says gone, ISC says active', 'lose'), stat(T.enabledAccounts, 'enabled accounts of leavers', 'lose'), stat(T.roles, 'roles or access profiles of leavers', 'lose'), stat(T.leavers, 'leavers checked')));
|
|
80
|
-
if (!d.rows.length) { w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No missed leavers found' }))); return; }
|
|
81
|
-
var kinds = [['all', 'All gaps'], ['HR account disabled, identity active', 'HR says gone, ISC says active'], ['Left, account still enabled', 'Accounts still enabled'], ['Left, still holds a role or access profile', 'Roles and access profiles']];
|
|
82
|
-
var sel = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Which gaps' }, kinds.map(function (k) { return el('option', { value: k[0], text: k[1] }); }));
|
|
83
|
-
sel.value = H.kind;
|
|
84
|
-
sel.addEventListener('change', function () { H.kind = sel.value; renderWarnings(); });
|
|
85
|
-
var rows = H.kind === 'all' ? d.rows : d.rows.filter(function (r) { return r.kind === H.kind; });
|
|
86
|
-
w.appendChild(section('Missed leavers', rows.length, filteredTable(H, rows, ['Person', 'Lifecycle state', 'Gap', 'Detail', 'Source'], function (r) {
|
|
87
|
-
return [el('span', {}, r.person, r.email ? el('div', { className: 'muted small', text: r.email }) : null), r.lifecycle, pill(r.kind, /HR/.test(r.kind) ? 'lose' : 'off'), r.detail, r.source];
|
|
88
|
-
}, 'Missed leavers', sel)));
|
|
89
|
-
w.appendChild(el('p', { className: 'muted small', text: '"HR says gone" means the account on the person’s own authoritative source is disabled while ISC still treats them as active: usually the lifecycle state does not follow the HR status. People active after their end date are on the End dates tab.' }));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Warnings > Mover leftovers
|
|
93
|
-
function renderMovers(w) {
|
|
94
|
-
var H = lcState().movers;
|
|
95
|
-
var extras = el('div', { className: 'bar' }, attrInput(H, 'groupBy', 'Compare people by attribute', 'department'),
|
|
96
|
-
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Unusual when held by under' }), numSelect(H, 'maxShare', [[2, '2% of the group'], [5, '5% of the group'], [10, '10% of the group']], 'Unusual share')));
|
|
97
|
-
if (!lcRunBar(w, H, 'movers', 'Find unusual access', 'Access that almost no one else in the person’s group has: often left over from a previous job (movers) or given as a one-off.', extras, function () { return { groupBy: H.groupBy || 'department', maxShare: H.maxShare }; }, renderWarnings)) return;
|
|
98
|
-
var d = H.data;
|
|
99
|
-
var people = {}; d.rows.forEach(function (r) { people[r.person] = 1; });
|
|
100
|
-
w.appendChild(el('div', { className: 'bigstats' }, stat(d.rows.length, 'unusual access items', 'lose'), stat(Object.keys(people).length, 'people'), stat(d.rows.filter(function (r) { return r.privileged; }).length, 'of them privileged', 'lose'), stat(d.groups, 'groups compared')));
|
|
101
|
-
if (!d.rows.length) { w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No unusual access found' }))); return; }
|
|
102
|
-
w.appendChild(section('Unusual access', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Person', 'Group (' + d.groupBy + ')', 'Access', 'Source', 'Holders in group'], function (r) {
|
|
103
|
-
return [el('span', {}, r.person, r.email ? el('div', { className: 'muted small', text: r.email }) : null), r.group, el('span', {}, r.access + ' ', r.privileged ? pill('privileged', 'lose') : null, el('div', { className: 'muted small', text: r.type })), r.source, r.holders + ' of ' + fmtNum(r.groupSize)];
|
|
104
|
-
}, 'Unusual access')));
|
|
105
|
-
w.appendChild(el('p', { className: 'muted small', text: 'Groups need at least 10 active people. Access held by at most 3 people of the group, and by fewer than the share you chose, counts as unusual. ISC user levels are left out (see Warnings > ISC admins).' }));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Audit > Admin accounts
|
|
109
|
-
function renderAdminAccounts(w) {
|
|
110
|
-
var H = lcState().accounts;
|
|
111
|
-
var inp = el('input', { className: 'input', value: H.words, style: 'min-width:340px', 'aria-label': 'Words in account names' });
|
|
112
|
-
inp.addEventListener('input', function () { H.words = inp.value; });
|
|
113
|
-
var extras = el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Words in account names' }), inp);
|
|
114
|
-
if (!lcRunBar(w, H, 'accounts', 'Find accounts', 'Admin, service and test accounts that are linked to a person: often shared or privileged accounts hiding under a normal identity.', extras, function () { return { words: H.words.split(/[\s,;]+/).filter(Boolean) }; }, renderAudit)) return;
|
|
115
|
-
var d = H.data;
|
|
116
|
-
var leftEnabled = d.rows.filter(function (r) { return r.left && !r.disabled; }).length;
|
|
117
|
-
w.appendChild(el('div', { className: 'bigstats' }, stat(d.rows.length, 'accounts found'), stat(leftEnabled, 'enabled, person has left', 'lose'), stat(d.rows.filter(function (r) { return r.privileged; }).length, 'privileged')));
|
|
118
|
-
if (!d.rows.length) { w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No such accounts linked to people' }))); return; }
|
|
119
|
-
w.appendChild(section('Accounts', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Account', 'Source', 'Linked to', 'Matched', 'State'], function (r) {
|
|
120
|
-
return [el('span', {}, r.account + ' ', r.privileged ? pill('privileged', 'lose') : null), r.source, el('span', {}, r.person, ' ', r.left ? pill('has left', 'lose') : null), r.word, r.disabled ? 'disabled' : 'enabled'];
|
|
121
|
-
}, 'Admin and service accounts linked to people')));
|
|
122
|
-
w.appendChild(el('p', { className: 'muted small', text: 'A word matches when it is a separate part of the name: adm.alice, svc_backup and alice-test match; "sample" does not match "sa". Decide per account whether it should belong to the person, to a service owner, or be removed.' }));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Audit > Exceptions
|
|
126
|
-
function renderExceptions(w) {
|
|
127
|
-
var H = lcState().exceptions;
|
|
128
|
-
if (!H.data && !H.busy) {
|
|
129
|
-
H.busy = 'Loading...';
|
|
130
|
-
api('/api/exceptions').then(function (d) { H.data = d; }, function (e) { H.error = errorText(e); }).then(function () { H.busy = null; if (state.au && state.au.tab === 'exceptions') renderAudit(); });
|
|
131
|
-
}
|
|
132
|
-
w.appendChild(el('p', { className: 'muted', text: 'Known findings someone accepted, with a reason and an end date. Until then they are left out of the instant check (on this computer and in scheduled checks), and they go into the evidence pack as your risk-acceptance register. Accept an item from the details of an instant check tile.' }));
|
|
133
|
-
if (H.busy) { w.appendChild(busyBox(H.busy)); return; }
|
|
134
|
-
if (H.error) { w.appendChild(el('div', { className: 'error', text: H.error })); return; }
|
|
135
|
-
var mine = H.data.exceptions.filter(function (e) { return e.tenant === H.data.tenant; });
|
|
136
|
-
var inForce = mine.filter(function (e) { return e.state === 'in force'; }).length;
|
|
137
|
-
w.appendChild(el('div', { className: 'bigstats' }, stat(inForce, 'in force'), stat(mine.filter(function (e) { return e.state === 'expired'; }).length, 'expired: decide again', 'lose'), stat(mine.filter(function (e) { return e.state === 'ended'; }).length, 'ended')));
|
|
138
|
-
if (!mine.length) { w.appendChild(el('p', { className: 'muted', text: 'No exceptions for this tenant yet.' })); return; }
|
|
139
|
-
w.appendChild(section('Exceptions for this tenant', mine.length, simpleTable(['Check', 'Item', 'Reason', 'Accepted by', 'Until', 'State', 'Action'], mine.map(function (e) {
|
|
140
|
-
return [e.checkLabel, e.key, e.reason, e.acceptedBy + ' (' + e.created.slice(0, 10) + ')', e.until,
|
|
141
|
-
pill(e.state + (e.ended ? ' ' + e.ended.slice(0, 10) : ''), e.state === 'in force' ? 'keep-other' : e.state === 'expired' ? 'lose' : 'off'),
|
|
142
|
-
e.state === 'in force' ? el('button', { className: 'btn sm', onclick: function () { endExceptionDialog(e); } }, 'End now') : null];
|
|
143
|
-
}), 'Accepted exceptions')));
|
|
144
|
-
}
|
|
145
|
-
function endExceptionDialog(e) {
|
|
146
|
-
var who = el('input', { className: 'input', placeholder: 'Your name', 'aria-label': 'Ended by' });
|
|
147
|
-
var msg = el('div');
|
|
148
|
-
var box = el('div', { className: 'card', role: 'dialog', 'aria-label': 'End exception', style: 'position:fixed;inset:auto 0 0 0;margin:0 auto 24px;max-width:520px;z-index:50;box-shadow:0 10px 40px rgba(0,0,0,.25)' },
|
|
149
|
-
el('h3', { text: 'End this exception now?' }), el('p', { className: 'muted', text: e.checkLabel + ': ' + e.key }), who, msg,
|
|
150
|
-
el('div', { className: 'bar', style: 'margin-top:10px;justify-content:flex-end' },
|
|
151
|
-
el('button', { className: 'btn', onclick: function () { box.remove(); } }, 'Cancel'),
|
|
152
|
-
el('button', { className: 'btn primary', onclick: function () {
|
|
153
|
-
if (who.value.trim().length < 2) { msg.textContent = ''; msg.appendChild(el('div', { className: 'error', text: 'Say who ends it.' })); return; }
|
|
154
|
-
api('/api/exceptions/' + e.id + '/end', 'POST', { by: who.value.trim() }).then(function () { box.remove(); lcState().exceptions.data = null; toast('Exception ended'); renderAudit(); }, function (err) { msg.textContent = ''; msg.appendChild(el('div', { className: 'error', text: errorText(err) })); });
|
|
155
|
-
} }, 'End it')));
|
|
156
|
-
box.addEventListener('keydown', function (ev) { if (ev.key === 'Escape') box.remove(); });
|
|
157
|
-
document.body.appendChild(box);
|
|
158
|
-
who.focus();
|
|
159
|
-
}
|
|
160
|
-
// Instant check: accept one row as an exception
|
|
161
|
-
function acceptDialog(m, key, done) {
|
|
162
|
-
var inYear = new Date(Date.now() + 90 * 86400000).toISOString().slice(0, 10);
|
|
163
|
-
var reason = el('textarea', { className: 'input', rows: '2', placeholder: 'Why this is acceptable (e.g. vendor-managed account, reviewed by the security team)', 'aria-label': 'Reason' });
|
|
164
|
-
var who = el('input', { className: 'input', placeholder: 'Name and role, e.g. Priya Shah, IAM lead', 'aria-label': 'Accepted by' });
|
|
165
|
-
var until = el('input', { className: 'input', type: 'date', value: inYear, 'aria-label': 'Until', style: 'max-width:180px' });
|
|
166
|
-
var msg = el('div');
|
|
167
|
-
var box = el('div', { className: 'card', role: 'dialog', 'aria-label': 'Accept as exception', style: 'position:fixed;inset:auto 0 0 0;margin:0 auto 24px;max-width:560px;z-index:50;box-shadow:0 10px 40px rgba(0,0,0,.25)' },
|
|
168
|
-
el('h3', { text: 'Accept as an exception' }), el('p', { className: 'muted', text: m.label + ': ' + key }),
|
|
169
|
-
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Reason' }), reason),
|
|
170
|
-
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Accepted by' }), who),
|
|
171
|
-
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Until (at most two years)' }), until), msg,
|
|
172
|
-
el('div', { className: 'bar', style: 'justify-content:flex-end' },
|
|
173
|
-
el('button', { className: 'btn', onclick: function () { box.remove(); } }, 'Cancel'),
|
|
174
|
-
el('button', { className: 'btn primary', onclick: function () {
|
|
175
|
-
api('/api/exceptions', 'POST', { check: m.id, key: key, reason: reason.value, acceptedBy: who.value, until: until.value }).then(function () {
|
|
176
|
-
box.remove(); lcState().exceptions.data = null; toast('Accepted until ' + until.value + '. It is left out from the next check.'); if (done) done();
|
|
177
|
-
}, function (err) { msg.textContent = ''; msg.appendChild(el('div', { className: 'error', text: errorText(err) })); });
|
|
178
|
-
} }, 'Accept')));
|
|
179
|
-
box.addEventListener('keydown', function (ev) { if (ev.key === 'Escape') box.remove(); });
|
|
180
|
-
document.body.appendChild(box);
|
|
181
|
-
reason.focus();
|
|
182
|
-
}
|
|
1
|
+
// ---------- Joiner, mover and leaver gaps; admin accounts; accepted exceptions ----------
|
|
2
|
+
function lcState() {
|
|
3
|
+
if (!state.lc) state.lc = { joiners: { graceDays: 3, share: 90, startDateAttribute: '' }, leavers: { kind: 'all' }, movers: { groupBy: 'department', maxShare: 5 }, accounts: { words: 'admin, adm, svc, service, test, tst, sa, root, sys, shared, generic' }, exceptions: {} };
|
|
4
|
+
return state.lc;
|
|
5
|
+
}
|
|
6
|
+
function lcRunBar(w, H, path, label, desc, extras, body, rerender) {
|
|
7
|
+
w.appendChild(el('div', { className: 'bar', style: 'margin-bottom:14px' }, el('span', { className: 'muted', style: 'flex:1;min-width:260px', text: desc }), extras || null,
|
|
8
|
+
el('button', { className: 'btn primary', disabled: !!H.busy, onclick: function () { runJobInto(H, '/api/lifecycle/' + path + '/run', body ? body() : {}, rerender); } }, icon('play'), H.data ? 'Read again' : label)));
|
|
9
|
+
if (H.busy) { w.appendChild(busyBox(H.busy)); return false; }
|
|
10
|
+
if (H.error) { w.appendChild(el('div', { className: 'error', text: H.error })); return false; }
|
|
11
|
+
if (!H.data) return false;
|
|
12
|
+
(H.data.notes || []).forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
function filteredTable(H, rows, headers, toCells, label, extraBar) {
|
|
16
|
+
var f = el('input', { className: 'input', placeholder: 'Filter...', value: H.q || '', style: 'max-width:280px', 'aria-label': 'Filter ' + label });
|
|
17
|
+
var box = el('div');
|
|
18
|
+
var draw = function () {
|
|
19
|
+
var q = (H.q || '').toLowerCase();
|
|
20
|
+
var list = rows.filter(function (r) { return !q || JSON.stringify(r).toLowerCase().indexOf(q) >= 0; });
|
|
21
|
+
box.textContent = '';
|
|
22
|
+
box.appendChild(list.length ? simpleTable(headers, list.slice(0, 2000).map(toCells), label) : el('p', { className: 'muted', text: 'Nothing matches.' }));
|
|
23
|
+
if (list.length > 2000 || H.data.more) box.appendChild(el('p', { className: 'muted small', text: 'Showing the first 2,000. The download has all of them.' }));
|
|
24
|
+
};
|
|
25
|
+
f.addEventListener('input', function () { H.q = f.value; draw(); });
|
|
26
|
+
draw();
|
|
27
|
+
return el('div', {}, el('div', { className: 'bar', style: 'margin-bottom:10px' }, f, extraBar || null, el('span', { style: 'flex:1' }), downloads(H.job)), box);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Warnings > Missed joiners
|
|
31
|
+
function wnJoiners(w, _H, desc) {
|
|
32
|
+
var H = lcState().joiners;
|
|
33
|
+
var extras = el('div', { className: 'bar' },
|
|
34
|
+
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Birthright when held by' }), numSelect(H, 'share', [[80, '80% of the profile'], [90, '90% of the profile'], [95, '95% of the profile']], 'Birthright share')),
|
|
35
|
+
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Grace period' }), numSelect(H, 'graceDays', [[1, '1 day'], [3, '3 days'], [7, '7 days'], [14, '14 days']], 'Grace period')),
|
|
36
|
+
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Also check joiners of the last' }), numSelect(H, 'recentDays', [[7, '7 days'], [30, '30 days'], [90, '90 days']], 'Recent joiners')),
|
|
37
|
+
attrInput(H, 'startDateAttribute', 'Start-date attribute (optional)', 'startDate'));
|
|
38
|
+
if (!H.recentDays) H.recentDays = 30;
|
|
39
|
+
if (!lcRunBar(w, H, 'joiners', 'Find missed joiners', desc, extras, function () { return { share: H.share, graceDays: H.graceDays, recentDays: H.recentDays, startDateAttribute: H.startDateAttribute || undefined }; }, renderWarnings)) return;
|
|
40
|
+
var d = H.data, E = d.evidence;
|
|
41
|
+
if (!E) {
|
|
42
|
+
var started = d.rows.filter(function (r) { return !r.missing.length; }).length;
|
|
43
|
+
w.appendChild(el('div', { className: 'bigstats' }, stat(d.rows.length - started, 'missing a birthright account', 'lose'), stat(started, 'past start date, still pre-hire', 'lose'), stat(d.checked, 'active people checked')));
|
|
44
|
+
if (d.rows.length) w.appendChild(section('Missed joiners', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Person', 'Identity profile', 'Created', 'Why', 'Missing accounts on'], function (r) {
|
|
45
|
+
return [el('span', {}, r.person, r.email ? el('div', { className: 'muted small', text: r.email }) : null), r.profile, r.created ? r.created.slice(0, 10) : null, r.reason, r.missing.length ? el('span', {}, r.missing.map(function (m) { return pill(m, 'lose'); })) : null];
|
|
46
|
+
}, 'Missed joiners')));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var T = E.totals, bad = T['Criteria met, state not applied'] + T['Joiner ran, provisioning failed'] + T['No joiner activity recorded'] + T['Joiner ran, access not in place'];
|
|
50
|
+
w.appendChild(el('div', { className: 'bigstats' },
|
|
51
|
+
stat(T['Criteria met, state not applied'], 'criteria met, state not applied', 'lose'), stat(T['Joiner ran, provisioning failed'], 'joiner ran, provisioning failed', 'lose'),
|
|
52
|
+
stat(T['No joiner activity recorded'] + T['Joiner ran, access not in place'], 'access missing, no create recorded', 'lose'), stat(T['Joiner ran, still in progress'], 'still in progress'),
|
|
53
|
+
stat(T['Joiner complete'], 'joiner complete'), stat(T.checked, 'people checked')));
|
|
54
|
+
w.appendChild(el('p', { className: 'muted', text: 'ISC has no single "joiner triggered" event, so each person is checked three ways: what their lifecycle state is set up to grant, whether the identity profile\'s lifecycle mapping puts them in that state today (worked out with the Transform lab engine), and what ISC recorded (lifecycle changes, account activities, account creates passed or failed).' }));
|
|
55
|
+
if (E.states.length) w.appendChild(section('What each lifecycle state grants', E.states.length, simpleTable(['Identity profile', 'Lifecycle state', 'Access profiles', 'Enables accounts on'], E.states.map(function (x) {
|
|
56
|
+
return [x.profile, x.name + (x.enabled ? '' : ' (disabled)'), x.accessProfiles.map(function (a) { return a.name + (a.source ? ' (' + a.source + ')' : ''); }).join(', ') || '—', x.enableSources.map(function (a) { return a.name; }).join(', ') || '—'];
|
|
57
|
+
}), 'Lifecycle state configuration')));
|
|
58
|
+
if (d.birthright.length) w.appendChild(section('Accounts most of each profile has', d.birthright.length, simpleTable(['Identity profile', 'Active people', 'Sources nearly everyone has'], d.birthright.map(function (b) {
|
|
59
|
+
return [b.profile, b.people, b.sources.length ? b.sources.map(function (s) { return s.source + ' (' + s.share + '%)'; }).join(', ') : '—'];
|
|
60
|
+
}), 'Birthright accounts per identity profile')));
|
|
61
|
+
if (!bad && !T['State does not match the criteria']) w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No missed joiners: every person checked has what their lifecycle state grants, or it is in progress' })));
|
|
62
|
+
var tone = function (v) { return v === 'Joiner complete' ? 'gain' : v === 'Joiner ran, still in progress' || v === 'Could not tell' ? 'keep-other' : 'lose'; };
|
|
63
|
+
w.appendChild(section('People checked', E.rows.length, filteredTable(H, E.rows, ['Person', 'Lifecycle state', 'Verdict', 'Why', 'Recorded by ISC'], function (r) {
|
|
64
|
+
var ev = r.evidence.length ? el('details', {}, el('summary', { text: r.evidence.length + ' record' + (r.evidence.length === 1 ? '' : 's') }),
|
|
65
|
+
el('ul', { className: 'evlist' }, r.evidence.map(function (e) { return el('li', {}, el('span', { className: 'muted small', text: e.when ? e.when.slice(0, 16).replace('T', ' ') + ' ' : '' }), e.what, e.status ? ' ' : null, e.status ? pill(e.status.toLowerCase(), /fail|error/i.test(e.status) ? 'lose' : /pass|complete|commit/i.test(e.status) ? 'gain' : 'keep-other') : null, e.detail ? el('div', { className: 'small', text: e.detail }) : null); })))
|
|
66
|
+
: el('span', { className: 'muted', text: 'nothing' });
|
|
67
|
+
return [el('span', {}, r.person, el('div', { className: 'muted small', text: r.profile + (r.created ? ' · created ' + r.created.slice(0, 10) : '') })),
|
|
68
|
+
el('span', {}, r.lifecycle || '—', r.criteria ? el('div', { className: 'small' + (r.criteria === r.lifecycle ? ' muted' : ''), text: 'criteria: ' + r.criteria }) : r.criteriaNote ? el('div', { className: 'muted small', text: r.criteriaNote }) : null),
|
|
69
|
+
el('span', {}, pill(r.verdict, tone(r.verdict)), el('div', { className: 'muted small', text: r.reason })), r.why, ev];
|
|
70
|
+
}, 'Joiner check')));
|
|
71
|
+
w.appendChild(el('p', { className: 'muted small', text: 'Checked: people missing what their lifecycle state grants, people flagged by the birthright pattern (a source most of their identity profile has), past start dates, and everyone who joined in the period chosen. Birthright access given by roles with membership criteria is covered by the pattern, not the lifecycle state.' }));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Warnings > Missed leavers
|
|
75
|
+
function wnLeavers(w, _H, desc) {
|
|
76
|
+
var H = lcState().leavers;
|
|
77
|
+
if (!lcRunBar(w, H, 'leavers', 'Find missed leavers', desc, null, null, renderWarnings)) return;
|
|
78
|
+
var d = H.data, T = d.totals;
|
|
79
|
+
w.appendChild(el('div', { className: 'bigstats' }, stat(T.hrDisabled, 'HR says gone, ISC says active', 'lose'), stat(T.enabledAccounts, 'enabled accounts of leavers', 'lose'), stat(T.roles, 'roles or access profiles of leavers', 'lose'), stat(T.leavers, 'leavers checked')));
|
|
80
|
+
if (!d.rows.length) { w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No missed leavers found' }))); return; }
|
|
81
|
+
var kinds = [['all', 'All gaps'], ['HR account disabled, identity active', 'HR says gone, ISC says active'], ['Left, account still enabled', 'Accounts still enabled'], ['Left, still holds a role or access profile', 'Roles and access profiles']];
|
|
82
|
+
var sel = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Which gaps' }, kinds.map(function (k) { return el('option', { value: k[0], text: k[1] }); }));
|
|
83
|
+
sel.value = H.kind;
|
|
84
|
+
sel.addEventListener('change', function () { H.kind = sel.value; renderWarnings(); });
|
|
85
|
+
var rows = H.kind === 'all' ? d.rows : d.rows.filter(function (r) { return r.kind === H.kind; });
|
|
86
|
+
w.appendChild(section('Missed leavers', rows.length, filteredTable(H, rows, ['Person', 'Lifecycle state', 'Gap', 'Detail', 'Source'], function (r) {
|
|
87
|
+
return [el('span', {}, r.person, r.email ? el('div', { className: 'muted small', text: r.email }) : null), r.lifecycle, pill(r.kind, /HR/.test(r.kind) ? 'lose' : 'off'), r.detail, r.source];
|
|
88
|
+
}, 'Missed leavers', sel)));
|
|
89
|
+
w.appendChild(el('p', { className: 'muted small', text: '"HR says gone" means the account on the person’s own authoritative source is disabled while ISC still treats them as active: usually the lifecycle state does not follow the HR status. People active after their end date are on the End dates tab.' }));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Warnings > Mover leftovers
|
|
93
|
+
function renderMovers(w) {
|
|
94
|
+
var H = lcState().movers;
|
|
95
|
+
var extras = el('div', { className: 'bar' }, attrInput(H, 'groupBy', 'Compare people by attribute', 'department'),
|
|
96
|
+
el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Unusual when held by under' }), numSelect(H, 'maxShare', [[2, '2% of the group'], [5, '5% of the group'], [10, '10% of the group']], 'Unusual share')));
|
|
97
|
+
if (!lcRunBar(w, H, 'movers', 'Find unusual access', 'Access that almost no one else in the person’s group has: often left over from a previous job (movers) or given as a one-off.', extras, function () { return { groupBy: H.groupBy || 'department', maxShare: H.maxShare }; }, renderWarnings)) return;
|
|
98
|
+
var d = H.data;
|
|
99
|
+
var people = {}; d.rows.forEach(function (r) { people[r.person] = 1; });
|
|
100
|
+
w.appendChild(el('div', { className: 'bigstats' }, stat(d.rows.length, 'unusual access items', 'lose'), stat(Object.keys(people).length, 'people'), stat(d.rows.filter(function (r) { return r.privileged; }).length, 'of them privileged', 'lose'), stat(d.groups, 'groups compared')));
|
|
101
|
+
if (!d.rows.length) { w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No unusual access found' }))); return; }
|
|
102
|
+
w.appendChild(section('Unusual access', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Person', 'Group (' + d.groupBy + ')', 'Access', 'Source', 'Holders in group'], function (r) {
|
|
103
|
+
return [el('span', {}, r.person, r.email ? el('div', { className: 'muted small', text: r.email }) : null), r.group, el('span', {}, r.access + ' ', r.privileged ? pill('privileged', 'lose') : null, el('div', { className: 'muted small', text: r.type })), r.source, r.holders + ' of ' + fmtNum(r.groupSize)];
|
|
104
|
+
}, 'Unusual access')));
|
|
105
|
+
w.appendChild(el('p', { className: 'muted small', text: 'Groups need at least 10 active people. Access held by at most 3 people of the group, and by fewer than the share you chose, counts as unusual. ISC user levels are left out (see Warnings > ISC admins).' }));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Audit > Admin accounts
|
|
109
|
+
function renderAdminAccounts(w) {
|
|
110
|
+
var H = lcState().accounts;
|
|
111
|
+
var inp = el('input', { className: 'input', value: H.words, style: 'min-width:340px', 'aria-label': 'Words in account names' });
|
|
112
|
+
inp.addEventListener('input', function () { H.words = inp.value; });
|
|
113
|
+
var extras = el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Words in account names' }), inp);
|
|
114
|
+
if (!lcRunBar(w, H, 'accounts', 'Find accounts', 'Admin, service and test accounts that are linked to a person: often shared or privileged accounts hiding under a normal identity.', extras, function () { return { words: H.words.split(/[\s,;]+/).filter(Boolean) }; }, renderAudit)) return;
|
|
115
|
+
var d = H.data;
|
|
116
|
+
var leftEnabled = d.rows.filter(function (r) { return r.left && !r.disabled; }).length;
|
|
117
|
+
w.appendChild(el('div', { className: 'bigstats' }, stat(d.rows.length, 'accounts found'), stat(leftEnabled, 'enabled, person has left', 'lose'), stat(d.rows.filter(function (r) { return r.privileged; }).length, 'privileged')));
|
|
118
|
+
if (!d.rows.length) { w.appendChild(el('div', { className: 'banner ok' }, el('b', { text: 'No such accounts linked to people' }))); return; }
|
|
119
|
+
w.appendChild(section('Accounts', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Account', 'Source', 'Linked to', 'Matched', 'State'], function (r) {
|
|
120
|
+
return [el('span', {}, r.account + ' ', r.privileged ? pill('privileged', 'lose') : null), r.source, el('span', {}, r.person, ' ', r.left ? pill('has left', 'lose') : null), r.word, r.disabled ? 'disabled' : 'enabled'];
|
|
121
|
+
}, 'Admin and service accounts linked to people')));
|
|
122
|
+
w.appendChild(el('p', { className: 'muted small', text: 'A word matches when it is a separate part of the name: adm.alice, svc_backup and alice-test match; "sample" does not match "sa". Decide per account whether it should belong to the person, to a service owner, or be removed.' }));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Audit > Exceptions
|
|
126
|
+
function renderExceptions(w) {
|
|
127
|
+
var H = lcState().exceptions;
|
|
128
|
+
if (!H.data && !H.busy) {
|
|
129
|
+
H.busy = 'Loading...';
|
|
130
|
+
api('/api/exceptions').then(function (d) { H.data = d; }, function (e) { H.error = errorText(e); }).then(function () { H.busy = null; if (state.au && state.au.tab === 'exceptions') renderAudit(); });
|
|
131
|
+
}
|
|
132
|
+
w.appendChild(el('p', { className: 'muted', text: 'Known findings someone accepted, with a reason and an end date. Until then they are left out of the instant check (on this computer and in scheduled checks), and they go into the evidence pack as your risk-acceptance register. Accept an item from the details of an instant check tile.' }));
|
|
133
|
+
if (H.busy) { w.appendChild(busyBox(H.busy)); return; }
|
|
134
|
+
if (H.error) { w.appendChild(el('div', { className: 'error', text: H.error })); return; }
|
|
135
|
+
var mine = H.data.exceptions.filter(function (e) { return e.tenant === H.data.tenant; });
|
|
136
|
+
var inForce = mine.filter(function (e) { return e.state === 'in force'; }).length;
|
|
137
|
+
w.appendChild(el('div', { className: 'bigstats' }, stat(inForce, 'in force'), stat(mine.filter(function (e) { return e.state === 'expired'; }).length, 'expired: decide again', 'lose'), stat(mine.filter(function (e) { return e.state === 'ended'; }).length, 'ended')));
|
|
138
|
+
if (!mine.length) { w.appendChild(el('p', { className: 'muted', text: 'No exceptions for this tenant yet.' })); return; }
|
|
139
|
+
w.appendChild(section('Exceptions for this tenant', mine.length, simpleTable(['Check', 'Item', 'Reason', 'Accepted by', 'Until', 'State', 'Action'], mine.map(function (e) {
|
|
140
|
+
return [e.checkLabel, e.key, e.reason, e.acceptedBy + ' (' + e.created.slice(0, 10) + ')', e.until,
|
|
141
|
+
pill(e.state + (e.ended ? ' ' + e.ended.slice(0, 10) : ''), e.state === 'in force' ? 'keep-other' : e.state === 'expired' ? 'lose' : 'off'),
|
|
142
|
+
e.state === 'in force' ? el('button', { className: 'btn sm', onclick: function () { endExceptionDialog(e); } }, 'End now') : null];
|
|
143
|
+
}), 'Accepted exceptions')));
|
|
144
|
+
}
|
|
145
|
+
function endExceptionDialog(e) {
|
|
146
|
+
var who = el('input', { className: 'input', placeholder: 'Your name', 'aria-label': 'Ended by' });
|
|
147
|
+
var msg = el('div');
|
|
148
|
+
var box = el('div', { className: 'card', role: 'dialog', 'aria-label': 'End exception', style: 'position:fixed;inset:auto 0 0 0;margin:0 auto 24px;max-width:520px;z-index:50;box-shadow:0 10px 40px rgba(0,0,0,.25)' },
|
|
149
|
+
el('h3', { text: 'End this exception now?' }), el('p', { className: 'muted', text: e.checkLabel + ': ' + e.key }), who, msg,
|
|
150
|
+
el('div', { className: 'bar', style: 'margin-top:10px;justify-content:flex-end' },
|
|
151
|
+
el('button', { className: 'btn', onclick: function () { box.remove(); } }, 'Cancel'),
|
|
152
|
+
el('button', { className: 'btn primary', onclick: function () {
|
|
153
|
+
if (who.value.trim().length < 2) { msg.textContent = ''; msg.appendChild(el('div', { className: 'error', text: 'Say who ends it.' })); return; }
|
|
154
|
+
api('/api/exceptions/' + e.id + '/end', 'POST', { by: who.value.trim() }).then(function () { box.remove(); lcState().exceptions.data = null; toast('Exception ended'); renderAudit(); }, function (err) { msg.textContent = ''; msg.appendChild(el('div', { className: 'error', text: errorText(err) })); });
|
|
155
|
+
} }, 'End it')));
|
|
156
|
+
box.addEventListener('keydown', function (ev) { if (ev.key === 'Escape') box.remove(); });
|
|
157
|
+
document.body.appendChild(box);
|
|
158
|
+
who.focus();
|
|
159
|
+
}
|
|
160
|
+
// Instant check: accept one row as an exception
|
|
161
|
+
function acceptDialog(m, key, done) {
|
|
162
|
+
var inYear = new Date(Date.now() + 90 * 86400000).toISOString().slice(0, 10);
|
|
163
|
+
var reason = el('textarea', { className: 'input', rows: '2', placeholder: 'Why this is acceptable (e.g. vendor-managed account, reviewed by the security team)', 'aria-label': 'Reason' });
|
|
164
|
+
var who = el('input', { className: 'input', placeholder: 'Name and role, e.g. Priya Shah, IAM lead', 'aria-label': 'Accepted by' });
|
|
165
|
+
var until = el('input', { className: 'input', type: 'date', value: inYear, 'aria-label': 'Until', style: 'max-width:180px' });
|
|
166
|
+
var msg = el('div');
|
|
167
|
+
var box = el('div', { className: 'card', role: 'dialog', 'aria-label': 'Accept as exception', style: 'position:fixed;inset:auto 0 0 0;margin:0 auto 24px;max-width:560px;z-index:50;box-shadow:0 10px 40px rgba(0,0,0,.25)' },
|
|
168
|
+
el('h3', { text: 'Accept as an exception' }), el('p', { className: 'muted', text: m.label + ': ' + key }),
|
|
169
|
+
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Reason' }), reason),
|
|
170
|
+
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Accepted by' }), who),
|
|
171
|
+
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Until (at most two years)' }), until), msg,
|
|
172
|
+
el('div', { className: 'bar', style: 'justify-content:flex-end' },
|
|
173
|
+
el('button', { className: 'btn', onclick: function () { box.remove(); } }, 'Cancel'),
|
|
174
|
+
el('button', { className: 'btn primary', onclick: function () {
|
|
175
|
+
api('/api/exceptions', 'POST', { check: m.id, key: key, reason: reason.value, acceptedBy: who.value, until: until.value }).then(function () {
|
|
176
|
+
box.remove(); lcState().exceptions.data = null; toast('Accepted until ' + until.value + '. It is left out from the next check.'); if (done) done();
|
|
177
|
+
}, function (err) { msg.textContent = ''; msg.appendChild(el('div', { className: 'error', text: errorText(err) })); });
|
|
178
|
+
} }, 'Accept')));
|
|
179
|
+
box.addEventListener('keydown', function (ev) { if (ev.key === 'Escape') box.remove(); });
|
|
180
|
+
document.body.appendChild(box);
|
|
181
|
+
reason.focus();
|
|
182
|
+
}
|