strapi-plugin-magic-sessionmanager 4.18.0 → 4.19.1
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/CHANGELOG.md +38 -0
- package/README.md +37 -35
- package/dist/admin/{Analytics-C8fV6LDV.js → Analytics-BElmzyNJ.js} +1 -1
- package/dist/admin/{Analytics-CBspdl1I.mjs → Analytics-BqFlgLnN.mjs} +1 -1
- package/dist/admin/{App-PLwqaRSQ.mjs → App-0thsC_P9.mjs} +1188 -170
- package/dist/admin/{App-D92MTQmn.js → App-D_J2eeEG.js} +1216 -198
- package/dist/admin/{OnlineUsersWidget-CwfBJdIX.mjs → OnlineUsersWidget-BgJ1ws-5.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-CiKapC1B.js → OnlineUsersWidget-DMZBwqdY.js} +1 -1
- package/dist/admin/{Settings-Duil_4jv.js → Settings-FOkui_ke.js} +40 -270
- package/dist/admin/{Settings-CMgL-Aub.mjs → Settings-QN3Mu4AQ.mjs} +2 -232
- package/dist/admin/{de-CnInuvMY.js → de-CEyi4lpp.js} +66 -4
- package/dist/admin/{de-D2BqfY1f.mjs → de-uGKSKVYD.mjs} +66 -4
- package/dist/admin/{en-KnmmYHTF.js → en-CSXeJYKy.js} +66 -4
- package/dist/admin/{en-BPy208we.mjs → en-Yu7tfwqx.mjs} +66 -4
- package/dist/admin/{es-D1NGCAJK.js → es-BrKqXhAU.js} +66 -4
- package/dist/admin/{es-B4VNeT0A.mjs → es-iNG9Amf9.mjs} +66 -4
- package/dist/admin/{fr-AwhLN1BC.mjs → fr-CaFICHlf.mjs} +66 -4
- package/dist/admin/{fr-D1KNyogi.js → fr-DKZNfdlH.js} +66 -4
- package/dist/admin/{index-Bnt0Jq6O.js → index-DEYtqPc3.js} +9 -9
- package/dist/admin/{index-BmnC2BPs.mjs → index-h-ksmM8A.mjs} +9 -9
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-D6m1TijL.mjs → pt-Bz2hWVrq.mjs} +66 -4
- package/dist/admin/{pt-EKThRXPY.js → pt-IEagyVDL.js} +66 -4
- package/dist/admin/settingsTabs-D02CuEvs.mjs +433 -0
- package/dist/admin/settingsTabs-N4TFn-mw.js +432 -0
- package/dist/server/index.js +41 -8
- package/dist/server/index.mjs +41 -8
- package/package.json +1 -1
- package/dist/admin/dashboardModel-BhUonEqc.mjs +0 -189
- package/dist/admin/dashboardModel-sksvIc1c.js +0 -188
|
@@ -703,9 +703,9 @@ const pt = {
|
|
|
703
703
|
"adminPanel.activity.reason.passwordReset": "Conectado após redefinir a senha",
|
|
704
704
|
"adminPanel.activity.reason.rateLimited": "Tentativas demais",
|
|
705
705
|
"adminPanel.activity.reason.registration": "Primeiro acesso após o cadastro",
|
|
706
|
-
"adminPanel.activity.recent.empty": "Ainda não há eventos
|
|
707
|
-
"adminPanel.activity.recent.subtitle": "Os acessos, tentativas falhas
|
|
708
|
-
"adminPanel.activity.recent.title": "Atividade de
|
|
706
|
+
"adminPanel.activity.recent.empty": "Ainda não há eventos registrados.",
|
|
707
|
+
"adminPanel.activity.recent.subtitle": "Os acessos, tentativas falhas, encerramentos de sessão e alterações de configurações mais recentes de todos os administradores. Selecione um evento para ver os detalhes.",
|
|
708
|
+
"adminPanel.activity.recent.title": "Atividade de segurança recente",
|
|
709
709
|
"adminPanel.activity.scope.everywhere": "Todos os navegadores",
|
|
710
710
|
"adminPanel.activity.scope.oneBrowser": "Um navegador",
|
|
711
711
|
"adminPanel.activity.session.active": "Ainda conectado",
|
|
@@ -942,6 +942,68 @@ const pt = {
|
|
|
942
942
|
"settings.webhookEvents.notMe": "«Não fui eu» utilizado",
|
|
943
943
|
"settings.webhookEvents.passwordChanged": "Sessões terminadas após uma alteração da palavra-passe",
|
|
944
944
|
"settings.webhookEvents.sessionLimit": "Limite de sessões atingido",
|
|
945
|
-
"settings.webhookEvents.title": "Eventos a enviar"
|
|
945
|
+
"settings.webhookEvents.title": "Eventos a enviar",
|
|
946
|
+
"adminPanel.activity.recent.showAll": "Ver tudo",
|
|
947
|
+
"adminPanel.activity.details.open": "Detalhes de {event}, {time}",
|
|
948
|
+
"adminPanel.activity.column.time": "Hora",
|
|
949
|
+
"adminPanel.activity.column.event": "Evento",
|
|
950
|
+
"adminPanel.activity.column.admin": "Administrador",
|
|
951
|
+
"adminPanel.activity.column.details": "Endereço IP e dispositivo",
|
|
952
|
+
"adminPanel.activity.column.session": "Sessão",
|
|
953
|
+
"adminPanel.activity.column.doneBy": "Feito por",
|
|
954
|
+
"adminPanel.activity.column.action": "Ação",
|
|
955
|
+
"adminPanel.activity.column.entry": "Entrada",
|
|
956
|
+
"adminPanel.activity.column.contentType": "Tipo de conteúdo",
|
|
957
|
+
"adminPanel.activity.page.title": "Atividade de segurança",
|
|
958
|
+
"adminPanel.activity.page.subtitle": "Acessos, tentativas falhas, bloqueios e encerramentos de sessão de todos os administradores, além de alterações de configurações, leituras deste registro com um token de API e limpezas por retenção. Os mais recentes primeiro.",
|
|
959
|
+
"adminPanel.activity.page.removeAdmin": "Mostrar novamente todos os administradores",
|
|
960
|
+
"adminPanel.activity.page.adminFilter": "Administrador: {name}",
|
|
961
|
+
"adminPanel.activity.page.caption": "{total, plural, =0 {Nenhum evento} one {# evento} other {# eventos}}",
|
|
962
|
+
"adminPanel.activity.page.noResults": "Nenhum evento corresponde a estes filtros.",
|
|
963
|
+
"adminPanel.activity.page.onlyAdmin": "Mostrar apenas os eventos de {name}",
|
|
964
|
+
"adminPanel.activity.page.export": "Exportar a atividade de segurança com estes filtros como CSV",
|
|
965
|
+
"adminPanel.activity.filter.changes": "Configurações e acesso ao registro",
|
|
966
|
+
"adminPanel.activity.details.exactTime": "Hora exata",
|
|
967
|
+
"adminPanel.activity.details.signedOutOf": "Sessão encerrada em",
|
|
968
|
+
"adminPanel.activity.details.scopeCount": "{scope} ({count, plural, =0 {nenhuma sessão aberta} one {# sessão encerrada} other {# sessões encerradas}})",
|
|
969
|
+
"adminPanel.activity.details.changedSettings": "Configurações alteradas",
|
|
970
|
+
"adminPanel.activity.details.deleted": "Eventos excluídos",
|
|
971
|
+
"adminPanel.activity.details.retention": "Mantidos por",
|
|
972
|
+
"adminPanel.activity.details.attempts": "Tentativas",
|
|
973
|
+
"adminPanel.activity.details.ip": "Endereço IP",
|
|
974
|
+
"adminPanel.activity.details.location": "Localização",
|
|
975
|
+
"adminPanel.activity.details.browser": "Navegador",
|
|
976
|
+
"adminPanel.activity.details.os": "Sistema operacional",
|
|
977
|
+
"adminPanel.activity.details.userAgent": "Agente do usuário",
|
|
978
|
+
"adminPanel.activity.details.eventId": "ID do evento",
|
|
979
|
+
"adminPanel.activity.details.title": "{event}: {name}",
|
|
980
|
+
"adminPanel.activity.details.uid": "UID do tipo de conteúdo",
|
|
981
|
+
"adminPanel.activity.details.documentId": "ID do documento",
|
|
982
|
+
"adminPanel.activity.details.locale": "Idioma",
|
|
983
|
+
"adminPanel.activity.system": "Sistema",
|
|
984
|
+
"adminPanel.activity.settingsMore": "{names} e mais {count, number}",
|
|
985
|
+
"adminPanel.activity.purgedDetail": "{count, plural, one {# evento} other {# eventos}}, com mais de {days, plural, one {# dia} other {# dias}}",
|
|
986
|
+
"adminPanel.activity.purgedCount": "{count, plural, one {# evento} other {# eventos}}",
|
|
987
|
+
"adminPanel.activity.event.settings": "Configurações alteradas",
|
|
988
|
+
"adminPanel.activity.via.token": "Com um token de API de administrador",
|
|
989
|
+
"adminPanel.activity.event.logRead": "Registro lido com um token de API",
|
|
990
|
+
"adminPanel.activity.read.contentExport": "Atividade do Content Manager exportada",
|
|
991
|
+
"adminPanel.activity.read.content": "Atividade do Content Manager consultada",
|
|
992
|
+
"adminPanel.activity.read.signInsExport": "Histórico de acessos exportado",
|
|
993
|
+
"adminPanel.activity.read.signIns": "Histórico de acessos consultado",
|
|
994
|
+
"adminPanel.activity.event.purged": "Eventos antigos excluídos",
|
|
995
|
+
"adminPanel.activity.event.userFailed": "Falha no acesso de usuário do app",
|
|
996
|
+
"adminPanel.activity.event.userRefused": "Acesso de usuário do app recusado",
|
|
997
|
+
"adminPanel.activity.event.userLockout": "Usuário do app bloqueado",
|
|
998
|
+
"adminPanel.activity.event.userUnlock": "Bloqueio removido",
|
|
999
|
+
"adminPanel.activity.event.userLimit": "Limite de sessões atingido",
|
|
1000
|
+
"adminPanel.activity.event.userPassword": "Sessão encerrada após troca de senha",
|
|
1001
|
+
"adminPanel.activity.event.userNewDevice": "Acesso de um novo dispositivo",
|
|
1002
|
+
"adminPanel.activity.event.userTravel": "Viagem impossível",
|
|
1003
|
+
"adminPanel.activity.event.userNotMe": "Informado como “Não fui eu”",
|
|
1004
|
+
"adminPanel.activity.event.userExport": "Dados pessoais exportados",
|
|
1005
|
+
"adminPanel.activity.event.impersonation": "Acesso como outro usuário",
|
|
1006
|
+
"adminPanel.activity.event.webhook": "Envio de webhook",
|
|
1007
|
+
"adminPanel.activity.settingsGroup": "{tab}: {fields}"
|
|
946
1008
|
};
|
|
947
1009
|
exports.default = pt;
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from "@strapi/design-system";
|
|
3
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
4
|
+
import { G as isSessionFilter, H as DEFAULT_SESSION_FILTER, I as isEndReasonFilter, J as DEFAULT_END_REASON_FILTER, d as getDevicePresentation, p as presentText } from "./index-h-ksmM8A.mjs";
|
|
5
|
+
const RowActions = ({ children, ...props }) => /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "center", gap: 1, "data-row-actions": "", ...props, children });
|
|
6
|
+
function useElementWidth() {
|
|
7
|
+
const [width, setWidth] = useState(0);
|
|
8
|
+
const observerRef = useRef(null);
|
|
9
|
+
const ref = useCallback((node) => {
|
|
10
|
+
observerRef.current?.disconnect();
|
|
11
|
+
observerRef.current = null;
|
|
12
|
+
if (!node || typeof ResizeObserver === "undefined") return;
|
|
13
|
+
const observer = new ResizeObserver((entries) => {
|
|
14
|
+
const next = Math.round(entries[0]?.contentRect?.width || 0);
|
|
15
|
+
setWidth((previous) => previous === next ? previous : next);
|
|
16
|
+
});
|
|
17
|
+
observer.observe(node);
|
|
18
|
+
observerRef.current = observer;
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => () => observerRef.current?.disconnect(), []);
|
|
21
|
+
return [ref, width];
|
|
22
|
+
}
|
|
23
|
+
const RISK_SOURCES = Object.freeze(["anonymous-ip", "asn-heuristic"]);
|
|
24
|
+
const RISK_SETTINGS_PATH = "/settings/magic-sessionmanager/general?tab=location-data";
|
|
25
|
+
const isRiskSource = (value) => RISK_SOURCES.includes(
|
|
26
|
+
/** @type {string} */
|
|
27
|
+
value
|
|
28
|
+
);
|
|
29
|
+
function getRiskAvailability(geoIpStatus) {
|
|
30
|
+
const risk = geoIpStatus?.risk;
|
|
31
|
+
if (!risk || typeof risk !== "object" || typeof risk.available !== "boolean") {
|
|
32
|
+
return { state: "unknown", source: null };
|
|
33
|
+
}
|
|
34
|
+
if (risk.available && isRiskSource(risk.source)) {
|
|
35
|
+
return { state: "available", source: risk.source };
|
|
36
|
+
}
|
|
37
|
+
return { state: "missing", source: null };
|
|
38
|
+
}
|
|
39
|
+
function riskDependentControl(saved, state) {
|
|
40
|
+
if (state !== "missing")
|
|
41
|
+
return { checked: Boolean(saved), disabled: false, savedOnButInactive: false };
|
|
42
|
+
return { checked: false, disabled: true, savedOnButInactive: Boolean(saved) };
|
|
43
|
+
}
|
|
44
|
+
const PAGE_SIZE_OPTIONS = Object.freeze(["10", "25", "50", "100"]);
|
|
45
|
+
const DEFAULT_PAGE_SIZE = "25";
|
|
46
|
+
const DASHBOARD_TABLE_COLUMNS = 7;
|
|
47
|
+
const DASHBOARD_COMPACT_TABLE_COLUMNS = 5;
|
|
48
|
+
const AUTO_REFRESH_INTERVAL_MS = 10 * 60 * 1e3;
|
|
49
|
+
const HOW_IT_WORKS_STORAGE_KEY = "magic-sessionmanager.dashboard.howSessionsWork";
|
|
50
|
+
const USER_EDIT_PATH = "/content-manager/collection-types/plugin::users-permissions.user/";
|
|
51
|
+
const readQueryText = (value) => {
|
|
52
|
+
if (typeof value !== "string") return "";
|
|
53
|
+
try {
|
|
54
|
+
return decodeURIComponent(value).trim();
|
|
55
|
+
} catch {
|
|
56
|
+
return value.trim();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function parseDashboardQuery(query = {}) {
|
|
60
|
+
const source = query || {};
|
|
61
|
+
const page = Number.parseInt(String(source.page ?? "1"), 10);
|
|
62
|
+
const pageSize = PAGE_SIZE_OPTIONS.includes(String(source.pageSize)) ? String(source.pageSize) : DEFAULT_PAGE_SIZE;
|
|
63
|
+
const status = isSessionFilter(source.status) ? (
|
|
64
|
+
/** @type {string} */
|
|
65
|
+
source.status
|
|
66
|
+
) : DEFAULT_SESSION_FILTER;
|
|
67
|
+
const reason = status === "ended" && isEndReasonFilter(source.reason) ? (
|
|
68
|
+
/** @type {string} */
|
|
69
|
+
source.reason
|
|
70
|
+
) : DEFAULT_END_REASON_FILTER;
|
|
71
|
+
const search = readQueryText(source.search) || readQueryText(source._q);
|
|
72
|
+
return { page: Number.isFinite(page) && page >= 1 ? page : 1, pageSize, status, reason, search };
|
|
73
|
+
}
|
|
74
|
+
function encodeSearchQuery(value) {
|
|
75
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
76
|
+
return text ? encodeURIComponent(text) : void 0;
|
|
77
|
+
}
|
|
78
|
+
function hasActiveFilters(state) {
|
|
79
|
+
if (!state) return false;
|
|
80
|
+
return state.status !== DEFAULT_SESSION_FILTER || Boolean(state.reason) && state.reason !== DEFAULT_END_REASON_FILTER || Boolean(state.search);
|
|
81
|
+
}
|
|
82
|
+
function getSessionUserLabels(session) {
|
|
83
|
+
const username = presentText(session?.user?.username);
|
|
84
|
+
const email = presentText(session?.user?.email);
|
|
85
|
+
const primary = username || email;
|
|
86
|
+
return {
|
|
87
|
+
primary,
|
|
88
|
+
secondary: username && email ? email : "",
|
|
89
|
+
accessible: primary || presentText(session?.id)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function getUserEditPath(session) {
|
|
93
|
+
const documentId = presentText(session?.user?.documentId);
|
|
94
|
+
return documentId ? `${USER_EDIT_PATH}${encodeURIComponent(documentId)}` : null;
|
|
95
|
+
}
|
|
96
|
+
function getExportDeviceInfo(session, unavailableValue = "") {
|
|
97
|
+
const device = getDevicePresentation(session);
|
|
98
|
+
return {
|
|
99
|
+
device: device.deviceType || unavailableValue,
|
|
100
|
+
browser: device.browser || unavailableValue,
|
|
101
|
+
browserVersion: device.browserVersion || "",
|
|
102
|
+
os: device.os || unavailableValue
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function readDisclosureOpen(storage) {
|
|
106
|
+
try {
|
|
107
|
+
return storage?.getItem(HOW_IT_WORKS_STORAGE_KEY) === "open";
|
|
108
|
+
} catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function writeDisclosureOpen(storage, open) {
|
|
113
|
+
try {
|
|
114
|
+
storage?.setItem(HOW_IT_WORKS_STORAGE_KEY, open ? "open" : "closed");
|
|
115
|
+
} catch {
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function getBrowserStorage() {
|
|
119
|
+
try {
|
|
120
|
+
return typeof window !== "undefined" ? window.localStorage : null;
|
|
121
|
+
} catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function shouldIsolateActionKey(key, fromInsideGroup) {
|
|
126
|
+
if (!fromInsideGroup) return true;
|
|
127
|
+
return key === "Enter" || key === " " || key === "Spacebar";
|
|
128
|
+
}
|
|
129
|
+
const FULL_TABLE_MIN_WIDTH = 1200;
|
|
130
|
+
function shouldUseCompactTable(listWidth, isBelowLarge) {
|
|
131
|
+
if (isBelowLarge) return true;
|
|
132
|
+
if (!Number.isFinite(listWidth) || listWidth <= 0) return false;
|
|
133
|
+
return listWidth < FULL_TABLE_MIN_WIDTH;
|
|
134
|
+
}
|
|
135
|
+
function shouldRedispatchEscape(key, fromInsideGroup) {
|
|
136
|
+
return !fromInsideGroup && key === "Escape";
|
|
137
|
+
}
|
|
138
|
+
function pickFocusSessionId(previousIds, currentIds, sessionId) {
|
|
139
|
+
const current = Array.isArray(currentIds) ? currentIds.map(String) : [];
|
|
140
|
+
if (current.length === 0) return null;
|
|
141
|
+
const target = String(sessionId);
|
|
142
|
+
if (current.includes(target)) return target;
|
|
143
|
+
const previous = Array.isArray(previousIds) ? previousIds.map(String) : [];
|
|
144
|
+
const index = previous.indexOf(target);
|
|
145
|
+
if (index >= 0) {
|
|
146
|
+
for (let next = index + 1; next < previous.length; next += 1) {
|
|
147
|
+
if (current.includes(previous[next])) return previous[next];
|
|
148
|
+
}
|
|
149
|
+
for (let before = index - 1; before >= 0; before -= 1) {
|
|
150
|
+
if (current.includes(previous[before])) return previous[before];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return current[0];
|
|
154
|
+
}
|
|
155
|
+
function getErrorStatus(error) {
|
|
156
|
+
const err = (
|
|
157
|
+
/** @type {any} */
|
|
158
|
+
error
|
|
159
|
+
);
|
|
160
|
+
const status = err?.status ?? err?.response?.status;
|
|
161
|
+
return typeof status === "number" ? status : null;
|
|
162
|
+
}
|
|
163
|
+
const SETTINGS_TAB_IDS = Object.freeze([
|
|
164
|
+
"sessions",
|
|
165
|
+
"login-protection",
|
|
166
|
+
"location-data",
|
|
167
|
+
"alerts",
|
|
168
|
+
"data-retention",
|
|
169
|
+
"admin-activity"
|
|
170
|
+
]);
|
|
171
|
+
const PERMISSION_GATED_TABS = Object.freeze(["admin-activity"]);
|
|
172
|
+
const DEFAULT_SETTINGS_TAB = "sessions";
|
|
173
|
+
const SETTINGS_TAB_LABELS = Object.freeze({
|
|
174
|
+
sessions: ["settings.config.tab.sessions", "Sessions"],
|
|
175
|
+
"login-protection": ["settings.config.tab.loginProtection", "Login protection"],
|
|
176
|
+
"location-data": ["settings.config.tab.locationData", "Location data"],
|
|
177
|
+
alerts: ["settings.config.tab.alerts", "Alerts"],
|
|
178
|
+
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"],
|
|
179
|
+
"admin-activity": ["settings.config.tab.adminActivity", "Admin activity"]
|
|
180
|
+
});
|
|
181
|
+
const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
182
|
+
sessions: [
|
|
183
|
+
"inactivityTimeout",
|
|
184
|
+
"maxSessionAgeDays",
|
|
185
|
+
"lastSeenRateLimit",
|
|
186
|
+
"cleanupInterval",
|
|
187
|
+
"cleanupUseDbDirect",
|
|
188
|
+
"strictSessionEnforcement",
|
|
189
|
+
"sessionCreationGraceMs",
|
|
190
|
+
"maxSessionsPerUser",
|
|
191
|
+
"sessionLimitPolicy",
|
|
192
|
+
"endOtherSessionsOnPasswordChange",
|
|
193
|
+
"roleRules"
|
|
194
|
+
],
|
|
195
|
+
"login-protection": [
|
|
196
|
+
"maxFailedLogins",
|
|
197
|
+
"maxFailedLoginsPerAccount",
|
|
198
|
+
"lockoutWindowMinutes",
|
|
199
|
+
"lockoutDurationMinutes",
|
|
200
|
+
"lockoutTrustedAddresses",
|
|
201
|
+
"lockoutNotifyUser",
|
|
202
|
+
"recordUserSignInEvents",
|
|
203
|
+
"impossibleTravelEnabled",
|
|
204
|
+
"impossibleTravelSpeedKmh",
|
|
205
|
+
"impossibleTravelMinDistanceKm",
|
|
206
|
+
"impossibleTravelAction",
|
|
207
|
+
"trustedProxies",
|
|
208
|
+
"blockSuspiciousSessions",
|
|
209
|
+
"geoLookupFailureMode",
|
|
210
|
+
"enableGeofencing",
|
|
211
|
+
"allowedCountries",
|
|
212
|
+
"blockedCountries"
|
|
213
|
+
],
|
|
214
|
+
"location-data": [
|
|
215
|
+
"enableGeolocation",
|
|
216
|
+
"enableSecurityScoring",
|
|
217
|
+
"geoIpProvider",
|
|
218
|
+
"geoIpDatabasePath"
|
|
219
|
+
],
|
|
220
|
+
alerts: [
|
|
221
|
+
"enableEmailAlerts",
|
|
222
|
+
"alertOnSuspiciousLogin",
|
|
223
|
+
"alertOnNewLocation",
|
|
224
|
+
"alertOnVpnProxy",
|
|
225
|
+
"emailTemplates",
|
|
226
|
+
"enableWebhooks",
|
|
227
|
+
"discordWebhookUrl",
|
|
228
|
+
"slackWebhookUrl",
|
|
229
|
+
"alertOnNewDevice",
|
|
230
|
+
"alertOnImpossibleTravel",
|
|
231
|
+
"webhookEvents",
|
|
232
|
+
"genericWebhookEnabled",
|
|
233
|
+
"genericWebhookUrl",
|
|
234
|
+
"genericWebhookSecret"
|
|
235
|
+
],
|
|
236
|
+
"data-retention": ["retentionDays", "sessionIpAnonymize"],
|
|
237
|
+
"admin-activity": [
|
|
238
|
+
"adminSignInHistory",
|
|
239
|
+
"adminContentActivity",
|
|
240
|
+
"securityLogStoreIp",
|
|
241
|
+
"securityLogAnonymizeIp",
|
|
242
|
+
"securityLogGeoLookup",
|
|
243
|
+
"securityLogRetentionDays"
|
|
244
|
+
]
|
|
245
|
+
});
|
|
246
|
+
const PRESERVED_SETTINGS_KEYS = Object.freeze([
|
|
247
|
+
"rateLimitWriteMax",
|
|
248
|
+
"rateLimitReadMax",
|
|
249
|
+
"rateLimitWindowSeconds"
|
|
250
|
+
]);
|
|
251
|
+
const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
252
|
+
inactivityTimeout: ["settings.config.sessions.inactivity.label", "Inactivity timeout"],
|
|
253
|
+
maxSessionAgeDays: ["settings.config.sessions.maxAge.label", "Maximum session age"],
|
|
254
|
+
lastSeenRateLimit: [
|
|
255
|
+
"settings.config.sessions.lastSeen.label",
|
|
256
|
+
'Update "Last active" at most every'
|
|
257
|
+
],
|
|
258
|
+
cleanupInterval: ["settings.config.sessions.idleCheck.label", "Run idle check every"],
|
|
259
|
+
cleanupUseDbDirect: ["settings.config.sessions.idleMethod.label", "Idle check method"],
|
|
260
|
+
strictSessionEnforcement: ["settings.config.token.check.label", "Strict token check"],
|
|
261
|
+
sessionCreationGraceMs: ["settings.config.token.grace.label", "Grace period after sign-in"],
|
|
262
|
+
maxFailedLogins: ["settings.config.failed.lockout.label", "Lock an IP address after"],
|
|
263
|
+
maxFailedLoginsPerAccount: ["settings.config.failed.account.label", "Lock an account after"],
|
|
264
|
+
lockoutWindowMinutes: ["settings.config.failed.window.label", "Count failed sign-ins within"],
|
|
265
|
+
lockoutDurationMinutes: ["settings.config.failed.duration.label", "Lock for"],
|
|
266
|
+
lockoutTrustedAddresses: ["settings.config.failed.trusted.label", "Trusted addresses"],
|
|
267
|
+
lockoutNotifyUser: [
|
|
268
|
+
"settings.config.failed.notify.label",
|
|
269
|
+
"Email the user when their account is locked"
|
|
270
|
+
],
|
|
271
|
+
recordUserSignInEvents: [
|
|
272
|
+
"settings.config.failed.record.label",
|
|
273
|
+
"Record failed and refused sign-ins"
|
|
274
|
+
],
|
|
275
|
+
maxSessionsPerUser: ["settings.config.sessionLimit.max.label", "Open sessions per user"],
|
|
276
|
+
sessionLimitPolicy: ["settings.config.sessionLimit.policy.label", "When the limit is reached"],
|
|
277
|
+
endOtherSessionsOnPasswordChange: [
|
|
278
|
+
"settings.config.passwordChange.label",
|
|
279
|
+
"End other sessions after a password change"
|
|
280
|
+
],
|
|
281
|
+
roleRules: ["settings.roleRules.title", "Different rules for some roles"],
|
|
282
|
+
impossibleTravelEnabled: ["settings.config.travel.enable.label", "Detect impossible travel"],
|
|
283
|
+
impossibleTravelSpeedKmh: ["settings.config.travel.speed.label", "Faster than"],
|
|
284
|
+
impossibleTravelMinDistanceKm: ["settings.config.travel.distance.label", "Over at least"],
|
|
285
|
+
impossibleTravelAction: ["settings.config.travel.action.label", "Then"],
|
|
286
|
+
alertOnNewDevice: ["settings.config.email.newDevice.label", "Sign-in from a new device"],
|
|
287
|
+
alertOnImpossibleTravel: ["settings.config.email.travel.label", "Impossible travel"],
|
|
288
|
+
webhookEvents: ["settings.webhookEvents.title", "Events to send"],
|
|
289
|
+
genericWebhookEnabled: ["settings.signedWebhook.enable.label", "Send to the signed webhook"],
|
|
290
|
+
genericWebhookUrl: ["settings.signedWebhook.url.label", "Webhook URL"],
|
|
291
|
+
genericWebhookSecret: ["settings.signedWebhook.secret.label", "Signing secret"],
|
|
292
|
+
sessionIpAnonymize: ["settings.config.privacy.shortIp.label", "Shorten IP addresses of sessions"],
|
|
293
|
+
trustedProxies: ["settings.config.clientIp.trustProxy.label", "Trust proxy headers"],
|
|
294
|
+
blockSuspiciousSessions: [
|
|
295
|
+
"settings.config.suspicious.reject.label",
|
|
296
|
+
"Reject suspicious sign-ins"
|
|
297
|
+
],
|
|
298
|
+
geoLookupFailureMode: [
|
|
299
|
+
"settings.config.suspicious.failureMode.label",
|
|
300
|
+
"If the location cannot be determined"
|
|
301
|
+
],
|
|
302
|
+
enableGeofencing: ["settings.config.countries.enable.label", "Use country rules"],
|
|
303
|
+
allowedCountries: ["settings.config.countries.list.label", "Countries"],
|
|
304
|
+
blockedCountries: ["settings.config.countries.list.label", "Countries"],
|
|
305
|
+
enableGeolocation: ["settings.config.lookup.enable.label", "IP location lookup"],
|
|
306
|
+
enableSecurityScoring: ["settings.config.lookup.scoring.label", "Security scoring"],
|
|
307
|
+
geoIpProvider: ["settings.config.provider.label", "Provider"],
|
|
308
|
+
geoIpDatabasePath: ["settings.config.database.fileName.label", "Database file name"],
|
|
309
|
+
enableEmailAlerts: ["settings.config.email.enable.label", "Send security emails"],
|
|
310
|
+
alertOnSuspiciousLogin: ["settings.config.email.suspicious.label", "Suspicious sign-in"],
|
|
311
|
+
alertOnNewLocation: ["settings.config.email.newCountry.label", "Sign-in from a new country"],
|
|
312
|
+
alertOnVpnProxy: ["settings.config.email.vpnProxy.label", "VPN or proxy"],
|
|
313
|
+
emailTemplates: ["settings.config.email.templates.field", "Email templates"],
|
|
314
|
+
enableWebhooks: ["settings.config.webhooks.enable.label", "Send team notifications"],
|
|
315
|
+
discordWebhookUrl: ["settings.config.webhooks.discord.label", "Discord webhook URL"],
|
|
316
|
+
slackWebhookUrl: ["settings.config.webhooks.slack.label", "Slack webhook URL"],
|
|
317
|
+
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"],
|
|
318
|
+
adminSignInHistory: ["settings.config.adminActivity.signIns.label", "Record admin sign-ins"],
|
|
319
|
+
adminContentActivity: [
|
|
320
|
+
"settings.config.adminActivity.content.label",
|
|
321
|
+
"Record Content Manager activity"
|
|
322
|
+
],
|
|
323
|
+
securityLogStoreIp: ["settings.config.adminActivity.storeIp.label", "Store IP addresses"],
|
|
324
|
+
securityLogAnonymizeIp: [
|
|
325
|
+
"settings.config.adminActivity.anonymize.label",
|
|
326
|
+
"Anonymise the last part of IP addresses"
|
|
327
|
+
],
|
|
328
|
+
securityLogGeoLookup: [
|
|
329
|
+
"settings.config.adminActivity.geoLookup.label",
|
|
330
|
+
"Look up the location of security events"
|
|
331
|
+
],
|
|
332
|
+
securityLogRetentionDays: [
|
|
333
|
+
"settings.config.adminActivity.retention.label",
|
|
334
|
+
"Keep security events for"
|
|
335
|
+
]
|
|
336
|
+
});
|
|
337
|
+
const SELECT_PRESETS = Object.freeze({
|
|
338
|
+
inactivityTimeout: Object.freeze([5, 10, 15, 30, 60, 120]),
|
|
339
|
+
maxSessionAgeDays: Object.freeze([1, 7, 14, 30, 60, 90, 180, 365]),
|
|
340
|
+
lastSeenRateLimit: Object.freeze([10, 30, 60, 120, 300]),
|
|
341
|
+
cleanupInterval: Object.freeze([15, 30, 60, 120]),
|
|
342
|
+
sessionCreationGraceMs: Object.freeze([0, 2e3, 5e3, 1e4, 3e4]),
|
|
343
|
+
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1]),
|
|
344
|
+
securityLogRetentionDays: Object.freeze([7, 30, 90, 180, 365])
|
|
345
|
+
});
|
|
346
|
+
function resolveSettingsTab(value, tabs = SETTINGS_TAB_IDS) {
|
|
347
|
+
const candidate = Array.isArray(value) ? value[0] : value;
|
|
348
|
+
return tabs.includes(candidate) ? candidate : DEFAULT_SETTINGS_TAB;
|
|
349
|
+
}
|
|
350
|
+
function getVisibleSettingsTabs(canViewAdminActivity) {
|
|
351
|
+
return SETTINGS_TAB_IDS.filter(
|
|
352
|
+
(tab) => canViewAdminActivity || !PERMISSION_GATED_TABS.includes(tab)
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
function buildTabSearch(search, tab) {
|
|
356
|
+
const params = new URLSearchParams(typeof search === "string" ? search : "");
|
|
357
|
+
params.set("tab", resolveSettingsTab(tab));
|
|
358
|
+
return `?${params.toString()}`;
|
|
359
|
+
}
|
|
360
|
+
function fieldHasError(errors, field) {
|
|
361
|
+
return Object.keys(errors || {}).some((path) => path === field || path.startsWith(`${field}.`));
|
|
362
|
+
}
|
|
363
|
+
function tabHasFieldErrors(errors, tab) {
|
|
364
|
+
return (SETTINGS_TAB_FIELDS[tab] || []).some((field) => fieldHasError(errors, field));
|
|
365
|
+
}
|
|
366
|
+
function getErrorTab(errors) {
|
|
367
|
+
return SETTINGS_TAB_IDS.find((tab) => tabHasFieldErrors(errors, tab));
|
|
368
|
+
}
|
|
369
|
+
function buildSelectOptions(presets, current) {
|
|
370
|
+
const options = presets.map((value) => ({ value, custom: false }));
|
|
371
|
+
const number = typeof current === "number" ? current : Number.parseInt(String(current ?? ""), 10);
|
|
372
|
+
if (Number.isInteger(number) && !presets.includes(number)) {
|
|
373
|
+
options.push({ value: number, custom: true });
|
|
374
|
+
}
|
|
375
|
+
return options;
|
|
376
|
+
}
|
|
377
|
+
function buildSavePayload(draft, saved) {
|
|
378
|
+
const payload = { ...draft || {} };
|
|
379
|
+
for (const key of PRESERVED_SETTINGS_KEYS) {
|
|
380
|
+
if (saved && Object.prototype.hasOwnProperty.call(saved, key)) payload[key] = saved[key];
|
|
381
|
+
}
|
|
382
|
+
return payload;
|
|
383
|
+
}
|
|
384
|
+
function usesLocalDatabase(provider) {
|
|
385
|
+
return provider === void 0 || provider === null || provider === "" || provider === "auto" || provider === "local-mmdb";
|
|
386
|
+
}
|
|
387
|
+
function getRevealScrollDelta(listRect, tabRect) {
|
|
388
|
+
if (!listRect || !tabRect) return 0;
|
|
389
|
+
if (tabRect.left < listRect.left - 0.5) return Math.round(tabRect.left - listRect.left);
|
|
390
|
+
if (tabRect.right > listRect.right + 0.5) return Math.round(tabRect.right - listRect.right);
|
|
391
|
+
return 0;
|
|
392
|
+
}
|
|
393
|
+
export {
|
|
394
|
+
AUTO_REFRESH_INTERVAL_MS as A,
|
|
395
|
+
getRiskAvailability as B,
|
|
396
|
+
riskDependentControl as C,
|
|
397
|
+
DASHBOARD_COMPACT_TABLE_COLUMNS as D,
|
|
398
|
+
usesLocalDatabase as E,
|
|
399
|
+
getErrorTab as F,
|
|
400
|
+
buildSavePayload as G,
|
|
401
|
+
getVisibleSettingsTabs as H,
|
|
402
|
+
resolveSettingsTab as I,
|
|
403
|
+
getRevealScrollDelta as J,
|
|
404
|
+
PAGE_SIZE_OPTIONS as P,
|
|
405
|
+
RISK_SETTINGS_PATH as R,
|
|
406
|
+
SETTINGS_TAB_IDS as S,
|
|
407
|
+
getUserEditPath as a,
|
|
408
|
+
RowActions as b,
|
|
409
|
+
shouldRedispatchEscape as c,
|
|
410
|
+
DASHBOARD_TABLE_COLUMNS as d,
|
|
411
|
+
getBrowserStorage as e,
|
|
412
|
+
pickFocusSessionId as f,
|
|
413
|
+
getSessionUserLabels as g,
|
|
414
|
+
encodeSearchQuery as h,
|
|
415
|
+
isRiskSource as i,
|
|
416
|
+
shouldUseCompactTable as j,
|
|
417
|
+
DEFAULT_PAGE_SIZE as k,
|
|
418
|
+
getExportDeviceInfo as l,
|
|
419
|
+
getErrorStatus as m,
|
|
420
|
+
hasActiveFilters as n,
|
|
421
|
+
SETTINGS_TAB_FIELDS as o,
|
|
422
|
+
parseDashboardQuery as p,
|
|
423
|
+
SETTINGS_FIELD_LABELS as q,
|
|
424
|
+
readDisclosureOpen as r,
|
|
425
|
+
shouldIsolateActionKey as s,
|
|
426
|
+
SETTINGS_TAB_LABELS as t,
|
|
427
|
+
useElementWidth as u,
|
|
428
|
+
buildTabSearch as v,
|
|
429
|
+
writeDisclosureOpen as w,
|
|
430
|
+
buildSelectOptions as x,
|
|
431
|
+
SELECT_PRESETS as y,
|
|
432
|
+
fieldHasError as z
|
|
433
|
+
};
|