strapi-plugin-magic-sessionmanager 4.14.2 → 4.15.0
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 +64 -0
- package/README.md +151 -79
- package/dist/admin/{Analytics-Box2STtg.js → Analytics-Dbs5QXLb.js} +1 -1
- package/dist/admin/{Analytics-DfDdcjMe.mjs → Analytics-HK6_TEmk.mjs} +1 -1
- package/dist/admin/{App-DzxXcTYs.js → App-7SxOBJP5.js} +63 -29
- package/dist/admin/{App-B2JIOiNM.mjs → App-BOFzZ5d8.mjs} +64 -30
- package/dist/admin/{OnlineUsersWidget-BOd7p_MF.mjs → OnlineUsersWidget-CoCxnww-.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-D4M4D6rm.js → OnlineUsersWidget-Dns_74xJ.js} +1 -1
- package/dist/admin/{Settings-DNgH9qRy.js → Settings-B6CrR-07.js} +257 -64
- package/dist/admin/{Settings-BFdr77zD.mjs → Settings-DYRShQ8W.mjs} +258 -65
- package/dist/admin/{de-BlKn1pSD.mjs → de-B3mPtxsW.mjs} +39 -7
- package/dist/admin/{de-B0CBR1Dw.js → de-bkkCvSxX.js} +39 -7
- package/dist/admin/{en-IT0YTY8f.mjs → en-BnU8BNkN.mjs} +39 -7
- package/dist/admin/{en-D0ZGIIjz.js → en-DMICyIow.js} +39 -7
- package/dist/admin/{es-BCGzaaCh.mjs → es-BxMgfJ1Y.mjs} +39 -7
- package/dist/admin/{es-CWee-XCR.js → es-OSzHGRIu.js} +39 -7
- package/dist/admin/{fr-rQS1M7jE.js → fr-Bu_8miJ4.js} +39 -7
- package/dist/admin/{fr-xBIH4Byq.mjs → fr-WPrbtx8k.mjs} +39 -7
- package/dist/admin/{index-CmW1DJ0c.js → index-CNSJITRX.js} +9 -9
- package/dist/admin/{index-C2SrNW6I.mjs → index-lnZBc5n0.mjs} +9 -9
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-C-yTLhnS.js → pt-B08xnb0K.js} +39 -7
- package/dist/admin/{pt-DWDeIDVa.mjs → pt-C41KyEDN.mjs} +39 -7
- package/dist/admin/riskData-BVs9GpgD.js +26 -0
- package/dist/admin/riskData-CI1gm2yI.mjs +27 -0
- package/dist/server/index.js +565 -178
- package/dist/server/index.mjs +565 -178
- package/package.json +3 -3
- package/scripts/geoip-updater.cjs +58 -15
|
@@ -6,9 +6,10 @@ const designSystem = require("@strapi/design-system");
|
|
|
6
6
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
8
|
const styled = require("styled-components");
|
|
9
|
-
const index = require("./index-
|
|
9
|
+
const index = require("./index-CNSJITRX.js");
|
|
10
10
|
const reactIntl = require("react-intl");
|
|
11
11
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
|
+
const riskData = require("./riskData-BVs9GpgD.js");
|
|
12
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
14
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
14
15
|
const SETTINGS_TAB_IDS = Object.freeze([
|
|
@@ -593,6 +594,16 @@ const RequiresGeolocation = () => {
|
|
|
593
594
|
const { t } = useSettingsTranslate();
|
|
594
595
|
return /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { tab: "location-data", children: t("settings.config.requires.geolocation", "Requires IP location lookup") });
|
|
595
596
|
};
|
|
597
|
+
const RiskSourceNotice = ({ savedOn = false, tab = "location-data" }) => {
|
|
598
|
+
const { t } = useSettingsTranslate();
|
|
599
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-risk-source-notice": "", children: [
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { tab: tab || void 0, children: t("settings.config.requires.riskData", "Needs a risk data source") }),
|
|
601
|
+
savedOn ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t(
|
|
602
|
+
"settings.config.requires.riskData.savedOn",
|
|
603
|
+
"Saved as on. It takes effect once a risk data source is set up."
|
|
604
|
+
) }) : null
|
|
605
|
+
] });
|
|
606
|
+
};
|
|
596
607
|
const AdvancedTrigger = styled__default.default(designSystem.Accordion.Trigger)`
|
|
597
608
|
&&:focus-visible {
|
|
598
609
|
outline: 2px solid ${({ theme }) => theme.colors.primary600};
|
|
@@ -1883,6 +1894,9 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
1883
1894
|
const maxFailedError = tError(errors.maxFailedLogins);
|
|
1884
1895
|
const maxFailedValue = Number(settings.maxFailedLogins);
|
|
1885
1896
|
const lookupOff = !settings.enableGeolocation;
|
|
1897
|
+
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
1898
|
+
const reject = riskData.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
|
|
1899
|
+
const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
|
|
1886
1900
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
1887
1901
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
1888
1902
|
"settings.config.loginProtection.intro",
|
|
@@ -1982,6 +1996,23 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
1982
1996
|
subtitle: t("settings.config.suspicious.intro", "Refuses new sign-ins that look risky."),
|
|
1983
1997
|
children: [
|
|
1984
1998
|
lookupOff ? /* @__PURE__ */ jsxRuntime.jsx(RequiresGeolocation, {}) : null,
|
|
1999
|
+
!lookupOff && risk.state === "missing" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2000
|
+
index.PersistentAlert,
|
|
2001
|
+
{
|
|
2002
|
+
variant: "default",
|
|
2003
|
+
closeLabel: t("common.close", "Close"),
|
|
2004
|
+
title: t("settings.config.risk.missing.title", "No risk data source"),
|
|
2005
|
+
"data-risk-missing": "",
|
|
2006
|
+
children: [
|
|
2007
|
+
t(
|
|
2008
|
+
"settings.config.risk.missing.body",
|
|
2009
|
+
"VPN, proxy and Tor detection needs a risk data source. Until one is set up, no sign-in is refused as suspicious."
|
|
2010
|
+
),
|
|
2011
|
+
" ",
|
|
2012
|
+
/* @__PURE__ */ jsxRuntime.jsx(SettingsTabLink, { tab: "location-data", children: t("settings.config.risk.missing.link", "Set up risk data") })
|
|
2013
|
+
]
|
|
2014
|
+
}
|
|
2015
|
+
) : null,
|
|
1985
2016
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1986
2017
|
SettingsToggleRow,
|
|
1987
2018
|
{
|
|
@@ -1989,45 +2020,48 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
1989
2020
|
title: t("settings.config.suspicious.reject.label", "Reject suspicious sign-ins"),
|
|
1990
2021
|
description: t(
|
|
1991
2022
|
"settings.config.suspicious.reject.hint",
|
|
1992
|
-
"Refuses sign-ins from VPN, proxy or
|
|
2023
|
+
"Refuses sign-ins from VPN, proxy or Tor addresses and, with security scoring on, scores below 50. Hosting networks only trigger alerts."
|
|
1993
2024
|
),
|
|
1994
|
-
checked:
|
|
1995
|
-
disabled: lookupOff,
|
|
2025
|
+
checked: reject.checked,
|
|
2026
|
+
disabled: lookupOff || reject.disabled,
|
|
1996
2027
|
onChange: (checked) => handleChange("blockSuspiciousSessions", checked),
|
|
1997
|
-
children:
|
|
1998
|
-
"settings.config.suspicious.reject.localNote",
|
|
1999
|
-
"The local database has no VPN, proxy or threat data and always scores 100, so only failed lookups can be refused."
|
|
2000
|
-
) }) : null
|
|
2028
|
+
children: !lookupOff && reject.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: reject.savedOnButInactive }) : null
|
|
2001
2029
|
}
|
|
2002
2030
|
),
|
|
2003
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: fieldHasError(errors, "geoLookupFailureMode"), children: [
|
|
2032
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2033
|
+
FormField,
|
|
2034
|
+
{
|
|
2035
|
+
id: "geoip-lookup-failure-mode",
|
|
2036
|
+
name: "geoLookupFailureMode",
|
|
2037
|
+
label: t(
|
|
2038
|
+
"settings.config.suspicious.failureMode.label",
|
|
2039
|
+
"If the location cannot be determined"
|
|
2040
|
+
),
|
|
2041
|
+
description: t(
|
|
2042
|
+
"settings.config.suspicious.failureMode.hint",
|
|
2043
|
+
"Automatic rejects only when 'Reject suspicious sign-ins' is on. A rejected sign-in gets 'Login temporarily unavailable'. With 'Reject sign-in', the Automatic provider no longer falls back to ipapi.co."
|
|
2044
|
+
),
|
|
2045
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2046
|
+
designSystem.SingleSelect,
|
|
2047
|
+
{
|
|
2048
|
+
value: settings.geoLookupFailureMode || "auto",
|
|
2049
|
+
disabled: lookupOff,
|
|
2050
|
+
onChange: (value) => handleChange("geoLookupFailureMode", value),
|
|
2051
|
+
children: [
|
|
2052
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "auto", children: t("settings.config.suspicious.failureMode.auto", "Automatic") }),
|
|
2053
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "allow", children: t("settings.config.suspicious.failureMode.allow", "Allow sign-in") }),
|
|
2054
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "block", children: t("settings.config.suspicious.failureMode.block", "Reject sign-in") })
|
|
2055
|
+
]
|
|
2056
|
+
}
|
|
2057
|
+
)
|
|
2058
|
+
}
|
|
2059
|
+
) }),
|
|
2060
|
+
autoStillRejects ? /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-auto-still-rejects": "", children: t(
|
|
2061
|
+
"settings.config.suspicious.failureMode.savedOnNote",
|
|
2062
|
+
"Automatic still rejects sign-ins whose location cannot be determined, because 'Reject suspicious sign-ins' is saved as on. Choose 'Allow sign-in' to change that."
|
|
2063
|
+
) }) : null
|
|
2064
|
+
] })
|
|
2031
2065
|
]
|
|
2032
2066
|
}
|
|
2033
2067
|
),
|
|
@@ -2092,7 +2126,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
2092
2126
|
] })
|
|
2093
2127
|
] });
|
|
2094
2128
|
};
|
|
2095
|
-
const BUILD_DATE_OPTIONS$
|
|
2129
|
+
const BUILD_DATE_OPTIONS$2 = Object.freeze({ dateStyle: "medium" });
|
|
2096
2130
|
const PathValue = ({ path }) => {
|
|
2097
2131
|
const parts = String(path).split("/");
|
|
2098
2132
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: parts.map((part, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
@@ -2203,7 +2237,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
2203
2237
|
geoIpStatus.metadata?.lastModified,
|
|
2204
2238
|
locale,
|
|
2205
2239
|
"",
|
|
2206
|
-
BUILD_DATE_OPTIONS$
|
|
2240
|
+
BUILD_DATE_OPTIONS$2
|
|
2207
2241
|
)
|
|
2208
2242
|
},
|
|
2209
2243
|
{
|
|
@@ -2366,9 +2400,149 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
2366
2400
|
}
|
|
2367
2401
|
);
|
|
2368
2402
|
};
|
|
2403
|
+
const BUILD_DATE_OPTIONS$1 = Object.freeze({ dateStyle: "medium" });
|
|
2404
|
+
const databaseState = (entry) => {
|
|
2405
|
+
if (entry?.usable) return "ready";
|
|
2406
|
+
if (entry?.exists) return "unusable";
|
|
2407
|
+
return "missing";
|
|
2408
|
+
};
|
|
2409
|
+
const BADGE_COLOURS = Object.freeze({
|
|
2410
|
+
ready: { backgroundColor: "success100", textColor: "success700" },
|
|
2411
|
+
unusable: { backgroundColor: "warning200", textColor: "neutral800" },
|
|
2412
|
+
missing: { backgroundColor: "neutral150", textColor: "neutral700" }
|
|
2413
|
+
});
|
|
2414
|
+
const RiskDatabase = ({ id, title, shortName, description, entry, form, lookupOff }) => {
|
|
2415
|
+
const { t, locale } = useSettingsTranslate();
|
|
2416
|
+
const buttonRef = react.useRef(null);
|
|
2417
|
+
const { geoIp } = form;
|
|
2418
|
+
const state = databaseState(entry);
|
|
2419
|
+
const stateLabels = {
|
|
2420
|
+
ready: t("settings.config.risk.database.ready", "Ready"),
|
|
2421
|
+
unusable: t("settings.config.risk.database.unusable", "Cannot be read"),
|
|
2422
|
+
missing: t("settings.config.risk.database.missing", "Not downloaded")
|
|
2423
|
+
};
|
|
2424
|
+
const built = index.formatSessionDate(entry?.metadata?.lastModified, locale, "", BUILD_DATE_OPTIONS$1);
|
|
2425
|
+
const pending = geoIp.riskUpdating === id;
|
|
2426
|
+
const disabled = lookupOff || Boolean(geoIp.riskUpdating) || geoIp.updating || !geoIp.status?.hasCredentials || entry?.fromEnvironment === true;
|
|
2427
|
+
const download = async () => {
|
|
2428
|
+
await geoIp.updateDatabase(false, id);
|
|
2429
|
+
window.requestAnimationFrame(
|
|
2430
|
+
() => window.requestAnimationFrame(() => index.refocusIfLost(buttonRef.current, buttonRef.current))
|
|
2431
|
+
);
|
|
2432
|
+
};
|
|
2433
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2434
|
+
designSystem.Box,
|
|
2435
|
+
{
|
|
2436
|
+
padding: 4,
|
|
2437
|
+
hasRadius: true,
|
|
2438
|
+
borderColor: "neutral200",
|
|
2439
|
+
background: "neutral0",
|
|
2440
|
+
height: "100%",
|
|
2441
|
+
"data-risk-database": id,
|
|
2442
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, height: "100%", children: [
|
|
2443
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 2, wrap: "wrap", children: [
|
|
2444
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "neutral800", tag: "h3", children: title }),
|
|
2445
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...BADGE_COLOURS[state], children: stateLabels[state] })
|
|
2446
|
+
] }),
|
|
2447
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral600", tag: "p", children: description }),
|
|
2448
|
+
state === "unusable" ? /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral800", tag: "p", children: t(
|
|
2449
|
+
"settings.config.risk.database.unusableHint",
|
|
2450
|
+
"The file exists but is not this MaxMind database. Download it again."
|
|
2451
|
+
) }) : null,
|
|
2452
|
+
built ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t("settings.config.risk.database.built", "Built {date}", { date: built }) }) : null,
|
|
2453
|
+
entry?.fromEnvironment ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t(
|
|
2454
|
+
"settings.config.risk.database.fromEnvironment",
|
|
2455
|
+
"Read from the path in an environment variable. Update that file outside Strapi."
|
|
2456
|
+
) }) : null,
|
|
2457
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2458
|
+
designSystem.Button,
|
|
2459
|
+
{
|
|
2460
|
+
ref: buttonRef,
|
|
2461
|
+
variant: "secondary",
|
|
2462
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
|
2463
|
+
loading: pending,
|
|
2464
|
+
disabled,
|
|
2465
|
+
onClick: download,
|
|
2466
|
+
children: state === "missing" ? t("settings.config.risk.database.download", "Download {name}", { name: shortName }) : t("settings.config.risk.database.update", "Update {name}", { name: shortName })
|
|
2467
|
+
}
|
|
2468
|
+
) })
|
|
2469
|
+
] })
|
|
2470
|
+
}
|
|
2471
|
+
);
|
|
2472
|
+
};
|
|
2473
|
+
const RiskDataCard = ({ form }) => {
|
|
2474
|
+
const { t } = useSettingsTranslate();
|
|
2475
|
+
const { settings, geoIp } = form;
|
|
2476
|
+
const lookupOff = !settings.enableGeolocation;
|
|
2477
|
+
const risk = riskData.getRiskAvailability(geoIp.status);
|
|
2478
|
+
const sourceLabels = {
|
|
2479
|
+
"anonymous-ip": t("settings.config.risk.source.anonymousIp", "Anonymous IP database"),
|
|
2480
|
+
"asn-heuristic": t("settings.config.risk.source.asn", "ASN heuristic")
|
|
2481
|
+
};
|
|
2482
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2483
|
+
SectionCard.SectionCard,
|
|
2484
|
+
{
|
|
2485
|
+
id: "risk-data",
|
|
2486
|
+
title: t("settings.config.risk.title", "Risk data (VPN, proxy, Tor)"),
|
|
2487
|
+
subtitle: t(
|
|
2488
|
+
"settings.config.risk.intro",
|
|
2489
|
+
"Location data cannot tell VPNs, proxies or Tor apart. A local MaxMind database can; lookups stay on this server."
|
|
2490
|
+
),
|
|
2491
|
+
action: risk.state === "unknown" ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2492
|
+
designSystem.Badge,
|
|
2493
|
+
{
|
|
2494
|
+
backgroundColor: risk.state === "available" ? "success100" : "neutral150",
|
|
2495
|
+
textColor: risk.state === "available" ? "success700" : "neutral700",
|
|
2496
|
+
children: risk.state === "available" ? sourceLabels[risk.source] : t("settings.config.risk.source.none", "Not set up")
|
|
2497
|
+
}
|
|
2498
|
+
),
|
|
2499
|
+
children: [
|
|
2500
|
+
lookupOff ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.geolocation", "Requires IP location lookup") }) : null,
|
|
2501
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 4, children: [
|
|
2502
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2503
|
+
RiskDatabase,
|
|
2504
|
+
{
|
|
2505
|
+
id: "anonymous-ip",
|
|
2506
|
+
title: t("settings.config.risk.anonymousIp.title", "GeoIP2 Anonymous IP"),
|
|
2507
|
+
shortName: t("settings.config.risk.anonymousIp.short", "Anonymous IP"),
|
|
2508
|
+
description: t(
|
|
2509
|
+
"settings.config.risk.anonymousIp.hint",
|
|
2510
|
+
"Paid MaxMind database. Detects VPNs, public and residential proxies, Tor exit nodes and hosting providers. The download fails if your MaxMind account does not include it."
|
|
2511
|
+
),
|
|
2512
|
+
entry: geoIp.status?.risk?.anonymousIp,
|
|
2513
|
+
form,
|
|
2514
|
+
lookupOff
|
|
2515
|
+
}
|
|
2516
|
+
),
|
|
2517
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2518
|
+
RiskDatabase,
|
|
2519
|
+
{
|
|
2520
|
+
id: "asn",
|
|
2521
|
+
title: t("settings.config.risk.asn.title", "GeoLite2 ASN (heuristic)"),
|
|
2522
|
+
shortName: t("settings.config.risk.asn.short", "ASN"),
|
|
2523
|
+
description: t(
|
|
2524
|
+
"settings.config.risk.asn.hint",
|
|
2525
|
+
"Free MaxMind database. Flags sign-ins from large hosting and cloud networks such as AWS, Azure or Hetzner for alerts. A heuristic: it does not detect VPNs, proxies or Tor and never refuses a sign-in. Used only without the Anonymous IP database."
|
|
2526
|
+
),
|
|
2527
|
+
entry: geoIp.status?.risk?.asn,
|
|
2528
|
+
form,
|
|
2529
|
+
lookupOff
|
|
2530
|
+
}
|
|
2531
|
+
)
|
|
2532
|
+
] }),
|
|
2533
|
+
geoIp.status && !geoIp.status.hasCredentials ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t(
|
|
2534
|
+
"settings.config.risk.credentials",
|
|
2535
|
+
"Downloads use the MaxMind credentials under Provider and database. Add them first."
|
|
2536
|
+
) }) : null
|
|
2537
|
+
]
|
|
2538
|
+
}
|
|
2539
|
+
);
|
|
2540
|
+
};
|
|
2369
2541
|
const LocationDataTab = ({ form }) => {
|
|
2370
2542
|
const { t } = useSettingsTranslate();
|
|
2371
2543
|
const { settings, handleChange } = form;
|
|
2544
|
+
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
2545
|
+
const scoring = riskData.riskDependentControl(settings.enableSecurityScoring, risk.state);
|
|
2372
2546
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
2373
2547
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
2374
2548
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
@@ -2405,16 +2579,17 @@ const LocationDataTab = ({ form }) => {
|
|
|
2405
2579
|
title: t("settings.config.lookup.scoring.label", "Security scoring"),
|
|
2406
2580
|
description: t(
|
|
2407
2581
|
"settings.config.lookup.scoring.hint",
|
|
2408
|
-
"Applies the score thresholds: below 70 triggers a suspicious-sign-in email, below 50 a rejection if enabled.
|
|
2582
|
+
"Applies the score thresholds: below 70 triggers a suspicious-sign-in email, below 50 a rejection if enabled."
|
|
2409
2583
|
),
|
|
2410
|
-
checked:
|
|
2411
|
-
disabled: !settings.enableGeolocation,
|
|
2584
|
+
checked: scoring.checked,
|
|
2585
|
+
disabled: !settings.enableGeolocation || scoring.disabled,
|
|
2412
2586
|
onChange: (checked) => handleChange("enableSecurityScoring", checked),
|
|
2413
|
-
children: !settings.enableGeolocation ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.geolocation", "Requires IP location lookup") }) : null
|
|
2587
|
+
children: !settings.enableGeolocation ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.geolocation", "Requires IP location lookup") }) : scoring.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: scoring.savedOnButInactive, tab: null }) : null
|
|
2414
2588
|
}
|
|
2415
2589
|
)
|
|
2416
2590
|
] }),
|
|
2417
|
-
/* @__PURE__ */ jsxRuntime.jsx(GeoIpDatabaseCard, { form })
|
|
2591
|
+
/* @__PURE__ */ jsxRuntime.jsx(GeoIpDatabaseCard, { form }),
|
|
2592
|
+
/* @__PURE__ */ jsxRuntime.jsx(RiskDataCard, { form })
|
|
2418
2593
|
] });
|
|
2419
2594
|
};
|
|
2420
2595
|
const CodeTextarea = styled__default.default(designSystem.Textarea)`
|
|
@@ -2803,14 +2978,16 @@ const AlertsTab = ({ form }) => {
|
|
|
2803
2978
|
const emailTypesDisabled = lookupOff || !settings.enableEmailAlerts;
|
|
2804
2979
|
const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
|
|
2805
2980
|
const templateErrors = fieldHasError(errors, "emailTemplates");
|
|
2981
|
+
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
2806
2982
|
const emailTypes = [
|
|
2807
2983
|
{
|
|
2808
2984
|
field: "alertOnSuspiciousLogin",
|
|
2985
|
+
needsRiskData: true,
|
|
2809
2986
|
hintId: hintIds.suspicious,
|
|
2810
2987
|
label: t("settings.config.email.suspicious.label", "Suspicious sign-in"),
|
|
2811
2988
|
hint: t(
|
|
2812
2989
|
"settings.config.email.suspicious.hint",
|
|
2813
|
-
"VPN, proxy or
|
|
2990
|
+
"VPN, proxy, Tor or hosting address, or a score below 70 with scoring on."
|
|
2814
2991
|
)
|
|
2815
2992
|
},
|
|
2816
2993
|
{
|
|
@@ -2824,11 +3001,12 @@ const AlertsTab = ({ form }) => {
|
|
|
2824
3001
|
},
|
|
2825
3002
|
{
|
|
2826
3003
|
field: "alertOnVpnProxy",
|
|
3004
|
+
needsRiskData: true,
|
|
2827
3005
|
hintId: hintIds.vpnProxy,
|
|
2828
3006
|
label: t("settings.config.email.vpnProxy.label", "VPN or proxy"),
|
|
2829
3007
|
hint: t(
|
|
2830
3008
|
"settings.config.email.vpnProxy.hint",
|
|
2831
|
-
"
|
|
3009
|
+
"Sign-in from a VPN, or from a public or residential proxy."
|
|
2832
3010
|
)
|
|
2833
3011
|
}
|
|
2834
3012
|
];
|
|
@@ -2867,19 +3045,24 @@ const AlertsTab = ({ form }) => {
|
|
|
2867
3045
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
2868
3046
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", tag: "div", textColor: "neutral800", children: t("settings.config.email.types.label", "Send an email for") }),
|
|
2869
3047
|
!lookupOff && !settings.enableEmailAlerts ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.emailAlerts", "Requires Send security emails") }) : null,
|
|
2870
|
-
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, hintId, label, hint }) =>
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
3048
|
+
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, needsRiskData, hintId, label, hint }) => {
|
|
3049
|
+
const control = needsRiskData ? riskData.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
|
|
3050
|
+
const disabled = emailTypesDisabled || control.disabled;
|
|
3051
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AlertTypeCell, { checked: control.checked, disabled, children: [
|
|
3052
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3053
|
+
designSystem.Checkbox,
|
|
3054
|
+
{
|
|
3055
|
+
checked: control.checked,
|
|
3056
|
+
disabled,
|
|
3057
|
+
"aria-describedby": hintId,
|
|
3058
|
+
onCheckedChange: (checked) => handleChange(field, checked === true),
|
|
3059
|
+
children: label
|
|
3060
|
+
}
|
|
3061
|
+
),
|
|
3062
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { id: hintId, variant: "pi", textColor: "neutral600", tag: "p", children: hint }),
|
|
3063
|
+
!lookupOff && control.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: control.savedOnButInactive }) : null
|
|
3064
|
+
] }, field);
|
|
3065
|
+
}) }) })
|
|
2883
3066
|
] }),
|
|
2884
3067
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2885
3068
|
AdvancedSection,
|
|
@@ -2924,6 +3107,11 @@ const AlertsTab = ({ form }) => {
|
|
|
2924
3107
|
}
|
|
2925
3108
|
),
|
|
2926
3109
|
!lookupOff && !settings.enableWebhooks ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.webhooks", "Requires Send team notifications") }) : null,
|
|
3110
|
+
!lookupOff && risk.state === "missing" ? /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral600", tag: "p", "data-risk-webhook-note": "", children: t(
|
|
3111
|
+
"settings.config.webhooks.noRiskData",
|
|
3112
|
+
"Without a risk data source, {suspicious} is never sent.",
|
|
3113
|
+
WEBHOOK_EVENTS
|
|
3114
|
+
) }) : null,
|
|
2927
3115
|
/* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: [
|
|
2928
3116
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2929
3117
|
FormField,
|
|
@@ -3100,6 +3288,7 @@ function useSettingsForm() {
|
|
|
3100
3288
|
const [geoIpStatusError, setGeoIpStatusError] = react.useState(false);
|
|
3101
3289
|
const [geoIpCredentials, setGeoIpCredentials] = react.useState({ accountId: "", licenseKey: "" });
|
|
3102
3290
|
const [geoIpUpdating, setGeoIpUpdating] = react.useState(false);
|
|
3291
|
+
const [riskUpdating, setRiskUpdating] = react.useState(null);
|
|
3103
3292
|
const [geoIpSavingCredentials, setGeoIpSavingCredentials] = react.useState(false);
|
|
3104
3293
|
const [settings, setSettings] = react.useState(INITIAL_SETTINGS);
|
|
3105
3294
|
const [savedSettings, setSavedSettings] = react.useState(settings);
|
|
@@ -3318,17 +3507,20 @@ function useSettingsForm() {
|
|
|
3318
3507
|
}
|
|
3319
3508
|
}, [put, t, toggleNotification, fetchGeoIpStatus]);
|
|
3320
3509
|
const handleUpdateGeoIpDatabase = react.useCallback(
|
|
3321
|
-
async (force = false) => {
|
|
3322
|
-
setGeoIpUpdating
|
|
3510
|
+
async (force = false, database = "location") => {
|
|
3511
|
+
const setPending = database === "location" ? setGeoIpUpdating : setRiskUpdating;
|
|
3512
|
+
setPending(database === "location" ? true : database);
|
|
3323
3513
|
try {
|
|
3324
|
-
const
|
|
3514
|
+
const body = database === "location" ? { force } : { force, database };
|
|
3515
|
+
const response = await post(`/${index.pluginId}/geoip/update`, body);
|
|
3325
3516
|
index.requireSuccessfulMutation(response.data);
|
|
3326
3517
|
const status = await fetchGeoIpStatus();
|
|
3327
3518
|
const result = response.data.result || {};
|
|
3519
|
+
const riskEntry = database === "anonymous-ip" ? status?.risk?.anonymousIp : database === "asn" ? status?.risk?.asn : null;
|
|
3328
3520
|
const values = {
|
|
3329
|
-
edition: status?.editionId || "—",
|
|
3521
|
+
edition: (riskEntry || status)?.editionId || "—",
|
|
3330
3522
|
date: index.formatSessionDate(
|
|
3331
|
-
result.lastModified || status?.metadata?.lastModified,
|
|
3523
|
+
result.lastModified || (riskEntry || status)?.metadata?.lastModified,
|
|
3332
3524
|
locale,
|
|
3333
3525
|
"—",
|
|
3334
3526
|
BUILD_DATE_OPTIONS
|
|
@@ -3356,7 +3548,7 @@ function useSettingsForm() {
|
|
|
3356
3548
|
)
|
|
3357
3549
|
});
|
|
3358
3550
|
} finally {
|
|
3359
|
-
|
|
3551
|
+
setPending(database === "location" ? false : null);
|
|
3360
3552
|
}
|
|
3361
3553
|
},
|
|
3362
3554
|
[post, t, locale, toggleNotification, fetchGeoIpStatus]
|
|
@@ -3388,6 +3580,7 @@ function useSettingsForm() {
|
|
|
3388
3580
|
credentials: geoIpCredentials,
|
|
3389
3581
|
setCredentials: setGeoIpCredentials,
|
|
3390
3582
|
updating: geoIpUpdating,
|
|
3583
|
+
riskUpdating,
|
|
3391
3584
|
savingCredentials: geoIpSavingCredentials,
|
|
3392
3585
|
fetchStatus: fetchGeoIpStatus,
|
|
3393
3586
|
saveCredentials: handleSaveGeoIpCredentials,
|