Plugin Directory

Changeset 3841085


Ignore:
Timestamp:
12/02/2026 08:47:39 PM (17 hours ago)
Author:
secureprolabs
Message:

Release 2.4.6: Security Health, VAPT Assessment, Smart Notifications and redesigned interface

Location:
secureprolabs-guard
Files:
14 added
42 edited
1 copied

Legend:

Unmodified
Added
Removed
  • secureprolabs-guard/tags/2.4.6/admin/css/admin.css

    r3839918 r3841085  
    10971097    }
    10981098}
     1099
     1100
     1101/* Smart Notifications */
     1102.splg-profile-table { max-width: 760px; margin: 4px 0 16px; }
     1103.splg-profile-table th, .splg-profile-table td { padding: 8px 12px; }
     1104.splg-profile-table .splg-profile-active { background: #e6f6fb; font-weight: 600; }
     1105.splg-notify-custom { border: 1px solid #dcdcde; border-radius: 4px; padding: 4px 16px 0; margin: 0 0 16px; max-width: 760px; }
     1106.splg-notify-custom[disabled] { opacity: .55; }
     1107.splg-notify-custom legend { padding: 0 6px; font-weight: 600; }
     1108.splg-notify-diagnostics { margin-top: 24px; padding-top: 8px; border-top: 1px solid #dcdcde; }
     1109.splg-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0 16px; padding: 0; list-style: none; }
     1110.splg-stat { margin: 0; padding: 12px 14px; background: #fff; border: 1px solid #dcdcde; border-radius: 6px; }
     1111.splg-stat-alert { border-color: #d63638; }
     1112.splg-stat-value { display: block; font-size: 22px; line-height: 1.3; font-weight: 600; }
     1113.splg-stat-label { display: block; color: #50575e; }
     1114.splg-stat-week { color: #787c82; }
     1115.splg-notify-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
     1116.splg-notify-meta dt { font-weight: 600; }
     1117.splg-notify-meta dd { margin: 0; }
     1118.splg-mail-error { color: #b32d2e; }
     1119.splg-sev { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #f0f0f1; }
     1120.splg-sev-4 { background: #fcf0f1; color: #8a2424; }
     1121.splg-sev-3 { background: #fcf2e8; color: #8a4b0f; }
     1122.splg-sev-2 { background: #fcf9e8; color: #6b5300; }
     1123.splg-test-notification { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
     1124.log-occurrences { margin-left: 10px; color: #50575e; }
     1125@media (max-width: 782px) {
     1126    .splg-notify-meta { grid-template-columns: 1fr; }
     1127    .splg-profile-table { font-size: 13px; }
     1128}
     1129
     1130/* Inside the SecureProLabs application shell the old white tab panel is not used. */
     1131.spl-app .tab-content { background: transparent; border: 0; padding: 0; min-height: 0; }
     1132body.splg-has-unsaved-changes .spl-nav a:not([aria-current="page"]) { opacity: .6; }
     1133body.splg-has-unsaved-changes .spl-nav a:not([aria-current="page"])::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--spl-warning); margin-left: 6px; }
     1134
     1135/* Security Health: dark theme scoped to this dashboard only */
     1136.splg-health {
     1137    /* Local names kept for existing rules; every value comes from the SecureProLabs tokens. */
     1138    --splg-bg: var(--spl-bg); --splg-card: var(--spl-surface); --splg-line: var(--spl-border); --splg-text: var(--spl-text); --splg-muted: var(--spl-text-2);
     1139    --splg-cyan: var(--spl-cyan); --splg-amber: var(--spl-warning); --splg-red: var(--spl-critical); --splg-green: var(--spl-success); --splg-tone: var(--spl-neutral);
     1140    background: transparent; color: var(--spl-text);
     1141}
     1142.splg-health[data-tone="good"] { --splg-tone: var(--splg-cyan); }
     1143.splg-health[data-tone="warn"] { --splg-tone: var(--splg-amber); }
     1144.splg-health[data-tone="bad"] { --splg-tone: var(--splg-red); }
     1145.splg-health a { color: var(--splg-cyan); }
     1146.splg-health a:focus { outline: 2px solid var(--splg-cyan); outline-offset: 2px; box-shadow: none; }
     1147.splg-health h2, .splg-health h3 { color: var(--splg-text); }
     1148.splg-health-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
     1149.splg-health-title { font-size: 24px; margin: 0 0 4px; }
     1150.splg-health-sub, .splg-health-when { margin: 2px 0; color: var(--splg-muted); }
     1151.splg-muted { color: var(--splg-muted); }
     1152.splg-btn-primary { background: var(--splg-cyan); color: var(--spl-on-cyan); border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; font-size: 14px; }
     1153.splg-btn-primary:hover { filter: brightness(1.08); }
     1154.splg-btn-primary:focus-visible { outline: 2px solid var(--spl-cyan); outline-offset: 2px; }
     1155.splg-btn-primary[disabled] { opacity: .7; cursor: progress; }
     1156.splg-card { background: var(--splg-card); border: 1px solid var(--splg-line); border-radius: 10px; padding: 20px; }
     1157.splg-health-top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
     1158.splg-health-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
     1159.splg-dial-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
     1160.splg-dial { width: 100%; max-width: 280px; height: auto; }
     1161.splg-dial-ticks line { stroke: var(--spl-border); stroke-width: 1.5; }
     1162.splg-dial-track { fill: none; stroke: var(--spl-elevated); stroke-width: 14; }
     1163.splg-dial-arc { fill: none; stroke: var(--splg-tone); stroke-width: 14; stroke-linecap: round; stroke-dasharray: var(--splg-score) 100; animation: splg-dial-in .9s ease-out both; }
     1164@keyframes splg-dial-in { from { stroke-dasharray: 0 100; } }
     1165.splg-dial-num { fill: var(--splg-text); font-size: 64px; font-weight: 700; }
     1166.splg-dial-of { fill: var(--splg-muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
     1167.splg-dial-class { fill: var(--splg-tone); font-size: 17px; font-weight: 600; }
     1168.splg-dial-empty { font-size: 19px; }
     1169.splg-dial-notes { width: 100%; }
     1170.splg-dial-calc { margin: 8px 0; color: var(--splg-muted); }
     1171.splg-restriction { text-align: left; border: 1px solid var(--splg-line); border-left: 3px solid var(--splg-tone); border-radius: 0; padding: 10px 14px; margin: 10px 0; background: var(--spl-bg); }
     1172.splg-restriction p, .splg-restriction ul { margin: 4px 0; }
     1173.splg-restriction ul { padding-left: 0; list-style: none; }
     1174.splg-disclaimer { font-size: 12px; color: var(--splg-muted); margin: 10px 0 0; }
     1175.splg-state-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
     1176.splg-state { display: grid; grid-template-columns: 28px auto 1fr; align-items: center; column-gap: 10px; margin: 0; }
     1177.splg-state .dashicons { font-size: 22px; width: 22px; height: 22px; }
     1178.splg-state-num { font-size: 30px; font-weight: 700; line-height: 1; }
     1179.splg-state-label { font-weight: 600; }
     1180.splg-state-help { grid-column: 2 / 4; color: var(--splg-muted); font-size: 12px; }
     1181.splg-state-verified .dashicons, .splg-state-verified .splg-state-num { color: var(--splg-green); }
     1182.splg-state-misconfigured .dashicons, .splg-state-misconfigured .splg-state-num { color: var(--splg-amber); }
     1183.splg-state-unverified .dashicons, .splg-state-unverified .splg-state-num { color: var(--spl-neutral); }
     1184.splg-state-untested .dashicons, .splg-state-untested .splg-state-num { color: var(--splg-muted); }
     1185.splg-coverage { border-top: 1px solid var(--splg-line); margin-top: 18px; padding-top: 14px; }
     1186.splg-coverage-head { display: flex; justify-content: space-between; margin: 0 0 8px; }
     1187.splg-coverage-head strong { color: var(--splg-cyan); font-size: 18px; }
     1188.splg-bar { height: 8px; background: var(--spl-elevated); border-radius: 4px; overflow: hidden; }
     1189.splg-bar-fill { display: block; height: 100%; background: var(--splg-muted); border-radius: 4px; transition: width .4s ease-out; }
     1190.splg-bar-cyan { background: var(--splg-cyan); }
     1191.splg-bar-amber { background: var(--splg-amber); }
     1192.splg-health-progress { margin: 0 0 16px; }
     1193.splg-health-progress p { margin: 6px 0 0; color: var(--splg-muted); }
     1194.splg-breakdown { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
     1195.splg-breakdown li { margin: 0; }
     1196.splg-breakdown-head { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
     1197.splg-breakdown-head span:last-child { color: var(--splg-muted); }
     1198.splg-actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
     1199.splg-actions li { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin: 0; align-items: start; }
     1200.splg-actions p { margin: 0 0 4px; }
     1201.splg-action-title { font-weight: 600; }
     1202.splg-action-links a { margin-right: 14px; }
     1203.splg-sev-pill { display: inline-block; min-width: 64px; text-align: center; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
     1204.splg-sev-pill.splg-sev-critical { color: var(--splg-red); }
     1205.splg-sev-pill.splg-sev-high { color: var(--spl-high); }
     1206.splg-sev-pill.splg-sev-medium { color: var(--splg-amber); }
     1207.splg-sev-pill.splg-sev-low { color: var(--spl-sev-low); }
     1208.splg-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; background: var(--spl-elevated); color: var(--spl-text-2); margin-left: 6px; }
     1209.splg-tag-warn { background: var(--spl-elevated); color: var(--spl-warning); }
     1210.splg-checks, .splg-method { margin-top: 16px; }
     1211.splg-checks summary, .splg-method summary { cursor: pointer; }
     1212.splg-checks summary h3 { display: inline; font-size: 15px; }
     1213.splg-method ul { margin: 10px 0 0 18px; list-style: disc; color: var(--splg-muted); }
     1214.splg-check-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
     1215.splg-check-table th, .splg-check-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--splg-line); vertical-align: top; }
     1216.splg-check-table th { color: var(--splg-muted); font-weight: 600; }
     1217.splg-check-table tr:target { background: var(--spl-elevated); }
     1218@media (max-width: 960px) {
     1219    .splg-health-top, .splg-health-bottom { grid-template-columns: minmax(0, 1fr); }
     1220}
     1221@media (max-width: 600px) {
     1222    .splg-health { padding: 14px; border-radius: 0; margin-left: -10px; margin-right: -10px; }
     1223    .splg-dial { max-width: 220px; }
     1224    .splg-state-list { grid-template-columns: 1fr 1fr; }
     1225    .splg-state-help { display: none; }
     1226    .splg-check-table thead { display: none; }
     1227    .splg-check-table td { display: block; border: 0; padding: 4px 0; }
     1228    .splg-check-table tr { display: block; border-bottom: 1px solid var(--splg-line); padding: 8px 0; }
     1229}
     1230@media (prefers-reduced-motion: reduce) {
     1231    .splg-dial-arc { animation: none; }
     1232    .splg-bar-fill { transition: none; }
     1233}
     1234.splg-breakdown-hint { margin: -6px 0 12px; font-size: 12px; }
     1235.splg-cat { display: block; width: 100%; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; margin: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; box-sizing: border-box; }
     1236.splg-cat:hover { background: var(--spl-elevated); }
     1237.splg-cat:focus-visible { outline: 2px solid var(--splg-cyan); outline-offset: 1px; }
     1238.splg-cat[aria-pressed="true"] { background: var(--spl-elevated); border-color: var(--splg-cyan); }
     1239.splg-cat .splg-breakdown-head { display: flex; }
     1240.splg-cat .splg-bar { display: block; }
     1241.splg-cat-name { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
     1242.splg-cat-score { color: var(--splg-muted); white-space: nowrap; }
     1243.splg-count { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; border: 1px solid currentColor; }
     1244.splg-count-fix { color: var(--splg-amber); }
     1245.splg-count-verify { color: var(--spl-text-2); border-color: var(--spl-control); }
     1246.splg-actions-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
     1247.splg-link-btn { background: none; border: 0; padding: 0; color: var(--splg-cyan); cursor: pointer; text-decoration: underline; font: inherit; }
     1248.splg-action-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--splg-muted); }
     1249.splg-actions li.splg-dim { opacity: .35; }
     1250.splg-snippet { background: var(--spl-bg); border: 1px solid var(--splg-line); border-radius: 6px; padding: 8px 10px; margin: 6px 0; overflow-x: auto; font-size: 12px; color: var(--spl-text); }
     1251/* Author display rules must never override the hidden attribute inside the dashboard. */
     1252.splg-health [hidden] { display: none !important; }
     1253.splg-actions li { border-radius: 8px; padding: 6px; margin: -6px; transition: background-color .3s ease-out, box-shadow .3s ease-out; }
     1254.splg-actions li.splg-flash { animation: splg-flash 1.6s ease-out 1; }
     1255.splg-actions li.splg-flash-fix { --splg-flash: rgba(251, 191, 36, .55); }
     1256.splg-actions li.splg-flash-verify { --splg-flash: rgba(34, 211, 238, .55); }
     1257@keyframes splg-flash {
     1258    0% { background-color: transparent; box-shadow: 0 0 0 0 var(--splg-flash); }
     1259    20% { background-color: var(--spl-elevated); box-shadow: 0 0 0 2px var(--splg-flash); }
     1260    100% { background-color: transparent; box-shadow: 0 0 0 0 transparent; }
     1261}
     1262@media (prefers-reduced-motion: reduce) {
     1263    .splg-actions li { transition: none; }
     1264    .splg-actions li.splg-flash { animation: none; background-color: var(--spl-elevated); box-shadow: 0 0 0 2px var(--splg-flash); }
     1265}
     1266
     1267/* VAPT Assessment */
     1268.splg-vapt-buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
     1269.splg-btn-secondary { display: inline-block; background: transparent; color: var(--splg-cyan) !important; border: 1px solid var(--splg-cyan); border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 14px; text-decoration: none; }
     1270.splg-btn-secondary:hover { background: rgba(34, 211, 238, .1); }
     1271.splg-btn-secondary:focus-visible { outline: 2px solid var(--spl-cyan); outline-offset: 2px; }
     1272.splg-sev-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; }
     1273.splg-sev-card { padding: 0; margin: 0; border-top: 3px solid var(--splg-muted); }
     1274.splg-sev-card a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; text-decoration: none; color: var(--splg-text); }
     1275.splg-health .splg-sev-card a { color: var(--splg-text); }
     1276.splg-sev-card-label { font-weight: 600; }
     1277.splg-sev-card-num { font-size: 30px; font-weight: 700; line-height: 1.2; }
     1278.splg-sev-card.splg-sev-critical { border-top-color: var(--splg-red); }
     1279.splg-sev-card.splg-sev-high { border-top-color: var(--spl-high); }
     1280.splg-sev-card.splg-sev-medium { border-top-color: var(--splg-amber); }
     1281.splg-sev-card.splg-sev-low { border-top-color: var(--spl-sev-low); }
     1282.splg-sev-pill.splg-sev-info { color: var(--splg-muted); }
     1283.splg-vapt-progress h3, .splg-findings h3 { margin-top: 0; font-size: 15px; }
     1284.splg-vapt-progress .splg-coverage-head { margin-top: 10px; }
     1285.splg-vapt-lines { margin: 14px 0 0; padding: 0; list-style: none; color: var(--splg-muted); }
     1286.splg-vapt-lines li { margin: 4px 0; }
     1287.splg-findings, .splg-ext-form { margin-top: 16px; }
     1288.splg-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 4px 0 14px; }
     1289.splg-filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--splg-muted); }
     1290.splg-health select, .splg-health input[type="text"], .splg-health input[type="date"], .splg-health textarea {
     1291    background: var(--spl-bg); color: var(--splg-text); border: 1px solid var(--spl-control); border-radius: 6px; max-width: 100%;
     1292}
     1293.splg-health input[type="date"] { color-scheme: dark; }
     1294.splg-health select:focus, .splg-health input:focus, .splg-health textarea:focus { border-color: var(--splg-cyan); box-shadow: 0 0 0 1px var(--splg-cyan); outline: none; }
     1295.splg-finding { border-top: 1px solid var(--splg-line); }
     1296.splg-finding > summary { display: grid; grid-template-columns: 84px 92px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px; cursor: pointer; list-style: none; }
     1297.splg-finding > summary::-webkit-details-marker { display: none; }
     1298.splg-finding > summary:focus-visible { outline: 2px solid var(--splg-cyan); outline-offset: 2px; }
     1299.splg-finding[open] > summary { background: var(--spl-elevated); }
     1300.splg-finding-id { font-weight: 600; font-size: 13px; line-height: 1.3; }
     1301.splg-finding-id .splg-muted { font-weight: 400; font-size: 12px; }
     1302.splg-finding-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
     1303.splg-finding-title { font-weight: 600; }
     1304.splg-finding-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
     1305.splg-finding-status .splg-tag { margin-left: 0; }
     1306.splg-status { color: var(--splg-muted); }
     1307.splg-status + .splg-status::before { content: "·"; margin-right: 6px; }
     1308.splg-ver-failed, .splg-rem-open { color: var(--spl-critical); }
     1309.splg-ver-local, .splg-ver-independent { color: var(--splg-green); }
     1310.splg-ver-pending, .splg-rem-accepted { color: var(--splg-amber); }
     1311.splg-finding-open { color: var(--splg-cyan); font-size: 13px; white-space: nowrap; }
     1312.splg-finding[open] .splg-finding-open { visibility: hidden; }
     1313.splg-finding-body { padding: 4px 4px 16px 108px; }
     1314.splg-finding-body dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; margin: 8px 0; }
     1315.splg-finding-body dt { color: var(--splg-muted); }
     1316.splg-finding-body dd { margin: 0; }
     1317.splg-finding-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-start; }
     1318.splg-inline-form { display: inline; margin: 0; }
     1319.splg-health .splg-danger { color: var(--splg-red); }
     1320.splg-accept { flex-basis: 100%; }
     1321.splg-accept > summary { cursor: pointer; color: var(--splg-cyan); }
     1322.splg-form label { display: block; font-weight: 600; margin: 10px 0 4px; }
     1323.splg-form textarea, .splg-form input[type="text"] { width: 100%; }
     1324.splg-accept .splg-form { max-width: 560px; }
     1325.splg-ext-form > summary { cursor: pointer; }
     1326.splg-ext-form > summary h3 { display: inline; font-size: 15px; }
     1327.splg-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; max-width: 900px; }
     1328.splg-form-grid p { margin: 0; }
     1329.splg-form-grid select { width: 100%; }
     1330.splg-span-2 { grid-column: 1 / -1; }
     1331.splg-span-2 .splg-btn-primary { margin: 16px 12px 0 0; }
     1332.splg-help { display: block; font-size: 12px; margin-top: 4px; }
     1333.splg-finding.splg-flash > summary { animation: splg-flash 1.6s ease-out 1; --splg-flash: var(--splg-amber); }
     1334@media screen and (max-width: 960px) {
     1335    .splg-sev-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
     1336    .splg-finding-body { padding-left: 4px; }
     1337}
     1338@media screen and (max-width: 600px) {
     1339    .splg-sev-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
     1340    .splg-finding > summary { grid-template-columns: 70px minmax(0, 1fr); }
     1341    .splg-finding > summary .splg-finding-main { grid-column: 1 / -1; }
     1342    .splg-finding-open { display: none; }
     1343    .splg-finding-body dl, .splg-form-grid { grid-template-columns: minmax(0, 1fr); }
     1344}
     1345@media (prefers-reduced-motion: reduce) {
     1346    .splg-finding.splg-flash > summary { animation: none; }
     1347}
     1348
     1349/* Stage 1 visual refinement: Security Health signature dial and breakdown */
     1350.splg-dial { max-width: 300px; }
     1351.splg-dial-ring { fill: none; stroke: var(--spl-border); stroke-width: 1; }
     1352.splg-dial-inner { stroke-opacity: .8; }
     1353.splg-dial-ticks line { stroke-linecap: round; }
     1354.splg-dial-ticks .splg-tick-minor { stroke: var(--spl-border); stroke-width: 1; }
     1355.splg-dial-ticks .splg-tick-major { stroke: var(--spl-control); stroke-width: 1.5; }
     1356.splg-dial-ticks .splg-tick-cardinal { stroke: var(--spl-text-2); stroke-width: 2; }
     1357.splg-dial-track { stroke: var(--spl-elevated); stroke-width: 10; }
     1358.splg-dial-arc { stroke-width: 10; animation-duration: var(--spl-dur-slow); animation-timing-function: var(--spl-ease); }
     1359.splg-dial-num { fill: var(--spl-text); font-family: var(--spl-font); font-size: 58px; font-weight: 600; letter-spacing: -.03em; }
     1360.splg-dial-of { fill: var(--spl-text-3); font-family: var(--spl-font); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; }
     1361.splg-dial-class { fill: var(--splg-tone); font-family: var(--spl-font); font-size: 13px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
     1362.splg-dial-empty { font-size: 15px; letter-spacing: .12em; }
     1363.splg-health[data-tone="neutral"] .splg-dial-class { fill: var(--spl-text-2); }
     1364.splg-ceiling-note { text-align: left; margin: 10px 0; padding: 10px 14px; border: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1365.splg-restriction { border-left-width: 1px; border-radius: var(--spl-radius-md); background: var(--spl-bg); }
     1366.splg-restriction > p:first-child strong { color: var(--splg-tone); }
     1367.splg-card { border-radius: var(--spl-radius-lg); }
     1368.splg-state-icon { flex: none; }
     1369.splg-state { grid-template-columns: 24px auto 1fr; }
     1370.splg-state-verified .splg-state-icon { color: var(--spl-success); }
     1371.splg-state-misconfigured .splg-state-icon { color: var(--spl-warning); }
     1372.splg-state-unverified .splg-state-icon, .splg-state-untested .splg-state-icon { color: var(--spl-neutral); }
     1373.splg-state-unverified .splg-state-num, .splg-state-untested .splg-state-num { color: var(--spl-text); }
     1374.splg-bar-green { background: var(--spl-success); }
     1375.splg-breakdown { gap: 8px; }
     1376.splg-cat { background: var(--spl-elevated); padding: 12px 14px; }
     1377.splg-cat:hover { background: #1d2c42; }
     1378.splg-cat .splg-bar { height: 6px; margin-bottom: 8px; }
     1379.splg-metric { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 5px; font-size: var(--spl-fs-sm); }
     1380.splg-metric-label { color: var(--spl-text-2); }
     1381.splg-metric-value { color: var(--spl-text); white-space: nowrap; }
     1382.splg-metric-note { display: block; color: var(--spl-warning); font-size: var(--spl-fs-xs); margin-top: 2px; }
     1383.splg-actions li { grid-template-columns: 84px minmax(0, 1fr); }
     1384.splg-actions .splg-sev-pill { margin-top: 2px; }
     1385.splg-health-title { font-size: var(--spl-fs-2xl); font-weight: var(--spl-fw-semibold); letter-spacing: -.01em; }
     1386.splg-checks summary h3, .splg-findings h3, .splg-vapt-progress h3 { font-size: var(--spl-fs-lg); font-weight: var(--spl-fw-semibold); }
     1387
     1388/* VAPT: severity cards with a coloured marker instead of a coloured top border */
     1389.splg-sev-card { border-top: 1px solid var(--spl-border); }
     1390.splg-sev-card-label { display: inline-flex; align-items: center; gap: 8px; font-weight: var(--spl-fw-regular); color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1391.splg-sev-card-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--spl-neutral); }
     1392.splg-sev-card.splg-sev-critical .splg-sev-card-label::before { background: var(--spl-sev-critical); }
     1393.splg-sev-card.splg-sev-high .splg-sev-card-label::before { background: var(--spl-sev-high); }
     1394.splg-sev-card.splg-sev-medium .splg-sev-card-label::before { background: var(--spl-sev-medium); }
     1395.splg-sev-card.splg-sev-low .splg-sev-card-label::before { background: var(--spl-sev-low); }
     1396.splg-sev-card.splg-sev-info .splg-sev-card-label::before { background: var(--spl-sev-info); }
     1397.splg-sev-card a:hover { text-decoration: none; background: var(--spl-elevated); border-radius: var(--spl-radius-lg); }
     1398.splg-sev-card-num { font-weight: var(--spl-fw-semibold); }
     1399.splg-source { display: inline-flex; align-items: center; gap: 5px; font-size: var(--spl-fs-xs); color: var(--spl-text-2); font-weight: var(--spl-fw-regular); }
     1400.splg-source-external { color: #C4B5FD; }
     1401.splg-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: var(--spl-radius-pill); background: var(--spl-elevated); }
     1402.splg-status + .splg-status::before { content: none; }
     1403.splg-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
     1404.splg-rem-mitigated, .splg-rem-na, .splg-ver-not_tested { color: var(--spl-text-2); }
     1405.splg-ver-external_required { color: var(--spl-info); }
     1406.splg-finding > summary { grid-template-columns: 96px 92px minmax(0, 1fr) auto; }
     1407.splg-finding > summary .splg-sev-pill { justify-self: start; }
     1408.splg-vapt-note { font-size: var(--spl-fs-xs); color: var(--spl-text-3); margin: 10px 0 0; }
     1409
     1410@media screen and (max-width: 600px) {
     1411    .splg-actions li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
     1412    .splg-sev-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
     1413    .splg-finding > summary { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
     1414    .splg-finding > summary .splg-finding-id { grid-column: 1; }
     1415    .splg-finding > summary .splg-sev-pill { grid-column: 2; justify-self: end; }
     1416    .splg-finding > summary .splg-finding-main { grid-column: 1 / -1; }
     1417    .splg-health-head { flex-direction: column; }
     1418    .splg-health-run, .splg-vapt-buttons { width: 100%; }
     1419    .splg-vapt-buttons > * { flex: 1 1 auto; }
     1420    .splg-filters label { flex: 1 1 140px; }
     1421    .splg-filters select { width: 100%; }
     1422}
     1423@media screen and (max-width: 600px) {
     1424    .splg-state-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
     1425    .splg-state { grid-template-columns: 20px auto; background: var(--spl-elevated); border-radius: var(--spl-radius-md); padding: 10px; row-gap: 2px; }
     1426    .splg-state-help { grid-column: 1 / -1; }
     1427    .splg-state-num { font-size: 24px; }
     1428    .splg-state-label { grid-column: 1 / -1; order: -1; font-size: var(--spl-fs-sm); }
     1429}
     1430
     1431/* ===== Stages 2 and 3: older tabs on the SecureProLabs design system (scoped to the shell) ===== */
     1432.spl-app .tab-content > div > h2:first-child, .spl-app .splg-settings > h2:first-child { margin: 0 0 20px; font-size: var(--spl-fs-2xl); font-weight: var(--spl-fw-semibold); letter-spacing: -.01em; }
     1433.spl-app .tab-content h3 { font-size: var(--spl-fs-lg); font-weight: var(--spl-fw-semibold); margin: 0 0 8px; }
     1434.spl-app .description, .spl-app .tab-content p.description { color: var(--spl-text-2); font-style: normal; }
     1435
     1436/* Module status: one compact strip */
     1437.spl-app .splg-module-status { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); padding: 14px 18px; margin: 0 0 24px; box-shadow: none; }
     1438.spl-app .splg-module-status h2 { font-size: var(--spl-fs-sm); font-weight: var(--spl-fw-semibold); color: var(--spl-text); margin: 0 0 2px; padding: 0; }
     1439.spl-app .splg-module-status .description { font-size: var(--spl-fs-xs); color: var(--spl-text-3); margin: 0 0 10px; }
     1440.spl-app .splg-module-status-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
     1441.spl-app .splg-module-status-list li { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 3px 10px; border-radius: var(--spl-radius-pill); border: 0; background: var(--spl-elevated); color: var(--spl-text-2); font-size: var(--spl-fs-xs); }
     1442.spl-app .splg-module-status-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
     1443.spl-app .splg-module-status-list li strong { color: var(--spl-text); font-weight: var(--spl-fw-semibold); }
     1444.spl-app .splg-module-status-loaded { color: var(--spl-success) !important; }
     1445.spl-app .splg-module-status-off { color: var(--spl-neutral) !important; }
     1446.spl-app .splg-module-status-attention { color: var(--spl-warning) !important; }
     1447
     1448/* Stat tiles */
     1449.spl-app .quick-stats { gap: 12px; margin: 0 0 24px; }
     1450.spl-app .stat-card { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); padding: 18px 20px; text-align: left; box-shadow: none; }
     1451.spl-app .stat-number { color: var(--spl-text); font-size: 28px; font-weight: var(--spl-fw-semibold); line-height: 1.2; }
     1452.spl-app .stat-label { color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1453
     1454/* Event lists */
     1455.spl-app .log-entry { background: var(--spl-surface); border: 1px solid var(--spl-border); border-left: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); padding: 12px 14px 12px 30px; margin: 0 0 8px; position: relative; color: var(--spl-text); }
     1456.spl-app .log-entry::before { content: ""; position: absolute; left: 13px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--spl-neutral); }
     1457.spl-app .log-entry.blocked::before { background: var(--spl-critical); }
     1458.spl-app .log-entry.failed::before, .spl-app .log-entry.rate_limited::before { background: var(--spl-high); }
     1459.spl-app .log-entry.success::before { background: var(--spl-success); }
     1460.spl-app .log-entry.info::before, .spl-app .log-entry.request::before { background: var(--spl-info); }
     1461.spl-app .log-details strong, .spl-app .log-type, .spl-app .log-type strong { color: var(--spl-text); }
     1462.spl-app .log-meta, .spl-app .log-time { color: var(--spl-text-3); font-size: var(--spl-fs-xs); }
     1463.spl-app .log-description { color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1464.spl-app .ip-address { background: var(--spl-elevated); color: var(--spl-text); border-radius: 4px; padding: 1px 6px; font-family: var(--spl-font-mono); font-size: var(--spl-fs-xs); }
     1465.spl-app .log-occurrences { color: var(--spl-text-3); }
     1466.spl-app .secureprolabs-guard-log-table th { background: transparent; }
     1467.spl-app .lockout-status { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: var(--spl-radius-pill); background: var(--spl-elevated); font-size: var(--spl-fs-xs); }
     1468.spl-app .lockout-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
     1469.spl-app .lockout-status.active { background: var(--spl-elevated); color: var(--spl-critical); }
     1470.spl-app .lockout-status.expired { background: var(--spl-elevated); color: var(--spl-success); }
     1471.spl-app .lockout-status.permanent { background: var(--spl-elevated); color: var(--spl-high); }
     1472.spl-app .tablenav { color: var(--spl-text-2); }
     1473.spl-app .tablenav .tablenav-pages a, .spl-app .tablenav-pages span.tablenav-pages-navspan { background: var(--spl-surface); border-color: var(--spl-control); color: var(--spl-text); }
     1474.spl-app .widefat td, .spl-app .widefat th { padding: 12px 14px; vertical-align: middle; }
     1475.spl-app .widefat tbody tr:hover { background: var(--spl-elevated); }
     1476.spl-app .splg-quick-actions { margin-top: 24px; }
     1477.spl-app .action-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
     1478.spl-app .button .dashicons { line-height: inherit; font-size: 16px; width: 16px; height: 16px; margin-top: -2px; vertical-align: middle; }
     1479
     1480/* Statistics charts */
     1481.spl-app .chart-container { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); box-shadow: none; }
     1482.spl-app .chart-container h3 { color: var(--spl-text); }
     1483.spl-app .chart-label { color: var(--spl-text-2); }
     1484.spl-app .chart-bar { background: var(--spl-elevated); border-radius: var(--spl-radius-pill); }
     1485.spl-app .chart-fill { background: var(--spl-cyan); border-radius: var(--spl-radius-pill); }
     1486.spl-app .chart-value { color: var(--spl-text); font-variant-numeric: tabular-nums; }
     1487.spl-app .daily-bar { background: var(--spl-cyan); border-radius: 4px 4px 0 0; }
     1488.spl-app .daily-count { color: var(--spl-on-cyan); }
     1489.spl-app .daily-date { color: var(--spl-text-3); }
     1490.spl-app .widefat td.num, .spl-app .widefat th.num { text-align: right; font-variant-numeric: tabular-nums; }
     1491
     1492/* Settings: sub-sections as a segmented control, rows as control cards */
     1493.spl-app .settings-tabs-wrapper { display: block; }
     1494.spl-app .settings-nav-tabs { display: inline-flex; flex-wrap: wrap; flex-direction: row; gap: 4px; padding: 4px; margin: 0 0 20px; width: auto; background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: 10px; }
     1495.spl-app .settings-nav-tab { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 8px 14px; min-height: 40px; width: auto; border: 0; border-radius: var(--spl-radius-md); background: transparent; color: var(--spl-text-2); text-decoration: none; box-shadow: none; }
     1496.spl-app .settings-nav-tab:hover { background: var(--spl-elevated); color: var(--spl-text); text-decoration: none; }
     1497.spl-app .settings-nav-tab.active { background: var(--spl-elevated); color: var(--spl-text); border: 0; }
     1498.spl-app .settings-nav-tab .tab-label { font-size: var(--spl-fs-sm); font-weight: var(--spl-fw-semibold); color: inherit; margin: 0; }
     1499.spl-app .settings-nav-tab .tab-desc { display: none; }
     1500.spl-app .settings-nav-tab .dashicons { font-size: 16px; width: 16px; height: 16px; color: var(--spl-cyan); margin: 0; }
     1501.spl-app .settings-content { background: transparent; border: 0; padding: 0; box-shadow: none; }
     1502.spl-app .settings-section { background: transparent; border: 0; padding: 0; }
     1503.spl-app .settings-section .description { color: var(--spl-text-2); }
     1504
     1505/* Sticky save bar with a clear saved and unsaved state */
     1506.spl-app .splg-top-save-area { position: sticky; top: 32px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 20px; padding: 12px 16px; background: var(--spl-surface); border: 1px solid var(--spl-border); border-left-width: 1px; border-radius: var(--spl-radius-lg); box-shadow: 0 8px 24px rgba(8, 15, 28, .6); }
     1507.spl-app .splg-save-wrapper { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
     1508.spl-app .splg-save-description { color: var(--spl-text-3); font-style: normal; font-size: var(--spl-fs-sm); }
     1509.spl-app .splg-save-state { order: -1; display: inline-flex; align-items: center; gap: 8px; font-size: var(--spl-fs-sm); color: var(--spl-text-2); }
     1510.spl-app .splg-save-state:empty { display: none; }
     1511.spl-app .splg-save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
     1512.spl-app .splg-save-state[data-state="unsaved"] { color: var(--spl-warning); }
     1513.spl-app .splg-save-state[data-state="saved"] { color: var(--spl-success); }
     1514.spl-app .splg-cancel-button { background: transparent !important; border-color: var(--spl-control) !important; color: var(--spl-text) !important; box-shadow: none; }
     1515.spl-app .splg-cancel-button:hover { background: var(--spl-elevated) !important; border-color: var(--spl-text-2) !important; color: var(--spl-text) !important; }
     1516.spl-app .splg-save-wrapper .button-primary { box-shadow: none; }
     1517
     1518/* Horizontal sub-tabs inside Security Features */
     1519.spl-app .splg-horizontal-tabs { display: flex; flex-wrap: wrap; gap: 2px; background: transparent; border: 0; border-bottom: 1px solid var(--spl-border); border-radius: 0; margin: 0 0 20px; padding: 0; }
     1520.spl-app .splg-tab-button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--spl-text-2); padding: 12px 12px 10px; min-height: 44px; font: inherit; cursor: pointer; }
     1521.spl-app .splg-tab-button:hover { background: transparent; color: var(--spl-text); }
     1522.spl-app .splg-tab-button.active { background: transparent; color: var(--spl-text); font-weight: var(--spl-fw-semibold); border-bottom-color: var(--spl-cyan); }
     1523.spl-app .splg-tab-pane > h3 { margin-top: 0; }
     1524
     1525/* Form rows as control cards */
     1526.spl-app .settings-content .form-table, .spl-app .settings-content .form-table > tbody { display: block; width: 100%; margin: 12px 0 20px; }
     1527.spl-app .settings-content .form-table tr { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 8px 24px; margin: 0 0 10px; padding: 16px 18px; background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: 10px; }
     1528.spl-app .settings-content .form-table th, .spl-app .settings-content .form-table td { display: block; width: auto; padding: 0; margin: 0; }
     1529.spl-app .settings-content .form-table th { font-weight: var(--spl-fw-semibold); color: var(--spl-text); line-height: 1.4; }
     1530.spl-app .settings-content .form-table th .spl-status { margin-top: 8px; }
     1531.spl-app .settings-content .form-table td label { display: inline-flex; align-items: center; color: var(--spl-text); }
     1532.spl-app .settings-content .form-table td > label + label { margin-top: 10px; }
     1533.spl-app .settings-content .form-table td .description { margin: 6px 0 0; }
     1534.spl-app .form-table tr:has(.splg-field-modified), .spl-app .form-table tr.splg-row-modified { background-color: var(--spl-surface); border-color: var(--spl-warning); }
     1535.spl-app .form-table tr:has(.splg-field-modified) th label, .spl-app .form-table tr.splg-row-modified th label,
     1536.spl-app .form-table tr:has(.splg-field-modified) th label::after, .spl-app .form-table tr.splg-row-modified th label::after { color: var(--spl-warning); }
     1537.spl-app .form-table tr:has(.splg-field-modified) .description, .spl-app .form-table tr.splg-row-modified .description { color: var(--spl-text-2); }
     1538.spl-app .form-table input.splg-field-modified:not([type="checkbox"]):not([type="radio"]), .spl-app .form-table select.splg-field-modified { background-color: var(--spl-bg); border-color: var(--spl-warning) !important; box-shadow: 0 0 0 1px var(--spl-warning); }
     1539.spl-app .form-table tr:has(.splg-field-saved), .spl-app .form-table tr.splg-row-saved { background-color: var(--spl-surface); border-color: rgba(74, 222, 128, .6); }
     1540.spl-app .form-table tr:has(.splg-field-saved) th label, .spl-app .form-table tr.splg-row-saved th label,
     1541.spl-app .form-table tr:has(.splg-field-saved) th label::after, .spl-app .form-table tr.splg-row-saved th label::after { color: var(--spl-success); }
     1542.spl-app .form-table input.splg-field-saved:not([type="checkbox"]):not([type="radio"]) { background-color: var(--spl-bg); border-color: var(--spl-success) !important; box-shadow: 0 0 0 1px var(--spl-success); }
     1543
     1544/* Evidence and helper boxes */
     1545.spl-app .splg-evidence { background: var(--spl-bg); border: 1px solid var(--spl-border); border-left: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); color: var(--spl-text-2); margin-top: 10px; }
     1546.spl-app .splg-evidence:empty { display: none; }
     1547.spl-app .splg-evidence a, .spl-app .splg-evidence .splg-evidence-inline { color: var(--spl-cyan); }
     1548.spl-app .splg-stats-info { background: var(--spl-bg); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); }
     1549.spl-app .splg-stats-info p { color: var(--spl-text-2); }
     1550
     1551/* Smart Notifications */
     1552.spl-app .splg-profile-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0 8px; padding: 0; border: 0; }
     1553.spl-app .splg-profile-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 16px 44px; border: 1px solid var(--spl-border); border-radius: 10px; background: var(--spl-surface); cursor: pointer; color: var(--spl-text); transition: border-color var(--spl-dur-fast) ease, background-color var(--spl-dur-fast) ease; }
     1554.spl-app .splg-profile-card:hover { border-color: var(--spl-control); }
     1555.spl-app .splg-profile-card input[type="radio"] { position: absolute; left: 16px; top: 17px; margin: 0; width: 18px; height: 18px; border: 2px solid var(--spl-control); background: transparent; }
     1556.spl-app .splg-profile-card input[type="radio"]:checked { border-color: var(--spl-cyan); }
     1557.spl-app .splg-profile-card input[type="radio"]:checked::before { background: var(--spl-cyan); width: 8px; height: 8px; margin: 3px; }
     1558.spl-app .splg-profile-card:has(input:checked) { border-color: var(--spl-cyan); background: var(--spl-elevated); }
     1559.spl-app .splg-profile-card:has(input:focus-visible) { box-shadow: var(--spl-focus); }
     1560.spl-app .splg-profile-name { font-weight: var(--spl-fw-semibold); }
     1561.spl-app .splg-profile-desc { color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1562.spl-app .splg-profile-facts { color: var(--spl-text); font-size: var(--spl-fs-xs); line-height: 1.6; }
     1563.spl-app .splg-notify-custom { border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); padding: 8px 18px 4px; margin: 16px 0; }
     1564.spl-app .splg-notify-custom legend { color: var(--spl-text); font-weight: var(--spl-fw-semibold); padding: 0 6px; }
     1565.spl-app .splg-notify-custom[disabled] { opacity: .55; }
     1566.spl-app .splg-notify-custom .form-table tr { background: transparent; border: 0; border-bottom: 1px solid var(--spl-border); border-radius: 0; padding: 12px 0; margin: 0; }
     1567.spl-app .splg-stat { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); }
     1568.spl-app .splg-stat-value { color: var(--spl-text); }
     1569.spl-app .splg-stat-alert { border-color: var(--spl-critical); }
     1570.spl-app .splg-stat-label { color: var(--spl-text-2); }
     1571.spl-app .splg-stat-week { color: var(--spl-text-3); }
     1572.spl-app .splg-mail-error { color: var(--spl-critical); }
     1573.spl-app .splg-sev { background: var(--spl-elevated); color: var(--spl-text-2); }
     1574.spl-app .splg-sev-4 { background: var(--spl-elevated); color: var(--spl-critical); }
     1575.spl-app .splg-sev-3 { background: var(--spl-elevated); color: var(--spl-high); }
     1576.spl-app .splg-sev-2 { background: var(--spl-elevated); color: var(--spl-warning); }
     1577
     1578/* Unsaved-changes dialog */
     1579.splg-dialog-overlay { background: rgba(8, 15, 28, .8); }
     1580.splg-dialog-content { background: #101B2B; color: #F8FAFC; border: 1px solid #263449; border-radius: 12px; box-shadow: 0 24px 48px rgba(0, 0, 0, .5); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
     1581.splg-dialog-header h3, .splg-dialog-header .dashicons { color: #FBBF24; }
     1582.splg-dialog-body p { color: #94A3B8; }
     1583.splg-dialog-body strong { color: #F8FAFC; }
     1584.splg-modified-fields-preview { background: #080F1C; border-color: #263449; }
     1585.splg-modified-fields-preview h4 { color: #F8FAFC; }
     1586.splg-modified-list li { color: #94A3B8; }
     1587.splg-modified-list li strong { color: #FBBF24; }
     1588.splg-dialog-actions .button { border-radius: 8px !important; min-height: 40px; }
     1589.splg-save-and-continue, .splg-save-and-continue:hover { background: #22D3EE !important; border-color: #22D3EE !important; color: #080F1C !important; }
     1590.splg-discard-and-continue, .splg-discard-and-continue:hover { background: transparent !important; border-color: #F87171 !important; color: #F87171 !important; }
     1591.splg-stay-here, .splg-stay-here:hover { background: transparent !important; border-color: #64748B !important; color: #F8FAFC !important; }
     1592
     1593@media screen and (max-width: 960px) {
     1594    .spl-app .splg-profile-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
     1595}
     1596@media screen and (max-width: 782px) {
     1597    .spl-app .splg-top-save-area { top: 46px; }
     1598    .spl-app .settings-content .form-table tr { grid-template-columns: minmax(0, 1fr); }
     1599    .spl-app .settings-nav-tabs { display: flex; }
     1600    .spl-app .settings-nav-tab { flex: 1 1 auto; justify-content: center; min-height: var(--spl-touch); }
     1601    .spl-app .splg-profile-cards { grid-template-columns: minmax(0, 1fr); }
     1602    .spl-app .widefat { display: block; overflow-x: auto; }
     1603}
     1604
     1605/* Review fixes: notices, button icons, save bar on small screens, daily chart */
     1606.spl-app .tab-content .notice.inline, .spl-app .tab-content .notice.inline p, .spl-app .tab-content .notice.inline strong { color: var(--spl-text); }
     1607.spl-app .tab-content .notice.inline p { display: block; padding-left: 18px; position: relative; font-size: var(--spl-fs-sm); line-height: 1.6; }
     1608.spl-app .tab-content .notice.inline p::before { position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; }
     1609.spl-app .tab-content .notice.inline strong { font-weight: var(--spl-fw-semibold); }
     1610.spl-app .tab-content .notice.inline a { color: var(--spl-cyan); }
     1611.spl-app .notice-warning.inline { border-color: rgba(251, 191, 36, .45); }
     1612
     1613.spl-app .action-buttons .button, .spl-app .tab-content .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; line-height: 1.2; margin: 0; }
     1614.spl-app .tab-content .button.button-small { min-height: 30px; padding: 0 10px; }
     1615.spl-app .tab-content .button .dashicons { margin: 0; width: 16px; height: 16px; font-size: 16px; line-height: 16px; vertical-align: 0; }
     1616
     1617.spl-app .daily-chart { display: flex; align-items: stretch; gap: 8px; height: 220px; margin: 12px 0 0; padding: 0; list-style: none; border: 0; }
     1618.spl-app .daily-col { flex: 1 1 0; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
     1619.spl-app .daily-track { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--spl-control); padding-top: 22px; }
     1620.spl-app .daily-bar { position: relative; display: block; width: 100%; min-height: 2px; padding: 0; background: var(--spl-cyan); border-radius: 4px 4px 0 0; }
     1621.spl-app .daily-count { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 4px; text-align: center; color: var(--spl-text); font-size: var(--spl-fs-xs); font-weight: var(--spl-fw-semibold); font-variant-numeric: tabular-nums; }
     1622.spl-app .daily-date { transform: none; text-align: center; color: var(--spl-text-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
     1623
     1624@media screen and (max-width: 782px) {
     1625    .spl-app .splg-top-save-area { flex-direction: column; align-items: stretch; }
     1626    .spl-app .splg-save-wrapper { margin-left: 0; flex-direction: column; align-items: stretch; }
     1627    .spl-app .splg-save-wrapper .button-primary, .spl-app .splg-cancel-button { width: 100%; min-height: var(--spl-touch); justify-content: center; }
     1628    .spl-app .splg-save-description { text-align: center; }
     1629    .spl-app .daily-chart { height: 180px; gap: 4px; }
     1630    .spl-app .daily-date { font-size: 10px; }
     1631}
     1632
     1633/* Badges beside text: consistent gap and vertical alignment everywhere */
     1634.spl-app .settings-content .form-table th { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 8px; align-content: flex-start; }
     1635.spl-app .settings-content .form-table th .spl-status { margin: 0; }
     1636.spl-app .spl-status, .spl-app .splg-tag, .spl-app .lockout-status { vertical-align: middle; }
     1637.spl-app .splg-health-when .splg-tag, .spl-app .splg-restriction .splg-tag { margin-left: 8px; }
     1638.spl-app .splg-check-table .splg-tag { margin-top: 6px; }
     1639.spl-app .splg-finding-status { column-gap: 8px; row-gap: 6px; }
     1640.spl-app .splg-cat-name { column-gap: 8px; row-gap: 4px; }
     1641.spl-app .spl-nav-list .spl-badge { margin-left: 2px; }
     1642
     1643/* Beta review: descriptions on their own line; login event dots */
     1644.spl-app .settings-content .form-table td .description, .spl-app .settings-content .form-table td p.description { display: block; }
     1645.spl-app .log-entry.successful_login::before, .spl-app .log-entry.allowed::before { background: var(--spl-success); }
     1646.spl-app .log-entry.failed_attempt::before, .spl-app .log-entry.failed_login::before { background: var(--spl-high); }
     1647.spl-app .log-entry.lockout::before, .spl-app .log-entry.locked::before, .spl-app .log-entry.permanent_lockout::before { background: var(--spl-critical); }
     1648.spl-app .log-entry.permanent_block_attempt::before { background: var(--spl-critical); }
     1649.spl-app .log-entry.ip_unlocked::before { background: var(--spl-success); }
     1650.spl-app input:disabled, .spl-app select:disabled, .spl-app textarea:disabled, .spl-app input[readonly] { background-color: var(--spl-elevated); color: var(--spl-text-3); border-color: var(--spl-border); box-shadow: none; opacity: 1; cursor: not-allowed; }
     1651/* Filter bars: each label beside its own field (WordPress floats .tablenav selects, which reorders them) */
     1652.spl-app .tablenav { height: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
     1653.spl-app .tablenav .actions, .spl-app .tablenav form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; float: none; padding: 0; overflow: visible; }
     1654.spl-app .tablenav select, .spl-app .tablenav input, .spl-app .tablenav .button { float: none; margin: 0; }
     1655.spl-app .tablenav label { color: var(--spl-text-2); font-size: var(--spl-fs-sm); margin-left: 4px; }
     1656.spl-app .tablenav br.clear { display: none; }
     1657@media screen and (max-width: 600px) {
     1658    .spl-app .splg-health-run .splg-btn-primary { width: 100%; }
     1659}
     1660.spl-app .splg-cat .splg-bar { background: var(--spl-border); }
     1661.spl-app .splg-sev-pill { justify-self: start; }
     1662.spl-app pre code { background: transparent; padding: 0; border-radius: 0; }
     1663.spl-app .splg-status + .splg-status::before { content: ""; margin: 0; }
     1664/* Brand focus ring on WordPress buttons and Settings sub-section tabs inside the shell */
     1665.spl-app .button:focus, .spl-app .button-primary:focus, .spl-app .button-secondary:focus, .spl-app input[type="submit"]:focus,
     1666.spl-app .settings-nav-tab:focus, .spl-app .splg-tab-button:focus-visible { box-shadow: var(--spl-focus); outline: none; }
  • secureprolabs-guard/tags/2.4.6/admin/js/admin.js

    r3839918 r3841085  
    1414           
    1515            if (name && name !== '_wpnonce' && name !== '_wp_http_referer') {
    16                 if (type === 'checkbox' || type === 'radio') {
     16                if (type === 'radio') {
     17                    // Radios share one name: key each by its value so the group's choice is tracked.
     18                    data[name + '=' + $input.val()] = $input.is(':checked');
     19                } else if (type === 'checkbox') {
    1720                    data[name] = $input.is(':checked');
    1821                } else {
    … …  
    105108            // Add body class for disabled navigation styling
    106109            $('body').addClass('splg-has-unsaved-changes');
     110            $('.splg-save-state').each(function() { $(this).text($(this).data('unsaved')).attr('data-state', 'unsaved'); });
    107111        } else {
    108112            // Remove indicator from all tabs
    … …  
    114118            // Remove body class
    115119            $('body').removeClass('splg-has-unsaved-changes');
     120            $('.splg-save-state').text('').removeAttr('data-state');
    116121        }
    117122    }
    … …  
    141146    function setupTabNavigationPrevention() {
    142147        // Handle main tab navigation (Overview, Settings, Lockouts, etc.)
    143         $('.nav-tab').on('click', function(e) {
    144             if (formChanged) {
     148        $('.nav-tab, .spl-nav a').on('click', function(e) {
     149            if (formChanged && $(this).attr('aria-current') !== 'page') {
    145150                e.preventDefault();
    146151                showUnsavedChangesDialog($(this).attr('href'), 'main-tab');
    … …  
    471476                   
    472477                    if (name && name !== '_wpnonce' && name !== '_wp_http_referer' && name !== 'submit') {
    473                         if (originalData.hasOwnProperty(name)) {
    474                             if (type === 'checkbox' || type === 'radio') {
     478                        if (type === 'radio' && originalData.hasOwnProperty(name + '=' + $field.val())) {
     479                            $field.prop('checked', originalData[name + '=' + $field.val()]);
     480                        } else if (originalData.hasOwnProperty(name)) {
     481                            if (type === 'checkbox') {
    475482                                $field.prop('checked', originalData[name]);
    476483                            } else {
    … …  
    554561    });
    555562});
     563
     564
     565// Smart Notifications: enable custom rules only for the Custom profile and highlight the chosen preset.
     566jQuery(function($) {
     567    var $profile = $('input[name="secureprolabs_guard_notify_profile"]');
     568    if (!$profile.length) {
     569        return;
     570    }
     571    function sync() {
     572        var value = $profile.filter(':checked').val();
     573        $('.splg-notify-custom').prop('disabled', value !== 'custom');
     574        $('.splg-profile-table [data-profile]').removeClass('splg-profile-active');
     575        $('.splg-profile-table [data-profile="' + value + '"]').addClass('splg-profile-active');
     576    }
     577    $profile.on('change', sync);
     578    sync();
     579});
     580
     581// Security Health: run one check per request so no single request runs long.
     582jQuery(function($) {
     583    var $btn = $('#splg-health-run');
     584    if (!$btn.length) {
     585        return;
     586    }
     587    var cfg = window.SecureProLabsGuard || {};
     588    var i18n = cfg.i18n || {};
     589    var $progress = $('#splg-health-progress');
     590    var $fill = $progress.find('.splg-bar-fill');
     591    var $bar = $progress.find('.splg-bar');
     592    var $label = $('#splg-health-progress-label');
     593    var started = false;
     594
     595    function call(step, control) {
     596        return $.post(cfg.ajax_url, { action: 'secureprolabs_guard_health', nonce: cfg.nonce, step: step, control: control || '' });
     597    }
     598    function format(tpl, a, b, c) {
     599        return String(tpl || '').replace('%1$s', a).replace('%2$d', b).replace('%3$d', c);
     600    }
     601    function fail(xhr) {
     602        var msg = (xhr && xhr.responseJSON && xhr.responseJSON.data && xhr.responseJSON.data.message) || i18n.healthFailed;
     603        // WordPress answers 0 or -1 when the session expired or the page's security token is too old.
     604        if (xhr && (xhr.status === 400 || xhr.status === 403) && /^-?[01]$/.test(String(xhr.responseText || '').trim())) {
     605            msg = i18n.healthSession;
     606        }
     607        $label.text(msg);
     608        $btn.prop('disabled', false).text(i18n.healthRun);
     609        if (started) { call('cancel'); started = false; }
     610    }
     611    $btn.on('click', function() {
     612        $btn.prop('disabled', true).text(i18n.healthRunning);
     613        $progress.prop('hidden', false);
     614        call('start').done(function(res) {
     615            if (!res || !res.success) { return fail(); }
     616            started = true;
     617            var list = res.data.controls, i = 0;
     618            (function next() {
     619                if (i >= list.length) {
     620                    $label.text(i18n.healthSaving);
     621                    call('finish').done(function(r) {
     622                        if (r && r.success) { window.location.reload(); } else { fail(); }
     623                    }).fail(fail);
     624                    return;
     625                }
     626                $label.text(format(i18n.healthChecking, list[i].title, i + 1, list.length));
     627                call('check', list[i].id).done(function(r) {
     628                    if (!r || !r.success) { return fail(); }
     629                    i++;
     630                    var pct = Math.round(i / list.length * 100);
     631                    $fill.css('width', pct + '%');
     632                    $bar.attr('aria-valuenow', pct);
     633                    next();
     634                }).fail(fail);
     635            })();
     636        }).fail(fail);
     637    });
     638});
     639
     640// Security Health: select a category to list its open items; select again to go back to the top actions.
     641jQuery(function($) {
     642    var $cats = $('.splg-cat');
     643    var $items = $('#splg-action-list > li');
     644    var $reset = $('#splg-actions-reset');
     645    var $note = $('#splg-actions-filter');
     646    var $more = $('#splg-actions-more');
     647    if (!$cats.length) {
     648        return;
     649    }
     650    function showTop() {
     651        $cats.attr('aria-pressed', 'false');
     652        $items.each(function(i) { $(this).prop('hidden', i >= 5); });
     653        $reset.prop('hidden', true);
     654        $note.prop('hidden', true).text('');
     655        $more.prop('hidden', false);
     656    }
     657    $cats.on('click', function() {
     658        var $btn = $(this);
     659        if ($btn.attr('aria-pressed') === 'true') {
     660            return showTop();
     661        }
     662        var cat = $btn.data('category');
     663        $cats.attr('aria-pressed', 'false');
     664        $btn.attr('aria-pressed', 'true');
     665        var shown = 0;
     666        var $matches = $();
     667        $items.removeClass('splg-flash splg-flash-fix splg-flash-verify');
     668        $items.each(function() {
     669            var match = $(this).data('category') === cat;
     670            $(this).prop('hidden', !match);
     671            if (match) { shown++; $matches = $matches.add(this); }
     672        });
     673        if ($matches.length) {
     674            // Bring the first match into view (actions sit below the bars on narrow screens), then flash them.
     675            var first = $matches.get(0);
     676            var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
     677            var rect = first.getBoundingClientRect();
     678            if (rect.top < 0 || rect.bottom > window.innerHeight) {
     679                first.scrollIntoView({ behavior: reduce ? 'auto' : 'smooth', block: 'nearest' });
     680            }
     681            $matches.each(function() {
     682                var kind = $(this).find('.splg-action-cat').data('kind') === 'verify' ? 'splg-flash-verify' : 'splg-flash-fix';
     683                void this.offsetWidth; // restart the animation when the same category is chosen again
     684                $(this).addClass('splg-flash ' + kind);
     685            });
     686            clearTimeout($items.data('flashTimer'));
     687            $items.data('flashTimer', setTimeout(function() {
     688                $items.removeClass('splg-flash splg-flash-fix splg-flash-verify');
     689            }, reduce ? 1800 : 1700));
     690        }
     691        var name = $.trim($btn.find('.splg-cat-name').contents().first().text());
     692        $note.prop('hidden', false).text(shown ? name : name + ': ' + ($btn.closest('.splg-health').data('empty') || 'nothing open'));
     693        $reset.prop('hidden', false);
     694        $more.prop('hidden', true);
     695    });
     696    $reset.on('click', showTop);
     697    // "View details" opens the All checks panel so the target row is visible.
     698    $('.splg-health').on('click', 'a[href^="#splg-control-"]', function() {
     699        $('#splg-checks-details').prop('open', true);
     700    });
     701});
     702
     703// VAPT Assessment: open and highlight a finding linked from Security Health; confirm deletes.
     704jQuery(function($) {
     705    if (!$('.splg-vapt').length) {
     706        return;
     707    }
     708    var id = window.location.hash.replace(/^#/, '');
     709    if (/^finding-(SPL|EXT)-\d+$/.test(id)) {
     710        var el = document.getElementById(id);
     711        if (el) {
     712            el.open = true;
     713            el.scrollIntoView({ block: 'center', behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' });
     714            $(el).addClass('splg-flash');
     715            window.setTimeout(function() { $(el).removeClass('splg-flash'); }, 1700);
     716        }
     717    }
     718    $('.splg-delete-form').on('submit', function(e) {
     719        if (!window.confirm($(this).data('confirm'))) {
     720            e.preventDefault();
     721        }
     722    });
     723});
     724
     725// SecureProLabs shell: switch semantics for settings checkboxes, and a saved confirmation in the save bar.
     726jQuery(function($) {
     727    var $app = $('.spl-app');
     728    if (!$app.length) {
     729        return;
     730    }
     731    $app.find('.form-table input[type="checkbox"]').attr('role', 'switch');
     732    if (/[?&]settings-updated=true/.test(window.location.search)) {
     733        $('.splg-save-state').each(function() { $(this).text($(this).data('saved')).attr('data-state', 'saved'); });
     734    }
     735});
  • secureprolabs-guard/tags/2.4.6/admin/partials/admin-tabs.php

    r3839918 r3841085  
    99    exit;
    1010}
     11
     12// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    1113
    1214// Verify user permissions
    … …  
    2628$active_tab = $this->request_text($_GET, 'tab'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    2729$current_page_slug = $this->request_text($_GET, 'page'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    28 if (!in_array($active_tab, array('overview', 'settings', 'lockouts', 'logs', 'statistics'), true)) {
    29     $active_tab = array('secureprolabs-guard-lockouts' => 'lockouts', 'secureprolabs-guard-logs' => 'logs')[$current_page_slug] ?? 'overview';
     30if (!in_array($active_tab, array('health', 'vapt', 'overview', 'settings', 'lockouts', 'logs', 'statistics'), true)) {
     31    $active_tab = array('secureprolabs-guard-lockouts' => 'lockouts', 'secureprolabs-guard-logs' => 'logs', 'secureprolabs-guard-vapt' => 'vapt')[$current_page_slug] ?? 'health';
    3032}
    3133$notice = $this->request_text($_GET, 'splg_notice'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    … …  
    4345    'lockout_deleted' => array('success', __('Lockout record deleted.', 'secureprolabs-guard')),
    4446    'lockout_change_failed' => array('error', __('No matching lockout changed. Refresh the list and try again.', 'secureprolabs-guard')),
     47    'test_sent' => array('success', __('Test notification submitted to your mail system. Check the inbox, including spam.', 'secureprolabs-guard')),
     48    'test_wait' => array('info', __('A test was sent less than a minute ago. Please wait a moment.', 'secureprolabs-guard')),
     49    'vapt_added' => array('success', __('External finding added.', 'secureprolabs-guard')),
     50    'vapt_saved' => array('success', __('Finding updated.', 'secureprolabs-guard')),
     51    'vapt_deleted' => array('success', __('External finding deleted.', 'secureprolabs-guard')),
     52    'vapt_accepted' => array('success', __('Risk acceptance recorded. The finding still limits the Security Health score until it is fixed and verified.', 'secureprolabs-guard')),
     53    'vapt_revoked' => array('success', __('Risk acceptance removed.', 'secureprolabs-guard')),
     54    'vapt_invalid' => array('error', __('The finding was not saved. A title and a valid severity, status, related check and date are required.', 'secureprolabs-guard')),
     55    'vapt_auditor' => array('error', __('Independently verified needs the auditor reference, for example the retest report number.', 'secureprolabs-guard')),
     56    'vapt_justify' => array('error', __('Add a justification of at least 10 characters to accept a risk.', 'secureprolabs-guard')),
     57    'vapt_review_date' => array('error', __('Choose a review date in the future, at most one year away.', 'secureprolabs-guard')),
     58    'vapt_not_open' => array('error', __('Only an open finding can be accepted as a risk.', 'secureprolabs-guard')),
     59    'vapt_missing' => array('error', __('That finding no longer exists. Refresh the list.', 'secureprolabs-guard')),
     60    'vapt_failed' => array('error', __('The finding could not be saved. Try again.', 'secureprolabs-guard')),
     61    'test_failed' => array('error', __('WordPress could not submit the test email. See the last mail error under Notification Activity.', 'secureprolabs-guard')),
    4562);
    4663?>
    4764
    48 <div class="wrap">
    49     <h1><?php echo esc_html__('SecureProLabs Guard Dashboard', 'secureprolabs-guard'); ?></h1>
     65<?php
     66$splg_sections = array(
     67    'health' => __('Security Health', 'secureprolabs-guard'),
     68    'vapt' => __('VAPT Assessment', 'secureprolabs-guard'),
     69    'overview' => __('Overview', 'secureprolabs-guard'),
     70    'settings' => __('Settings', 'secureprolabs-guard'),
     71    'lockouts' => __('Lockouts', 'secureprolabs-guard'),
     72    'logs' => __('Security Logs', 'secureprolabs-guard'),
     73    'statistics' => __('Statistics', 'secureprolabs-guard'),
     74);
     75$splg_section_url = static function ($tab) {
     76    return admin_url('admin.php?page=secureprolabs-guard&tab=' . $tab);
     77};
     78?>
     79<div class="wrap splg-wrap">
     80    <?php // WordPress places its own and other plugins' notices here, outside the dark application shell. ?>
     81    <hr class="wp-header-end" />
    5082
    51     <?php if (isset($notices[$notice])): ?>
    52         <div class="notice notice-<?php echo esc_attr($notices[$notice][0]); ?> is-dismissible">
    53             <p><?php echo esc_html($notices[$notice][1]); ?></p>
    54         </div>
    55     <?php endif; ?>
    56     <?php require SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/module-status.php'; ?>
    57    
    58     <!-- Tab Navigation -->
    59     <nav class="nav-tab-wrapper wp-clearfix">
    60         <a href="?page=secureprolabs-guard&tab=overview" class="nav-tab <?php echo esc_attr($active_tab === 'overview' ? 'nav-tab-active' : ''); ?>">
    61             <span class="dashicons dashicons-dashboard"></span> <?php echo esc_html__('Overview', 'secureprolabs-guard'); ?>
    62         </a>
    63         <a href="?page=secureprolabs-guard&tab=settings" class="nav-tab <?php echo esc_attr($active_tab === 'settings' ? 'nav-tab-active' : ''); ?>">
    64             <span class="dashicons dashicons-admin-settings"></span> <?php echo esc_html__('Settings', 'secureprolabs-guard'); ?>
    65         </a>
    66         <a href="?page=secureprolabs-guard&tab=lockouts" class="nav-tab <?php echo esc_attr($active_tab === 'lockouts' ? 'nav-tab-active' : ''); ?>">
    67             <span class="dashicons dashicons-lock"></span> <?php echo esc_html__('Lockouts', 'secureprolabs-guard'); ?>
    68             <?php if ($active_lockouts > 0): ?>
    69                 <span class="update-plugins"><span class="plugin-count"><?php echo esc_html((string) $active_lockouts); ?></span></span>
     83    <div class="spl-app" data-spl-product="guard">
     84        <header class="spl-header">
     85            <div class="spl-brand">
     86                <svg class="spl-brand-icon" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M12 3l7 3v5c0 4.5-3 8.3-7 10-4-1.7-7-5.5-7-10V6l7-3z"/><path d="M9 12l2 2 4-4"/></svg>
     87                <div>
     88                <h1 class="spl-wordmark">SecureProLabs <span>Guard</span></h1>
     89                <p class="spl-tagline"><?php echo esc_html__('Protect. Verify. Fortify.', 'secureprolabs-guard'); ?></p>
     90                </div>
     91            </div>
     92            <p class="spl-version"><?php
     93                /* translators: %s: plugin version. */
     94                echo esc_html(sprintf(__('Version %s', 'secureprolabs-guard'), SECUREPROLABS_GUARD_VERSION));
     95            ?></p>
     96        </header>
     97
     98        <nav class="spl-nav" aria-label="<?php echo esc_attr__('Guard sections', 'secureprolabs-guard'); ?>">
     99            <ul class="spl-nav-list">
     100                <?php foreach ($splg_sections as $splg_key => $splg_label): ?>
     101                    <li>
     102                        <a href="<?php echo esc_url($splg_section_url($splg_key)); ?>" <?php echo $active_tab === $splg_key ? 'aria-current="page"' : ''; ?>>
     103                            <?php echo esc_html($splg_label); ?>
     104                            <?php if ($splg_key === 'lockouts' && $active_lockouts > 0): ?>
     105                                <span class="spl-badge"><span class="screen-reader-text"><?php echo esc_html__('Active lockouts:', 'secureprolabs-guard'); ?> </span><?php echo esc_html((string) $active_lockouts); ?></span>
     106                            <?php endif; ?>
     107                        </a>
     108                    </li>
     109                    <?php if ($splg_key === 'vapt'): ?><li class="spl-nav-divider" aria-hidden="true"></li><?php endif; ?>
     110                <?php endforeach; ?>
     111            </ul>
     112            <details class="spl-nav-mobile">
     113                <summary>
     114                    <span><span class="spl-nav-label"><?php echo esc_html__('Section:', 'secureprolabs-guard'); ?></span> <?php echo esc_html($splg_sections[$active_tab] ?? $splg_sections['overview']); ?></span>
     115                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 9l6 6 6-6"></path></svg>
     116                </summary>
     117                <ul>
     118                    <?php foreach ($splg_sections as $splg_key => $splg_label): ?>
     119                        <li>
     120                            <a href="<?php echo esc_url($splg_section_url($splg_key)); ?>" <?php echo $active_tab === $splg_key ? 'aria-current="page"' : ''; ?>>
     121                                <?php echo esc_html($splg_label); ?>
     122                                <?php if ($splg_key === 'lockouts' && $active_lockouts > 0): ?>
     123                                    <span class="spl-badge"><span class="screen-reader-text"><?php echo esc_html__('Active lockouts:', 'secureprolabs-guard'); ?> </span><?php echo esc_html((string) $active_lockouts); ?></span>
     124                                <?php endif; ?>
     125                            </a>
     126                        </li>
     127                        <?php if ($splg_key === 'vapt'): ?><li class="spl-nav-sep" aria-hidden="true"></li><?php endif; ?>
     128                    <?php endforeach; ?>
     129                </ul>
     130            </details>
     131        </nav>
     132
     133        <div class="spl-main">
     134            <?php if (isset($notices[$notice])): ?>
     135                <div class="notice notice-<?php echo esc_attr($notices[$notice][0]); ?> inline is-dismissible" role="<?php echo esc_attr($notices[$notice][0] === 'error' ? 'alert' : 'status'); ?>">
     136                    <p><?php echo esc_html($notices[$notice][1]); ?></p>
     137                </div>
    70138            <?php endif; ?>
    71         </a>
    72         <a href="?page=secureprolabs-guard&tab=logs" class="nav-tab <?php echo esc_attr($active_tab === 'logs' ? 'nav-tab-active' : ''); ?>">
    73             <span class="dashicons dashicons-list-view"></span> <?php echo esc_html__('Security Logs', 'secureprolabs-guard'); ?>
    74         </a>
    75         <a href="?page=secureprolabs-guard&tab=statistics" class="nav-tab <?php echo esc_attr($active_tab === 'statistics' ? 'nav-tab-active' : ''); ?>">
    76             <span class="dashicons dashicons-chart-bar"></span> <?php echo esc_html__('Statistics', 'secureprolabs-guard'); ?>
    77         </a>
    78     </nav>
     139            <?php if (!in_array($active_tab, array('health', 'vapt'), true)) { require SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/module-status.php'; } ?>
    79140
    80141    <div class="tab-content">
    81142        <?php
    82143        switch ($active_tab) {
     144            case 'health':
     145                include_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/tab-health.php';
     146                break;
     147            case 'vapt':
     148                include_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/tab-vapt.php';
     149                break;
    83150            case 'overview':
    84151                include_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/tab-overview.php';
    … …  
    101168        ?>
    102169    </div>
     170        </div>
     171    </div>
    103172</div>
    104173
  • secureprolabs-guard/tags/2.4.6/admin/partials/module-status.php

    r3839918 r3841085  
    33    exit;
    44}
     5
     6// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    57
    68$modules = array(
  • secureprolabs-guard/tags/2.4.6/admin/partials/tab-lockouts.php

    r3839918 r3841085  
    77    exit;
    88}
     9
     10// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    911
    1012$filter_ip = $this->request_text($_GET, 'ip'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
  • secureprolabs-guard/tags/2.4.6/admin/partials/tab-logs.php

    r3839918 r3841085  
    77    exit;
    88}
     9
     10// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    911
    1012$filter_type = $this->request_text($_GET, 'type', 'all'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    … …  
    3638
    3739// Get log statistics
    38 $total_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $logs_table));
    39 $today_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE DATE(created) = %s", $logs_table,
     40$total_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i", $logs_table));
     41$today_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE DATE(created) = %s", $logs_table,
    4042    current_time('Y-m-d')
    4143));
    4244
    43 $event_types = $wpdb->get_results($wpdb->prepare("SELECT event_type, COUNT(*) as count FROM %i GROUP BY event_type ORDER BY count DESC", $logs_table));
    44 $event_actions = $wpdb->get_results($wpdb->prepare("SELECT event_action, COUNT(*) as count FROM %i GROUP BY event_action ORDER BY count DESC", $logs_table));
     45$event_types = $wpdb->get_results($wpdb->prepare("SELECT event_type, COALESCE(SUM(occurrences), 0) as count FROM %i GROUP BY event_type ORDER BY count DESC", $logs_table));
     46$event_actions = $wpdb->get_results($wpdb->prepare("SELECT event_action, COALESCE(SUM(occurrences), 0) as count FROM %i GROUP BY event_action ORDER BY count DESC", $logs_table));
    4547?>
    4648
    … …  
    123125    <!-- Logs Display -->
    124126    <?php if (empty($logs)): ?>
    125         <div class="notice notice-info">
     127        <div class="notice notice-info inline">
    126128            <p><?php echo esc_html__('No security logs found.', 'secureprolabs-guard'); ?></p>
    127129        </div>
    … …  
    155157                    <div class="log-meta">
    156158                        <span class="log-time"><?php echo esc_html($log->created); ?></span>
     159                        <?php if (isset($log->occurrences) && (int) $log->occurrences > 1): ?>
     160                            <span class="log-occurrences">
     161                                <?php
     162                                /* translators: 1: number of occurrences, 2: time of the last one. */
     163                                echo esc_html(sprintf(__('Repeated %1$d times, last at %2$s', 'secureprolabs-guard'), (int) $log->occurrences, $log->last_seen));
     164                                ?>
     165                            </span>
     166                        <?php endif; ?>
    157167                    </div>
    158168                   
    … …  
    165175       
    166176        <?php if (count($logs) >= 200): ?>
    167             <div class="notice notice-info">
     177            <div class="notice notice-info inline">
    168178                <p><?php echo esc_html__('Showing the 200 most recent logs. Use filters to narrow down results.', 'secureprolabs-guard'); ?></p>
    169179            </div>
  • secureprolabs-guard/tags/2.4.6/admin/partials/tab-overview.php

    r3839918 r3841085  
    33    exit;
    44}
     5
     6// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    57
    68/**
    … …  
    1921    time()
    2022));
    21 $total_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $logs_table));
    22 $today_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE DATE(created) = %s", $logs_table,
     23$total_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i", $logs_table));
     24$today_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE DATE(created) = %s", $logs_table,
    2325    current_time('Y-m-d')
    2426));
    … …  
    3133
    3234$top_blocked_ips = $wpdb->get_results($wpdb->prepare("
    33     SELECT ip_address, COUNT(*) as attempts
     35    SELECT ip_address, COALESCE(SUM(occurrences), 0) as attempts
    3436    FROM %i
    3537    WHERE event_action = 'blocked'
    … …  
    152154   
    153155    <!-- Quick Actions -->
    154     <div style="margin-top: 30px; padding: 20px; background: #f8f9fa; border-radius: 4px;">
     156    <div class="spl-panel splg-quick-actions">
    155157        <h3><?php echo esc_html__('Quick Actions', 'secureprolabs-guard'); ?></h3>
    156158        <div class="action-buttons">
  • secureprolabs-guard/tags/2.4.6/admin/partials/tab-settings.php

    r3839918 r3841085  
    88}
    99
     10// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
     11
    1012$settings_subtab = $this->request_text($_GET, 'subtab', 'security-features'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    1113if (!in_array($settings_subtab, array('security-features', 'lockout', 'notifications', 'advanced'), true)) {
    1214    $settings_subtab = 'security-features';
    1315}
     16
     17// Assessment status per setting, from the last Security Health run (display only).
     18$splg_health = SecureProLabs_Guard_Security_Health::summary();
     19$splg_option_controls = array();
     20foreach (SecureProLabs_Guard_Security_Controls::all() as $splg_cid => $splg_control) {
     21    // A control's options list every setting that can make its result stale; the pill belongs only on the
     22    // setting that turns the protection on (the first one, or the matching name when it has one).
     23    if (!$splg_control['options']) {
     24        continue;
     25    }
     26    $splg_main = in_array($splg_cid, $splg_control['options'], true) ? $splg_cid : $splg_control['options'][0];
     27    $splg_option_controls[$splg_main][] = $splg_cid;
     28}
     29$splg_pill = static function ($option) use ($splg_health, $splg_option_controls) {
     30    if (empty($splg_health['assessed']) || empty($splg_option_controls[$option])) {
     31        return;
     32    }
     33    // When one setting drives several checks, show the one that needs attention most.
     34    $rank = array('misconfigured' => 0, 'changed' => 1, 'untested' => 2, 'unverified' => 3, 'verified' => 4, 'na' => 5);
     35    $labels = array(
     36        'misconfigured' => __('Misconfigured', 'secureprolabs-guard'),
     37        'changed' => __('Changed since last assessment', 'secureprolabs-guard'),
     38        'untested' => __('Untested', 'secureprolabs-guard'),
     39        'unverified' => __('Unverified', 'secureprolabs-guard'),
     40        'verified' => __('Verified', 'secureprolabs-guard'),
     41        'na' => __('Not applicable', 'secureprolabs-guard'),
     42    );
     43    $worst = null;
     44    $ids = array();
     45    foreach ($splg_option_controls[$option] as $cid) {
     46        if (!isset($splg_health['controls'][$cid])) {
     47            continue;
     48        }
     49        $c = $splg_health['controls'][$cid];
     50        $state = $c['changed'] ? 'changed' : $c['state'];
     51        $ids[] = $c['finding'];
     52        if ($worst === null || $rank[$state] < $rank[$worst]) {
     53            $worst = $state;
     54        }
     55    }
     56    if ($worst === null) {
     57        return;
     58    }
     59    printf(
     60        '<span class="spl-status spl-status-%1$s" title="%2$s">%3$s</span>',
     61        esc_attr($worst),
     62        /* translators: %s: finding IDs. */
     63        esc_attr(sprintf(__('Last assessment, checks %s', 'secureprolabs-guard'), implode(', ', $ids))),
     64        esc_html($labels[$worst])
     65    );
     66};
    1467?>
    1568
    … …  
    1871   
    1972    <!-- Unsaved Changes Notice -->
    20     <div id="splg-unsaved-notice" class="notice notice-warning is-dismissible" style="display: none;">
     73    <div id="splg-unsaved-notice" class="notice notice-warning inline" style="display: none;">
    2174        <p>
    2275            <strong><?php echo esc_html__('You have unsaved changes!', 'secureprolabs-guard'); ?></strong>
    … …  
    2679   
    2780    <!-- Uninstall Warning Notice -->
    28     <div class="notice notice-warning">
     81    <div class="notice notice-warning inline">
    2982        <p><strong><?php echo esc_html__('Important:', 'secureprolabs-guard'); ?></strong>
    3083        <?php echo esc_html__('If you uninstall this plugin, all security logs and lockout data will be permanently deleted. Make sure to backup any important security data before uninstalling.', 'secureprolabs-guard'); ?>
    … …  
    74127                    <!-- Top Save Button Area -->
    75128                    <div class="splg-top-save-area">
     129                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    76130                        <div class="splg-save-wrapper">
    77131                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    91145                    <!-- Top Save Button Area -->
    92146                    <div class="splg-top-save-area">
     147                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    93148                        <div class="splg-save-wrapper">
    94149                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    108163                    <!-- Top Save Button Area -->
    109164                    <div class="splg-top-save-area">
     165                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    110166                        <div class="splg-save-wrapper">
    111167                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    125181                    <!-- Top Save Button Area -->
    126182                    <div class="splg-top-save-area">
     183                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    127184                        <div class="splg-save-wrapper">
    128185                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    160217                                <table class="form-table">
    161218                                    <tr>
    162                                         <th scope="row"><?php echo esc_html__('WP-Cron Security', 'secureprolabs-guard'); ?></th>
     219                                        <th scope="row"><?php echo esc_html__('WP-Cron Security', 'secureprolabs-guard'); ?><?php $splg_pill('cron_security'); ?></th>
    163220                                        <td>
    164221                                            <label>
    … …  
    175232                                   
    176233                                    <tr>
    177                                         <th scope="row"><?php echo esc_html__('REST API Security', 'secureprolabs-guard'); ?></th>
     234                                        <th scope="row"><?php echo esc_html__('REST API Security', 'secureprolabs-guard'); ?><?php $splg_pill('rest_api_security'); ?></th>
    178235                                        <td>
    179236                                            <label>
    … …  
    190247                                   
    191248                                    <tr>
    192                                         <th scope="row"><?php echo esc_html__('XML-RPC Protection', 'secureprolabs-guard'); ?></th>
     249                                        <th scope="row"><?php echo esc_html__('XML-RPC Protection', 'secureprolabs-guard'); ?><?php $splg_pill('xmlrpc_security'); ?></th>
    193250                                        <td>
    194251                                            <label>
    … …  
    205262                                   
    206263                                    <tr>
    207                                         <th scope="row"><?php echo esc_html__('Block XML-RPC Completely', 'secureprolabs-guard'); ?></th>
     264                                        <th scope="row"><?php echo esc_html__('Block XML-RPC Completely', 'secureprolabs-guard'); ?><?php $splg_pill('block_xmlrpc_completely'); ?></th>
    208265                                        <td>
    209266                                            <label>
    … …  
    220277                                   
    221278                                    <tr>
    222                                         <th scope="row"><?php echo esc_html__('Block Suspicious XML-RPC Methods', 'secureprolabs-guard'); ?></th>
     279                                        <th scope="row"><?php echo esc_html__('Block Suspicious XML-RPC Methods', 'secureprolabs-guard'); ?><?php $splg_pill('block_suspicious_methods'); ?></th>
    223280                                        <td>
    224281                                            <label>
    … …  
    243300                                <table class="form-table">
    244301                                    <tr>
    245                                         <th scope="row"><?php echo esc_html__('Server Information Hiding', 'secureprolabs-guard'); ?></th>
     302                                        <th scope="row"><?php echo esc_html__('Server Information Hiding', 'secureprolabs-guard'); ?><?php $splg_pill('server_hardening'); ?></th>
    246303                                        <td>
    247304                                            <label>
    … …  
    266323                                   
    267324                                    <tr>
    268                                         <th scope="row"><?php echo esc_html__('Security Headers', 'secureprolabs-guard'); ?></th>
     325                                        <th scope="row"><?php echo esc_html__('Security Headers', 'secureprolabs-guard'); ?><?php $splg_pill('security_headers'); ?></th>
    269326                                        <td>
    270327                                            <label>
    … …  
    297354                                <table class="form-table">
    298355                                    <tr>
    299                                         <th scope="row"><?php echo esc_html__('Login Rate Limiting', 'secureprolabs-guard'); ?></th>
     356                                        <th scope="row"><?php echo esc_html__('Login Rate Limiting', 'secureprolabs-guard'); ?><?php $splg_pill('login_rate_limiting'); ?></th>
    300357                                        <td>
    301358                                            <label>
    … …  
    312369                                   
    313370                                    <tr>
    314                                         <th scope="row"><?php echo esc_html__('Password Reset Rate Limiting', 'secureprolabs-guard'); ?></th>
     371                                        <th scope="row"><?php echo esc_html__('Password Reset Rate Limiting', 'secureprolabs-guard'); ?><?php $splg_pill('password_reset_rate_limiting'); ?></th>
    315372                                        <td>
    316373                                            <label>
    … …  
    327384                                            $table_name = $wpdb->prefix . 'secureprolabs_guard_logs';
    328385                                            $one_hour_ago = get_date_from_gmt(gmdate('Y-m-d H:i:s', time() - HOUR_IN_SECONDS));
    329                                             $attempt_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE event_type = 'password_reset_rate_limiting' AND event_action = 'request' AND created >= %s", $table_name,
     386                                            $attempt_count = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE event_type = 'password_reset_rate_limiting' AND event_action = 'request' AND created >= %s", $table_name,
    330387                                                $one_hour_ago
    331388                                            ));
    … …  
    342399                                   
    343400                                    <tr>
    344                                         <th scope="row"><?php echo esc_html__('Hide Lost Password Link', 'secureprolabs-guard'); ?></th>
     401                                        <th scope="row"><?php echo esc_html__('Hide Lost Password Link', 'secureprolabs-guard'); ?><?php $splg_pill('hide_lost_password_link'); ?></th>
    345402                                        <td>
    346403                                            <label>
    … …  
    356413                                   
    357414                                    <tr>
    358                                         <th scope="row"><?php echo esc_html__('General Rate Limiting', 'secureprolabs-guard'); ?></th>
     415                                        <th scope="row"><?php echo esc_html__('General Rate Limiting', 'secureprolabs-guard'); ?><?php $splg_pill('general_rate_limiting'); ?></th>
    359416                                        <td>
    360417                                            <label>
    … …  
    370427                                    </tr>
    371428                                    <tr>
    372                                         <th scope="row"><?php echo esc_html__('Contact Form Plugins', 'secureprolabs-guard'); ?></th>
     429                                        <th scope="row"><?php echo esc_html__('Contact Form Plugins', 'secureprolabs-guard'); ?><?php $splg_pill('rate_limit_cf7'); ?></th>
    373430                                        <td>
    374431                                            <fieldset>
    … …  
    398455                                    </tr>
    399456                                    <tr>
    400                                         <th scope="row"><?php echo esc_html__('Elementor Pro Anti-Spam', 'secureprolabs-guard'); ?></th>
     457                                        <th scope="row"><?php echo esc_html__('Elementor Pro Anti-Spam', 'secureprolabs-guard'); ?><?php $splg_pill('elementor_honeypot'); ?></th>
    401458                                        <td>
    402459                                            <label>
    … …  
    554611                        <table class="form-table">
    555612                            <tr>
    556                                 <th scope="row"><?php echo esc_html__('Enable Admin Notifications', 'secureprolabs-guard'); ?></th>
     613                                <th scope="row"><?php echo esc_html__('Enable Admin Notifications', 'secureprolabs-guard'); ?><?php $splg_pill('notify_admin'); ?></th>
    557614                                <td>
    558615                                    <label>
    … …  
    570627                                <th scope="row"><?php echo esc_html__('Notification Email', 'secureprolabs-guard'); ?></th>
    571628                                <td>
    572                                     <input type="email" name="secureprolabs_guard_notify_email"
     629                                    <input type="text" name="secureprolabs_guard_notify_email"
    573630                                           value="<?php echo esc_attr(get_option('secureprolabs_guard_notify_email', get_option('admin_email'))); ?>"
    574                                            class="regular-text" />
     631                                           class="regular-text" autocomplete="email" />
    575632                                    <p class="description">
    576                                         <?php echo esc_html__('Email address to receive security notifications. Defaults to admin email.', 'secureprolabs-guard'); ?>
     633                                        <?php echo esc_html__('Up to 5 addresses, separated by commas. Each recipient counts as one email toward the limits below.', 'secureprolabs-guard'); ?>
    577634                                    </p>
    578635                                </td>
    … …  
    585642                        <table class="form-table">
    586643                            <tr>
    587                                 <th scope="row"><?php echo esc_html__('Login Failures', 'secureprolabs-guard'); ?></th>
     644                                <th scope="row"><?php echo esc_html__('Failed Logins', 'secureprolabs-guard'); ?><?php $splg_pill('notify_login_failures'); ?></th>
    588645                                <td>
    589646                                    <label>
    590647                                        <input type="checkbox" name="secureprolabs_guard_notify_login_failures" value="1"
    591648                                            <?php checked(1, get_option('secureprolabs_guard_notify_login_failures', true)); ?> />
    592                                         <?php echo esc_html__('Notify on failed login attempts', 'secureprolabs-guard'); ?>
     649                                        <?php echo esc_html__('Include failed login counts in the digest', 'secureprolabs-guard'); ?>
    593650                                    </label>
    594                                 </td>
    595                             </tr>
    596                            
    597                             <tr>
    598                                 <th scope="row"><?php echo esc_html__('IP Lockouts', 'secureprolabs-guard'); ?></th>
     651                                    <p class="description"><?php echo esc_html__('Single failed logins never send an email on their own. Lockouts are controlled below.', 'secureprolabs-guard'); ?></p>
     652                                </td>
     653                            </tr>
     654                           
     655                            <tr>
     656                                <th scope="row"><?php echo esc_html__('IP Lockouts', 'secureprolabs-guard'); ?><?php $splg_pill('notify_lockouts'); ?></th>
    599657                                <td>
    600658                                    <label>
    … …  
    607665                           
    608666                            <tr>
    609                                 <th scope="row"><?php echo esc_html__('XML-RPC Attacks', 'secureprolabs-guard'); ?></th>
     667                                <th scope="row"><?php echo esc_html__('XML-RPC Attacks', 'secureprolabs-guard'); ?><?php $splg_pill('notify_xmlrpc'); ?></th>
    610668                                <td>
    611669                                    <label>
    … …  
    618676                           
    619677                            <tr>
    620                                 <th scope="row"><?php echo esc_html__('Cron Security', 'secureprolabs-guard'); ?></th>
     678                                <th scope="row"><?php echo esc_html__('Cron Security', 'secureprolabs-guard'); ?><?php $splg_pill('notify_cron'); ?></th>
    621679                                <td>
    622680                                    <label>
    … …  
    625683                                        <?php echo esc_html__('Notify on unauthorized cron access attempts', 'secureprolabs-guard'); ?>
    626684                                    </label>
     685                                </td>
     686                            </tr>
     687                        </table>
     688
     689                        <?php
     690                        $splg_profiles = SecureProLabs_Guard_Notification_Manager::profiles();
     691                        $splg_profile = get_option('secureprolabs_guard_notify_profile', 'balanced');
     692                        $splg_custom = SecureProLabs_Guard_Notification_Manager::clean_rules(get_option('secureprolabs_guard_notify_rules', array()));
     693                        $splg_digest = get_option('secureprolabs_guard_notify_digest', 'daily');
     694                        $splg_sev = array(
     695                            SecureProLabs_Guard_Notification_Manager::SEV_CRITICAL => __('Critical only', 'secureprolabs-guard'),
     696                            SecureProLabs_Guard_Notification_Manager::SEV_HIGH => __('High and Critical', 'secureprolabs-guard'),
     697                            SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM => __('Medium, High and Critical', 'secureprolabs-guard'),
     698                        );
     699                        ?>
     700                        <h3 id="smart-notifications"><?php echo esc_html__('Smart Notifications', 'secureprolabs-guard'); ?></h3>
     701                        <p class="description"><?php echo esc_html__('Every event is always recorded in the security log. These rules only decide which events are emailed right away, which are grouped, and which wait for the digest.', 'secureprolabs-guard'); ?></p>
     702
     703                        <fieldset class="splg-profile-cards">
     704                            <legend class="screen-reader-text"><?php echo esc_html__('Notification Profile', 'secureprolabs-guard'); ?></legend>
     705                            <?php
     706                            $splg_profile_desc = array(
     707                                'quiet' => __('Critical alerts only. Everything else waits for the digest.', 'secureprolabs-guard'),
     708                                'balanced' => __('Medium events and above by email, grouped. Recommended.', 'secureprolabs-guard'),
     709                                'verbose' => __('Every Medium event and above, with short cooldowns.', 'secureprolabs-guard'),
     710                                'custom' => __('Set your own limits below.', 'secureprolabs-guard'),
     711                            );
     712                            $splg_profile_names = array(
     713                                'quiet' => __('Quiet', 'secureprolabs-guard'),
     714                                'balanced' => __('Balanced', 'secureprolabs-guard'),
     715                                'verbose' => __('Verbose', 'secureprolabs-guard'),
     716                                'custom' => __('Custom', 'secureprolabs-guard'),
     717                            );
     718                            foreach ($splg_profile_names as $splg_p => $splg_pname):
     719                                $splg_vals = $splg_p === 'custom' ? $splg_custom : $splg_profiles[$splg_p];
     720                                ?>
     721                                <label class="splg-profile-card" for="splg-notify-profile-<?php echo esc_attr($splg_p); ?>">
     722                                    <input type="radio" id="splg-notify-profile-<?php echo esc_attr($splg_p); ?>" name="secureprolabs_guard_notify_profile" value="<?php echo esc_attr($splg_p); ?>" <?php checked($splg_profile, $splg_p); ?> />
     723                                    <span class="splg-profile-name"><?php echo esc_html($splg_pname); ?></span>
     724                                    <span class="splg-profile-desc"><?php echo esc_html($splg_profile_desc[$splg_p]); ?></span>
     725                                    <span class="splg-profile-facts">
     726                                        <?php
     727                                        /* translators: 1: emails per hour, 2: emails per day. */
     728                                        echo esc_html(sprintf(__('Up to %1$d an hour, %2$d a day', 'secureprolabs-guard'), $splg_vals['hourly'], $splg_vals['daily']));
     729                                        ?><br />
     730                                        <?php
     731                                        /* translators: %d: minutes. */
     732                                        echo esc_html(sprintf(__('Same alert repeated: %d min cooldown', 'secureprolabs-guard'), $splg_vals['cooldown']));
     733                                        ?><br />
     734                                        <?php
     735                                        /* translators: %s: which severities are emailed right away. */
     736                                        echo esc_html(sprintf(__('Right away: %s', 'secureprolabs-guard'), $splg_sev[$splg_vals['immediate']] ?? ''));
     737                                        ?>
     738                                    </span>
     739                                </label>
     740                            <?php endforeach; ?>
     741                        </fieldset>
     742                        <p class="description"><?php echo esc_html__('Every profile keeps part of each limit free for critical alerts, groups repeated events, and records everything in the security log.', 'secureprolabs-guard'); ?></p>
     743
     744                        <fieldset class="splg-notify-custom" <?php disabled($splg_profile !== 'custom'); ?>>
     745                            <legend><?php echo esc_html__('Custom rules', 'secureprolabs-guard'); ?></legend>
     746                            <table class="form-table">
     747                                <tr>
     748                                    <th scope="row"><label for="splg-rule-hourly"><?php echo esc_html__('Emails per hour', 'secureprolabs-guard'); ?></label></th>
     749                                    <td><input id="splg-rule-hourly" type="number" min="1" max="60" name="secureprolabs_guard_notify_rules[hourly]" value="<?php echo esc_attr($splg_custom['hourly']); ?>" class="small-text" /></td>
     750                                </tr>
     751                                <tr>
     752                                    <th scope="row"><label for="splg-rule-daily"><?php echo esc_html__('Emails per day', 'secureprolabs-guard'); ?></label></th>
     753                                    <td><input id="splg-rule-daily" type="number" min="1" max="200" name="secureprolabs_guard_notify_rules[daily]" value="<?php echo esc_attr($splg_custom['daily']); ?>" class="small-text" /></td>
     754                                </tr>
     755                                <tr>
     756                                    <th scope="row"><label for="splg-rule-cooldown"><?php echo esc_html__('Cooldown (minutes)', 'secureprolabs-guard'); ?></label></th>
     757                                    <td><input id="splg-rule-cooldown" type="number" min="1" max="1440" name="secureprolabs_guard_notify_rules[cooldown]" value="<?php echo esc_attr($splg_custom['cooldown']); ?>" class="small-text" />
     758                                        <p class="description"><?php echo esc_html__('Events of one kind arriving during the cooldown are grouped into the next email.', 'secureprolabs-guard'); ?></p></td>
     759                                </tr>
     760                                <tr>
     761                                    <th scope="row"><label for="splg-rule-reserved"><?php echo esc_html__('Reserved for critical alerts', 'secureprolabs-guard'); ?></label></th>
     762                                    <td><input id="splg-rule-reserved" type="number" min="0" max="10" name="secureprolabs_guard_notify_rules[reserved]" value="<?php echo esc_attr($splg_custom['reserved']); ?>" class="small-text" />
     763                                        <p class="description"><?php echo esc_html__('Part of the hourly and daily limits kept free for critical alerts, so an attack cannot use it all up.', 'secureprolabs-guard'); ?></p></td>
     764                                </tr>
     765                                <tr>
     766                                    <th scope="row"><label for="splg-rule-immediate"><?php echo esc_html__('Email right away', 'secureprolabs-guard'); ?></label></th>
     767                                    <td>
     768                                        <select id="splg-rule-immediate" name="secureprolabs_guard_notify_rules[immediate]">
     769                                            <?php foreach ($splg_sev as $splg_level => $splg_text): ?>
     770                                                <option value="<?php echo esc_attr($splg_level); ?>" <?php selected($splg_custom['immediate'], $splg_level); ?>><?php echo esc_html($splg_text); ?></option>
     771                                            <?php endforeach; ?>
     772                                        </select>
     773                                    </td>
     774                                </tr>
     775                                <tr>
     776                                    <th scope="row"><?php echo esc_html__('Grouping', 'secureprolabs-guard'); ?></th>
     777                                    <td>
     778                                        <label><input type="checkbox" name="secureprolabs_guard_notify_rules[grouping]" value="1" <?php checked(1, $splg_custom['grouping']); ?> />
     779                                        <?php echo esc_html__('Group events of the same kind from different IPs into one email', 'secureprolabs-guard'); ?></label><br />
     780                                        <label><input type="checkbox" name="secureprolabs_guard_notify_rules[dedup]" value="1" <?php checked(1, $splg_custom['dedup']); ?> />
     781                                        <?php echo esc_html__('Do not alert again about the same IP during the cooldown', 'secureprolabs-guard'); ?></label>
     782                                    </td>
     783                                </tr>
     784                            </table>
     785                        </fieldset>
     786
     787                        <table class="form-table">
     788                            <tr>
     789                                <th scope="row"><label for="splg-notify-digest"><?php echo esc_html__('Security Digest', 'secureprolabs-guard'); ?></label></th>
     790                                <td>
     791                                    <select id="splg-notify-digest" name="secureprolabs_guard_notify_digest">
     792                                        <option value="daily" <?php selected($splg_digest, 'daily'); ?>><?php echo esc_html__('Daily', 'secureprolabs-guard'); ?></option>
     793                                        <option value="weekly" <?php selected($splg_digest, 'weekly'); ?>><?php echo esc_html__('Weekly (Mondays)', 'secureprolabs-guard'); ?></option>
     794                                        <option value="off" <?php selected($splg_digest, 'off'); ?>><?php echo esc_html__('Off', 'secureprolabs-guard'); ?></option>
     795                                    </select>
     796                                    <p class="description"><?php echo esc_html__('A summary of everything recorded, sent around 08:00 site time. Skipped when nothing happened. It does not count toward the limits.', 'secureprolabs-guard'); ?></p>
    627797                                </td>
    628798                            </tr>
    … …  
    638808                    ?>
    639809                </form>
     810
     811                    <?php if ($this->notification_manager): ?>
     812                        <?php
     813                        $splg_stats = $this->notification_manager->stats(1);
     814                        $splg_week = $this->notification_manager->stats(7);
     815                        $splg_next_digest = wp_next_scheduled(SecureProLabs_Guard_Notification_Manager::DIGEST_HOOK);
     816                        $splg_recent = $this->notification_manager->recent_notices(10);
     817                        $splg_status_labels = array(
     818                            'pending' => __('Waiting (grouping or limit)', 'secureprolabs-guard'),
     819                            'sending' => __('Sending', 'secureprolabs-guard'),
     820                            'sent' => __('Submitted', 'secureprolabs-guard'),
     821                            'failed' => __('Failed', 'secureprolabs-guard'),
     822                            'digested' => __('Moved to digest', 'secureprolabs-guard'),
     823                        );
     824                        ?>
     825                        <section class="splg-notify-diagnostics" aria-labelledby="splg-notify-diag-title">
     826                            <h3 id="splg-notify-diag-title"><?php echo esc_html__('Notification Activity', 'secureprolabs-guard'); ?></h3>
     827                            <p class="description"><?php echo esc_html__('Today, with the last 7 days in brackets. "Submitted" means WordPress handed the email to your mail system; delivery to the inbox cannot be confirmed from WordPress.', 'secureprolabs-guard'); ?></p>
     828                            <ul class="splg-stat-grid" role="list">
     829                                <?php
     830                                $splg_cards = array(
     831                                    'recorded' => __('Events sent to notifications', 'secureprolabs-guard'),
     832                                    'sent' => __('Emails submitted', 'secureprolabs-guard'),
     833                                    'grouped' => __('Events grouped', 'secureprolabs-guard'),
     834                                    'suppressed' => __('Repeat alerts suppressed', 'secureprolabs-guard'),
     835                                    'digest_only' => __('Sent to digest only', 'secureprolabs-guard'),
     836                                    'failed' => __('Failed submissions', 'secureprolabs-guard'),
     837                                );
     838                                foreach ($splg_cards as $splg_key => $splg_label):
     839                                ?>
     840                                    <li class="splg-stat<?php echo $splg_key === 'failed' && $splg_stats['failed'] > 0 ? ' splg-stat-alert' : ''; ?>">
     841                                        <span class="splg-stat-value"><?php echo esc_html(number_format_i18n($splg_stats[$splg_key])); ?></span>
     842                                        <span class="splg-stat-label"><?php echo esc_html($splg_label); ?> <span class="splg-stat-week">(<?php echo esc_html(number_format_i18n($splg_week[$splg_key])); ?>)</span></span>
     843                                    </li>
     844                                <?php endforeach; ?>
     845                            </ul>
     846                            <dl class="splg-notify-meta">
     847                                <dt><?php echo esc_html__('Last notification', 'secureprolabs-guard'); ?></dt>
     848                                <dd><?php echo $splg_stats['last_notification'] ? esc_html(wp_date(get_option('date_format') . ' ' . get_option('time_format'), $splg_stats['last_notification'])) : esc_html__('None yet', 'secureprolabs-guard'); ?></dd>
     849                                <dt><?php echo esc_html__('Next digest', 'secureprolabs-guard'); ?></dt>
     850                                <dd><?php echo get_option('secureprolabs_guard_notify_digest', 'daily') === 'off' ? esc_html__('Off', 'secureprolabs-guard') : ($splg_next_digest ? esc_html(wp_date(get_option('date_format') . ' ' . get_option('time_format'), $splg_next_digest)) : esc_html__('Not scheduled yet', 'secureprolabs-guard')); ?></dd>
     851                                <dt><?php echo esc_html__('Emails used this hour / today', 'secureprolabs-guard'); ?></dt>
     852                                <dd><?php echo esc_html($splg_stats['hour_count'] . ' / ' . $splg_stats['day_count']); ?></dd>
     853                                <?php if ($splg_stats['last_error'] !== ''): ?>
     854                                    <dt><?php echo esc_html__('Last mail error', 'secureprolabs-guard'); ?></dt>
     855                                    <dd class="splg-mail-error"><?php echo esc_html($splg_stats['last_error']); ?></dd>
     856                                <?php endif; ?>
     857                            </dl>
     858
     859                            <h4><?php echo esc_html__('Recent notices', 'secureprolabs-guard'); ?></h4>
     860                            <?php if (!$splg_recent): ?>
     861                                <p><?php echo esc_html__('No notices yet.', 'secureprolabs-guard'); ?></p>
     862                            <?php else: ?>
     863                                <table class="widefat striped">
     864                                    <thead><tr>
     865                                        <th scope="col"><?php echo esc_html__('Severity', 'secureprolabs-guard'); ?></th>
     866                                        <th scope="col"><?php echo esc_html__('Notice', 'secureprolabs-guard'); ?></th>
     867                                        <th scope="col"><?php echo esc_html__('Events', 'secureprolabs-guard'); ?></th>
     868                                        <th scope="col"><?php echo esc_html__('Last event', 'secureprolabs-guard'); ?></th>
     869                                        <th scope="col"><?php echo esc_html__('Status', 'secureprolabs-guard'); ?></th>
     870                                    </tr></thead>
     871                                    <tbody>
     872                                    <?php foreach ($splg_recent as $splg_n): ?>
     873                                        <tr>
     874                                            <td><span class="splg-sev splg-sev-<?php echo esc_attr((int) $splg_n->severity); ?>"><?php echo esc_html(SecureProLabs_Guard_Notification_Manager::severity_label($splg_n->severity)); ?></span></td>
     875                                            <td><?php echo esc_html($splg_n->title); ?></td>
     876                                            <td><?php echo esc_html(number_format_i18n((int) $splg_n->event_count)); ?></td>
     877                                            <td><?php echo esc_html(wp_date(get_option('time_format') . ', ' . get_option('date_format'), (int) $splg_n->last_seen)); ?></td>
     878                                            <td>
     879                                                <?php echo esc_html($splg_status_labels[$splg_n->status] ?? $splg_n->status); ?>
     880                                                <?php if ($splg_n->last_error !== ''): ?><br /><small class="splg-mail-error"><?php echo esc_html($splg_n->last_error); ?></small><?php endif; ?>
     881                                            </td>
     882                                        </tr>
     883                                    <?php endforeach; ?>
     884                                    </tbody>
     885                                </table>
     886                            <?php endif; ?>
     887
     888                            <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="splg-test-notification">
     889                                <?php wp_nonce_field('secureprolabs_guard_test_notification'); ?>
     890                                <input type="hidden" name="action" value="secureprolabs_guard_test_notification" />
     891                                <?php submit_button(__('Send test notification', 'secureprolabs-guard'), 'secondary', 'submit', false); ?>
     892                                <span class="description"><?php echo esc_html__('Sends to the addresses above straight away. Does not use the alert limits.', 'secureprolabs-guard'); ?></span>
     893                            </form>
     894                        </section>
     895                    <?php endif; ?>
    640896                   
    641897                <?php elseif ($settings_subtab === 'advanced'): ?>
    … …  
    7521008                           
    7531009                            <tr>
    754                                 <th scope="row"><?php echo esc_html__('Debug Mode', 'secureprolabs-guard'); ?></th>
     1010                                <th scope="row"><?php echo esc_html__('Debug Mode', 'secureprolabs-guard'); ?><?php $splg_pill('debug_mode'); ?></th>
    7551011                                <td>
    7561012                                    <label>
  • secureprolabs-guard/tags/2.4.6/admin/partials/tab-statistics.php

    r3839918 r3841085  
    33    exit;
    44}
     5
     6// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    57
    68/**
    … …  
    2527    time()
    2628));
    27 $total_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $logs_table));
    28 $blocked_attempts = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE event_action = 'blocked'", $logs_table));
     29$total_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i", $logs_table));
     30$blocked_attempts = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE event_action = 'blocked'", $logs_table));
    2931
    3032// Daily statistics for the last 30 days
    3133$daily_stats = $wpdb->get_results($wpdb->prepare("
    32     SELECT DATE(created) as date, COUNT(*) as count
     34    SELECT DATE(created) as date, COALESCE(SUM(occurrences), 0) as count
    3335    FROM %i
    3436    WHERE created >= %s
    … …  
    3941// Event type breakdown
    4042$event_type_stats = $wpdb->get_results($wpdb->prepare("
    41     SELECT event_type, COUNT(*) as count
     43    SELECT event_type, COALESCE(SUM(occurrences), 0) as count
    4244    FROM %i
    4345    GROUP BY event_type
    … …  
    4749// Event action breakdown
    4850$event_action_stats = $wpdb->get_results($wpdb->prepare("
    49     SELECT event_action, COUNT(*) as count
     51    SELECT event_action, COALESCE(SUM(occurrences), 0) as count
    5052    FROM %i
    5153    GROUP BY event_action
    … …  
    5557// Top blocked IPs
    5658$top_blocked_ips = $wpdb->get_results($wpdb->prepare("
    57     SELECT ip_address, COUNT(*) as attempts
     59    SELECT ip_address, COALESCE(SUM(occurrences), 0) as attempts
    5860    FROM %i
    5961    WHERE event_action = 'blocked'
    … …  
    7375// Recent activity (last 24 hours)
    7476$recent_activity = $wpdb->get_results($wpdb->prepare("
    75     SELECT event_type, event_action, COUNT(*) as count
     77    SELECT event_type, event_action, COALESCE(SUM(occurrences), 0) as count
    7678    FROM %i
    7779    WHERE created >= %s
    … …  
    252254            <h3><?php echo esc_html__('Daily Activity (Last 30 Days)', 'secureprolabs-guard'); ?></h3>
    253255           
    254             <div class="daily-chart">
     256            <ul class="daily-chart" role="list">
    255257                <?php
    256                 $max_count = max(array_column($daily_stats, 'count'));
     258                $max_count = max(1, (int) max(array_column($daily_stats, 'count')));
    257259                foreach (array_reverse($daily_stats) as $day):
     260                    $day_label = wp_date('M j', strtotime($day->date . ' UTC'), new DateTimeZone('UTC'));
    258261                ?>
    259                     <div class="daily-bar" style="height: <?php echo esc_attr(($day->count / $max_count) * 100); ?>%">
    260                         <span class="daily-count"><?php echo esc_html($day->count); ?></span>
    261                         <span class="daily-date"><?php echo esc_html(wp_date('M j', strtotime($day->date . ' UTC'), new DateTimeZone('UTC'))); ?></span>
    262                     </div>
     262                    <li class="daily-col">
     263                        <span class="daily-track">
     264                            <span class="daily-bar" style="height: <?php echo esc_attr(max(2, round(($day->count / $max_count) * 100))); ?>%">
     265                                <span class="daily-count"><?php echo esc_html(number_format_i18n((int) $day->count)); ?></span>
     266                            </span>
     267                        </span>
     268                        <span class="daily-date"><?php echo esc_html($day_label); ?></span>
     269                    </li>
    263270                <?php endforeach; ?>
    264             </div>
     271            </ul>
    265272        </div>
    266273    <?php endif; ?>
  • secureprolabs-guard/tags/2.4.6/includes/class-cron-security.php

    r3839918 r3841085  
    9898    private function block_cron_access() {
    9999        $ip = $this->get_client_ip();
     100        if (class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request()) {
     101            wp_die(esc_html__('Forbidden', 'secureprolabs-guard'), esc_html__('Access Denied', 'secureprolabs-guard'), array('response' => 403));
     102        }
    100103       
    101104        // Log the blocked attempt
    … …  
    103106            'Unauthorized cron access attempt from IP: ' . $ip, $ip);
    104107       
    105         // Notify admin if enabled, at most once per hour
    106         if (get_option('secureprolabs_guard_notify_admin', true) && get_option('secureprolabs_guard_notify_cron', false)
    107             && !get_transient('secureprolabs_guard_cron_mail_sent')) {
    108             set_transient('secureprolabs_guard_cron_mail_sent', 1, HOUR_IN_SECONDS);
    109             $this->notify_admin_cron_blocked($ip);
     108        $manager = SecureProLabs_Guard_Notification_Manager::instance();
     109        // High-frequency path: hand at most one event a minute to notifications; the log keeps exact counts.
     110        if ($manager && !get_transient('secureprolabs_guard_cron_notify_gate')) {
     111            set_transient('secureprolabs_guard_cron_notify_gate', 1, MINUTE_IN_SECONDS);
     112            $manager->submit('cron_blocked', SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM,
     113                __('Unauthorized wp-cron.php access blocked', 'secureprolabs-guard'), $ip);
    110114        }
    111115       
    112116        // Send 403 Forbidden
    113117        wp_die(esc_html__('Forbidden', 'secureprolabs-guard'), esc_html__('Access Denied', 'secureprolabs-guard'), array('response' => 403));
    114     }
    115    
    116     /**
    117      * Notify admin about blocked cron access
    118      */
    119     private function notify_admin_cron_blocked($ip) {
    120         $admin_email = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    121        
    122         $subject = '[SecureProLabs Guard] Cron Access Blocked';
    123         $message = sprintf(
    124             "Unauthorized wp-cron.php access blocked from IP: %s\n\n" .
    125             "Time: %s\n" .
    126             "Site: %s\n\n" .
    127             "You can configure authorized IPs in the SecureProLabs Guard settings.",
    128             $ip,
    129             current_time('mysql'),
    130             get_site_url()
    131         );
    132        
    133         wp_mail(
    134             $admin_email,
    135             $subject,
    136             $message,
    137             array('Content-Type: text/plain; charset=UTF-8')
    138         );
    139118    }
    140119   
  • secureprolabs-guard/tags/2.4.6/includes/class-lockout-manager.php

    r3839918 r3841085  
    144144        }
    145145
    146         if ($result !== false && $duration > 0 && $failure_count >= 3) {
    147             $this->notifier->notify_admin_lockout($ip, $event_type, $failure_count);
     146        if ($result === false) {
     147            $this->notifier->notify_enforcement_failure($event_type);
     148        } elseif ($duration > 0 && $failure_count >= 3) {
     149            $permanent = $failure_count > 5 && $duration === (int) $settings['permanent'];
     150            $this->notifier->notify_admin_lockout($ip, $event_type, $failure_count, $permanent);
    148151        }
    149152
    150153        return $result === false ? null : ($duration > 0 && !$recovering);
     154    }
     155
     156    /**
     157     * Whether this IP reached a real lockout (3 or more failures) within the given number of hours.
     158     */
     159    public function had_recent_lockout($ip, $hours = 24) {
     160        global $wpdb;
     161        if (!filter_var($ip, FILTER_VALIDATE_IP)) {
     162            return false;
     163        }
     164        $since = gmdate('Y-m-d H:i:s', time() + (int) (get_option('gmt_offset') * HOUR_IN_SECONDS) - $hours * HOUR_IN_SECONDS);
     165        return (bool) $wpdb->get_var($wpdb->prepare(
     166            'SELECT id FROM %i WHERE ip_address = %s AND failure_count >= 3 AND modified >= %s LIMIT 1',
     167            $wpdb->prefix . 'secureprolabs_guard_lockouts', $ip, $since
     168        ));
    151169    }
    152170
  • secureprolabs-guard/tags/2.4.6/includes/class-logger.php

    r3839918 r3841085  
    3232            ip_address varchar(45) NOT NULL,
    3333            created datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
     34            occurrences int(10) unsigned NOT NULL DEFAULT 1,
     35            last_seen datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
    3436            PRIMARY KEY  (id),
    3537            KEY event_type (event_type),
    … …  
    6163        $details = substr($details, 0, 1000); // Reasonable limit for details
    6264       
     65        // Identical events from one IP within 60 seconds update one row with a count, so an attack
     66        // cannot grow the table one row per request. Nothing is lost: the count and last time are kept.
     67        $now = current_time('mysql');
     68        if ($ip_address !== '0.0.0.0') {
     69            $recent = $wpdb->get_var($wpdb->prepare(
     70                'SELECT id FROM %i WHERE ip_address = %s AND event_type = %s AND event_action = %s AND details = %s AND created >= %s ORDER BY id DESC LIMIT 1',
     71                $this->table_name, $ip_address, $event_type, $event_action, $details,
     72                gmdate('Y-m-d H:i:s', strtotime($now . ' UTC') - 60)
     73            ));
     74            if ($recent) {
     75                return false !== $wpdb->query($wpdb->prepare(
     76                    'UPDATE %i SET occurrences = occurrences + 1, last_seen = %s WHERE id = %d',
     77                    $this->table_name, $now, (int) $recent
     78                ));
     79            }
     80        }
     81
    6382        // Use prepared statement for security
    6483        $result = $wpdb->insert(
    … …  
    6988                'details' => $details,
    7089                'ip_address' => $ip_address,
    71                 'created' => current_time('mysql')
     90                'created' => $now,
     91                'occurrences' => 1,
     92                'last_seen' => $now,
    7293            ),
    73             array('%s', '%s', '%s', '%s', '%s')
     94            array('%s', '%s', '%s', '%s', '%s', '%d', '%s')
    7495        );
    7596       
  • secureprolabs-guard/tags/2.4.6/includes/class-login-rate-limiting.php

    r3839918 r3841085  
    4747            $this->get_user_agent(), $ip);
    4848       
     49        // An administrator signing in from an IP that was recently locked out may mean a guessed password.
     50        if ($user instanceof WP_User && user_can($user, 'manage_options') && $this->lockout_manager->had_recent_lockout($ip, 24)) {
     51            $manager = SecureProLabs_Guard_Notification_Manager::instance();
     52            if ($manager) {
     53                /* translators: %s: username. */
     54                $title = sprintf(__('Administrator "%s" signed in from an IP locked out in the last 24 hours', 'secureprolabs-guard'), $username);
     55                $manager->submit('login_after_lockout', SecureProLabs_Guard_Notification_Manager::SEV_CRITICAL, $title, $ip);
     56            }
     57        }
     58
    4959        // Clear any existing lockouts for this IP
    5060        $this->clear_lockout($ip);
  • secureprolabs-guard/tags/2.4.6/includes/class-notifier.php

    r3839918 r3841085  
    44}
    55
     6/**
     7 * Lockout notifications, routed through Smart Notifications so they are grouped and rate limited.
     8 */
    69class SecureProLabs_Guard_Notifier {
    7    
     10
    811    private $logger;
    9    
    10     public function __construct($logger) {
     12    private $manager;
     13
     14    public function __construct($logger, $manager = null) {
    1115        $this->logger = $logger;
     16        $this->manager = $manager;
    1217    }
    13    
    14     public function notify_admin_lockout($ip, $event_type, $failure_count) {
    15         if (!$this->should_notify_lockout()) {
     18
     19    /**
     20     * @param bool $permanent Whether this step reached the permanent (24 hour) lockout.
     21     */
     22    public function notify_admin_lockout($ip, $event_type, $failure_count, $permanent = false) {
     23        if (!$this->manager) {
    1624            return;
    1725        }
    18         $to = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    19         /* translators: %s: IP address. */
    20         $subject = sprintf(__('SecureProLabs Guard: Lockout triggered for IP %s', 'secureprolabs-guard'), $ip);
    21         $message = sprintf(
    22             /* translators: 1: IP address, 2: event type, 3: failure count. */
    23             __('A lockout has been triggered for IP address %1$s due to %2$s events. Failure count: %3$d', 'secureprolabs-guard'),
    24             $ip, $event_type, $failure_count
    25         );
    26        
    27         wp_mail($to, $subject, $message);
    28        
    29         $this->logger->log_event('notification', 'lockout_triggered',
    30             'Admin notified about lockout for IP: ' . $ip . ', event: ' . $event_type);
    31     }
    32    
    33     public function notify_admin_permanent_lockout($ip, $event_type) {
    34         if (!$this->should_notify_lockout()) {
     26        $category = self::category_for($event_type);
     27        if ($permanent) {
     28            /* translators: %s: event type. */
     29            $title = sprintf(__('Permanent lockout after repeated %s events', 'secureprolabs-guard'), $event_type);
     30            $this->manager->submit('permanent_lockout', SecureProLabs_Guard_Notification_Manager::SEV_HIGH, $title, $ip);
    3531            return;
    3632        }
    37         $to = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    38         /* translators: %s: IP address. */
    39         $subject = sprintf(__('SecureProLabs Guard: Permanent lockout triggered for IP %s', 'secureprolabs-guard'), $ip);
    40         $message = sprintf(
    41             /* translators: 1: IP address, 2: event type. */
    42             __('A permanent lockout has been triggered for IP address %1$s due to repeated %2$s events.', 'secureprolabs-guard'),
    43             $ip, $event_type
    44         );
    45        
    46         wp_mail($to, $subject, $message);
    47        
    48         $this->logger->log_event('notification', 'permanent_lockout_triggered',
    49             'Admin notified about permanent lockout for IP: ' . $ip . ', event: ' . $event_type);
     33        /* translators: %s: event type. */
     34        $title = sprintf(__('IP lockout for %s', 'secureprolabs-guard'), $event_type);
     35        $this->manager->submit($category, SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM, $title, $ip);
    5036    }
    5137
    52     private function should_notify_lockout() {
    53         return get_option('secureprolabs_guard_notify_admin', true) && get_option('secureprolabs_guard_notify_lockouts', true);
     38    public function notify_admin_permanent_lockout($ip, $event_type) {
     39        $this->notify_admin_lockout($ip, $event_type, 0, true);
     40    }
     41
     42    /**
     43     * Guard could not store a lockout: protection may not be enforced.
     44     */
     45    public function notify_enforcement_failure($event_type) {
     46        if ($this->manager) {
     47            /* translators: %s: event type. */
     48            $title = sprintf(__('Guard could not record a %s lockout (database write failed)', 'secureprolabs-guard'), $event_type);
     49            $this->manager->submit('guard_failure', SecureProLabs_Guard_Notification_Manager::SEV_CRITICAL, $title);
     50        }
     51    }
     52
     53    public static function category_for($event_type) {
     54        $map = array(
     55            'login_failure' => 'lockout_login',
     56            'password_reset' => 'lockout_password_reset',
     57            'xmlrpc_pingback' => 'lockout_xmlrpc',
     58            'manual_admin_lockout' => 'lockout_manual',
     59        );
     60        return $map[$event_type] ?? 'lockout_form';
    5461    }
    5562}
  • secureprolabs-guard/tags/2.4.6/includes/class-server-hardening.php

    r3839918 r3841085  
    5555    public function setup_server_hardening() {
    5656        // Remove X-Powered-By header if possible
    57         if (function_exists('header_remove')) {
     57        // Some requests (cron, background tasks) start output before init; headers can no longer change then.
     58        if (function_exists('header_remove') && !headers_sent()) {
    5859            header_remove('X-Powered-By');
    5960        }
    … …  
    161162            ? sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])) : 'Unknown';
    162163       
    163         // Log the blocked access attempt
    164         $this->logger->log_event(
    165             'server_hardening',
    166             'blocked_file_access',
    167             sprintf(
    168                 'Blocked access to sensitive file: %s from IP: %s, User Agent: %s',
    169                 sanitize_text_field($file_name),
    170                 $ip_address,
    171                 $user_agent
    172             ),
    173             $ip_address
    174         );
     164        // Log the blocked access attempt (not Guard's own Security Health checks)
     165        if (!(class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request())) {
     166            $this->logger->log_event(
     167                'server_hardening',
     168                'blocked_file_access',
     169                sprintf(
     170                    'Blocked access to sensitive file: %s from IP: %s, User Agent: %s',
     171                    sanitize_text_field($file_name),
     172                    $ip_address,
     173                    $user_agent
     174                ),
     175                $ip_address
     176            );
     177        }
    175178       
    176179        // Send 404 instead of 403 to avoid information disclosure
  • secureprolabs-guard/tags/2.4.6/includes/class-xmlrpc-security.php

    r3839918 r3841085  
    168168
    169169        $ip = $this->get_client_ip();
     170        if (class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request()) {
     171            status_header(403);
     172            exit('Forbidden');
     173        }
    170174        $this->log_event('blocked',
    171175            'XML-RPC access blocked from IP: ' . $ip, $ip);
    172176
    173         if (get_option('secureprolabs_guard_notify_admin', true) && get_option('secureprolabs_guard_notify_xmlrpc', true)
    174             && $this->reserve_event_slot('secureprolabs_guard_xmlrpc_mail_after', 15 * MINUTE_IN_SECONDS)) {
    175             $this->notify_admin_xmlrpc_blocked($ip);
     177        $manager = SecureProLabs_Guard_Notification_Manager::instance();
     178        // High-frequency path: hand at most one event a minute to notifications; the log keeps exact counts.
     179        if ($manager && $this->reserve_event_slot('secureprolabs_guard_xmlrpc_notify_after', MINUTE_IN_SECONDS)) {
     180            $manager->submit('xmlrpc_blocked', SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM,
     181                __('XML-RPC access blocked', 'secureprolabs-guard'), $ip);
    176182        }
    177183
    … …  
    194200    }
    195201   
    196     /**
    197      * Notify admin about blocked XML-RPC access
    198      */
    199     private function notify_admin_xmlrpc_blocked($ip) {
    200         $admin_email = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    201        
    202         $subject = '[SecureProLabs Guard] XML-RPC Access Blocked';
    203         $message = sprintf(
    204             "XML-RPC access blocked from IP: %s\n\n" .
    205             "Time: %s\n" .
    206             "Site: %s",
    207             $ip,
    208             current_time('mysql'),
    209             get_site_url()
    210         );
    211        
    212         wp_mail(
    213             $admin_email,
    214             $subject,
    215             $message,
    216             array('Content-Type: text/plain; charset=UTF-8')
    217         );
    218     }
    219    
    220202    private function log_event($action, $details, $ip) {
     203        // Guard's own Security Health probe is never logged; real requests are logged as before.
     204        if (class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request()) {
     205            return;
     206        }
    221207        if ($this->reserve_event_slot('secureprolabs_guard_xmlrpc_log_after', MINUTE_IN_SECONDS)) {
    222208            $this->logger->log_event('xmlrpc_security', $action, $details, $ip);
  • secureprolabs-guard/tags/2.4.6/readme.txt

    r3839918 r3841085  
    11=== SecureProLabs Guard ===
    22Contributors: secureprolabs
    3 Tags: security, brute force, login security, rate limiting, hardening
     3Tags: security, brute force, login security, rate limiting, xml-rpc
    44Requires at least: 7.0
    55Tested up to: 7.1
    66Requires PHP: 8.2
    7 Stable tag: 2.4.5
     7Stable tag: 2.4.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1010
    11 Intelligent WordPress security and hardening with brute force protection, rate limiting, security headers and activity monitoring.
     11Login lockouts, brute force protection, form rate limiting, security headers and hardening for single-site WordPress.
    1212
    1313== Description ==
    1414
    15 **Protection with intelligence.**
     15SecureProLabs Guard is SecureProLabs’s free security plugin for single-site WordPress installations. Configure rate limits for login attempts, password resets and supported forms. Review lockouts, view security events and export logs as CSV from WordPress Admin.
    1616
    17 SecureProLabs Guard is SecureProLabs's free WordPress security and hardening plugin for single-site installations. Configure protection controls, review lockouts and security activity, and export event logs from WordPress Admin.
    18 
    19 = Core Security Features =
    20 
    21 * **Brute Force Protection:** Configure login rate limits and progressive lockouts based on the detected client IP address.
    22 * **Password Reset Protection:** Limit repeated password reset requests with optional IP-based lockouts.
    23 * **Form Protection:** Apply fixed, non-escalating submission limits to supported forms and registration requests.
    24 * **REST API Security:** Restrict access to the users collection and require a logged in user for single user requests by ID. Other routes retain their own WordPress permissions.
    25 * **XML-RPC Protection:** Restrict selected methods and pingbacks, or optionally block XML-RPC entirely.
    26 * **WP-Cron Protection:** Require a configured request header credential or an explicitly allowlisted IP address for WP-Cron HTTP requests when the control is enabled.
    27 * **Security Headers:** Configure HTTP security headers, with optional HSTS subdomain coverage.
    28 * **Server Hardening:** Apply basic server hardening controls. Files existing on disk are served by the web server.
    29 * **Security Activity Monitoring:** Review security events, manage lockouts and export logs as CSV from WordPress Admin.
    30 * **Security Notifications:** Enable configurable email notifications for security events.
    31 * **Cloudflare and Proxy Support:** Configure client IP detection through Cloudflare or explicitly trusted reverse proxies.
    32 * **Automatic Log Retention:** Delete older logs through a daily task using a configurable retention period, or choose "Never delete" to keep them.
    33 
    34 On a new installation, login protection and security event logging are enabled. Optional password-reset, Cron, REST API, XML-RPC, form, registration, server-hardening and security-header restrictions start disabled. Administrator email notifications remain disabled until configured. Existing installations retain their configured protections and historical defaults for missing settings. See the FAQ for lockout behavior and the different defaults applied by Reset Settings.
    35 
    36 = Privacy by Design =
    37 
    38 Security events are stored in your site's WordPress database. Logs include client IP addresses and can include usernames or user-agent strings. When enabled, email notifications send event details through your site's configured WordPress mail transport to the selected recipient, so your mail provider may receive that information.
    39 
    40 SecureProLabs Guard has no SecureProLabs telemetry, licensing connection or custom update service. See the FAQ for the full data, retention, export and uninstall disclosures.
    41 
    42 = Our Philosophy =
    43 
    44 Cybersecurity should be accessible to everyone.
    45 
    46 Our priorities are transparency, reliability and ease of use. We aim to help website owners, developers and agencies take greater control of their WordPress security through configurable protections and clear security activity information.
    47 
    48 Learn more at [SecureProLabs](https://secureprolabs.com/).
    49 
    50 = Compatibility =
    51 
    52 SecureProLabs Guard supports single-site WordPress installations. Multisite is not supported; the plugin refuses network activation and individual activation on multisite subsites.
     17Other available controls include XML-RPC method and pingback restrictions, optional full XML-RPC blocking, restrictions on the REST API users collection, WP-Cron HTTP request authentication, security headers and basic server hardening. Review the settings on staging before relying on them with a proxy, external scheduler or remote publishing workflow.
    5318
    5419Contact Form 7 6.1.2 was tested for accepted submissions, rate-limit feedback, email delivery and recovery after lockout expiry. Fluent Forms 6.2.17 was tested locally. Test your mail delivery and downstream actions on staging. Licensed Elementor Pro, payment and CRM integrations are outside these tested compatibility claims.
    55 
    56 Review the settings on staging before relying on them with a proxy, external scheduler or remote publishing workflow.
    5720
    5821== Installation ==
    … …  
    6528== Frequently Asked Questions ==
    6629
     30= How is the Security Health score calculated? =
     31
     32Each check has a risk weight (High 6, Medium 3, Low 1). The calculated score is the weight of verified checks divided by the weight of all checks that could be tested. Coverage is the share of applicable checks, by weight, that could be tested; checks Guard cannot prove from inside WordPress lower coverage, never the score. While a live check has observed an unresolved problem, the score is capped: Critical 49, High 74, Medium 89, each 5 lower per additional finding of that severity (never below 25, 50 and 75). A confirmed finding from an external report, entered on the VAPT Assessment tab, caps the score the same way until it is independently verified. Below 50% coverage no number is shown. A high score means the checks passed; it does not guarantee the site is secure.
     33
     34= What is the VAPT Assessment tab, and is it a penetration test? =
     35
     36No. It lists the results of Guard's own checks as findings, next to findings you copy in from an external penetration test or audit report. Guard does not scan other sites, run attacks, or certify compliance. An external finding with a report reference counts as confirmed and can limit the Security Health score until it is marked independently verified with an auditor reference. Without a reference it is shown as administrator-entered and unconfirmed, and does not affect the score. Only text is stored; there are no file uploads.
     37
     38= Does the assessment contact any outside service? =
     39
     40No. It sends requests only from your server to fixed addresses on your own site (for example the home page, /xmlrpc.php and /wp-json/wp/v2/users), when an administrator clicks Run Security Assessment. Response bodies are inspected in memory and not stored; only a one-line result per check is saved.
     41
     42= How many notification emails will I get? =
     43
     44With the default Balanced profile, at most 5 an hour and 15 a day, plus one digest. Events of the same kind are grouped into one email, and the same IP is not reported twice within the cooldown. Everything is still recorded in the security log. Choose Quiet to receive only critical alerts right away.
     45
     46= Does "submitted" mean the email was delivered? =
     47
     48No. WordPress can only confirm that it handed the email to your mail system. If notices show as submitted but never arrive, check your mail or SMTP setup and your spam folder.
     49
    6750= Which protections are enabled on a new installation? =
    6851
    … …  
    7154Existing installations retain their configured protections and historical defaults for missing settings. The lockout schedule is shared by login, reset and form controls. Review it when enabling those optional controls. Reset Settings restores the historical protection-heavy defaults, including optional restrictions; it does not restore this new-install profile.
    7255
    73 = How do I update an existing installation? =
     56= Can I update an existing private installation? =
    7457
    7558Keep the existing secureprolabs-guard plugin folder and use WordPress's in-place update or ZIP replacement workflow. Back up before updating. Use the replacement action rather than deleting the existing plugin first. Explicit uninstall removes the plugin-owned settings, Cron credential, security log table and lockout table. Updates and deactivation retain that data.
     59
     60= Can I upgrade a private version 2.1.2 installation? =
     61
     62An in-place update from private version 2.1.2 and rollback were verified on a single-site test installation. Existing settings and security records were preserved. Back up files and the database. Use WordPress's in-place replacement workflow, then verify ordinary login, reset email, XML-RPC and REST integrations, form delivery, and scheduled jobs before rolling out.
     63
     64Legacy Cron query-string credentials and implicit permission for same-server HTTP requests are no longer supported. Use the X-SecureProLabs-Guard-Cron request header with the configured key or an explicitly allowlisted IP address. Rotate any key previously embedded in a URL. If your site is behind a proxy, verify the effective client IP. Forwarded addresses are used only when the connection comes through a trusted proxy. Multisite installations are outside the supported upgrade path.
    7665
    7766= Does it support multisite? =
    … …  
    10594Use the plugin's WordPress.org support forum once the plugin is listed. Include plugin, WordPress and PHP versions and steps using test data. Keep credentials, reset links, Cron keys and private logs out of public posts.
    10695
     96== Screenshots ==
     97
     981. Security overview with synthetic activity.
     992. Settings for login, password-reset and form rate limits.
     1003. Lockouts dashboard with an active badge and expired history.
     1014. Security Logs with the administrator CSV export action.
     102
    107103== Changelog ==
     104
     105= 2.4.6 =
     106* New: Redesigned admin interface on the SecureProLabs design system: a branded application shell with flat navigation (a section menu on small screens), the Security Health dial, control cards with toggle switches and assessment status in Settings, and selectable notification profiles. Styles load only on Guard pages and are scoped to Guard's own screens.
     107* Improved: Security Health shows configuration score and verification coverage separately for each protection category, and says when a score ceiling applies but is not reducing the score.
     108* Improved: The settings save bar shows unsaved changes and a saved confirmation.
     109* New: Security Health, now the first tab. An administrator-run assessment checks 17 controls, mostly by sending requests from the server to fixed paths on its own site, and shows which are verified, misconfigured, unverified or untested.
     110* New: Security Health score with assessment coverage shown beside it. The score counts only controls a check could test, and is capped while a problem a live check observed remains unresolved. See "How is the Security Health score calculated?" below.
     111* New: VAPT Assessment tab. Guard's checks are listed as findings with separate remediation and verification states, filterable by severity, status and source. Findings from an external penetration test or audit can be added as text, with a report reference.
     112* New: Risk acceptance for open findings, recording who accepted it, why, when, and a review date (90 days by default). An accepted finding still limits the Security Health score until it is fixed and verified.
     113* New: Smart Notifications. Security events are grouped, rate limited and delivered by WP-Cron instead of inside the request that triggered them. Choose a Quiet, Balanced or Verbose profile, or set custom limits.
     114* New: Hourly and daily email limits, with part of each kept free for critical alerts.
     115* New: Daily or weekly security digest, including events that were grouped or held back by the limits.
     116* New: Critical alerts when Guard cannot record a lockout, and when an administrator signs in from an IP that was locked out in the last 24 hours. High alert for permanent lockouts and for many IPs locked out within 15 minutes.
     117* New: Notification Activity panel with submitted, grouped, suppressed and failed counts, recent notices, the last mail error, and a test notification button.
     118* New: Up to five notification recipients.
     119* Change: Identical log events from one IP within 60 seconds are stored as one row with a repeat count. Totals, statistics and CSV export include the repeats.
     120* Change: The "Login Failures" notification option now controls whether failed logins appear in the digest. Single failed logins never sent email before; the option had no effect.
     121* Fix: A "headers already sent" PHP warning on requests that start output before WordPress loads.
     122* Fix: Lockout and form limit emails had no cooldown or overall limit, so an attack from many IP addresses could send hundreds of emails a day.
    108123
    109124= 2.4.5 =
    … …  
    134149== Upgrade Notice ==
    135150
     151= 2.4.6 =
     152Adds Security Health, VAPT Assessment, Smart Notifications and a redesigned admin. Settings, logs and lockouts are kept. Security emails are now grouped and limited using the Balanced profile; review Settings > Notifications after updating.
     153
    136154= 2.4.4 =
    137155Adds Cloudflare and proxy IP detection, daily log cleanup and fairer form limits. Logs older than your retention period (30 days by default) are now deleted automatically. Choose Never delete in Settings > Advanced to keep them. Behind a proxy? Check Client IP Detection after updating.
    138156
    139157= 2.4.3 =
    140 Back up first. Replace secureprolabs-guard in place to retain settings and history.
     158Back up first. Replace secureprolabs-guard in place to retain settings and history. Upgrading from 2.1.2? Check Cron authorization and proxy IP detection on staging before updating.
  • secureprolabs-guard/tags/2.4.6/secureprolabs-guard.php

    r3839918 r3841085  
    33 * Plugin Name: SecureProLabs Guard
    44 * Description: Login lockouts, brute force protection, form rate limiting, security headers and hardening for single-site WordPress.
    5  * Version: 2.4.5
     5 * Version: 2.4.6
    66 * Requires at least: 7.0
    77 * Requires PHP: 8.2
    … …  
    4949
    5050// Define plugin constants
    51 define('SECUREPROLABS_GUARD_VERSION', '2.4.5');
     51define('SECUREPROLABS_GUARD_VERSION', '2.4.6');
     52define('SECUREPROLABS_GUARD_DB_VERSION', 3);
    5253define('SECUREPROLABS_GUARD_PLUGIN_URL', plugin_dir_url(__FILE__));
    5354define('SECUREPROLABS_GUARD_PLUGIN_DIR', plugin_dir_path(__FILE__));
    … …  
    6465require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-lockout-manager.php';
    6566require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-logger.php';
     67require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-notification-manager.php';
     68require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-security-controls.php';
     69require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-security-health.php';
     70require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-vapt.php';
    6671require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-notifier.php';
    6772require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-server-hardening.php';
    … …  
    8287    private $logger;
    8388    private $notifier;
     89    private $notification_manager;
     90    private $security_health;
     91    private $vapt;
    8492    private $server_hardening;
    8593    private $fresh_install = false;
    … …  
    160168            'secureprolabs_guard_notify_xmlrpc' => true,
    161169            'secureprolabs_guard_notify_cron' => false,
     170            'secureprolabs_guard_notify_profile' => 'balanced',
     171            'secureprolabs_guard_notify_digest' => 'daily',
    162172            'secureprolabs_guard_authorized_cron_ips' => '',
    163173            'secureprolabs_guard_log_retention' => 30,
    … …  
    272282    private function init_components() {
    273283        $this->logger = new SecureProLabs_Guard_Logger();
    274         $this->notifier = new SecureProLabs_Guard_Notifier($this->logger);
     284        $this->notification_manager = new SecureProLabs_Guard_Notification_Manager($this->logger);
     285        $this->notifier = new SecureProLabs_Guard_Notifier($this->logger, $this->notification_manager);
    275286        $this->lockout_manager = new SecureProLabs_Guard_Lockout_Manager($this->logger, $this->notifier);
    276287       
    … …  
    282293        $this->general_rate_limiting = new SecureProLabs_Guard_General_Rate_Limiting($this->logger, $this->lockout_manager);
    283294        $this->server_hardening = new SecureProLabs_Guard_Server_Hardening($this->logger);
     295        $this->security_health = new SecureProLabs_Guard_Security_Health();
     296        $this->vapt = new SecureProLabs_Guard_VAPT($this->logger);
    284297    }
    285298   
    … …  
    304317        add_filter('lost_password_html_link', array($this, 'maybe_hide_lost_password_link'));
    305318
     319        // Smart Notifications admin actions and schema upgrades.
     320        add_action('admin_post_secureprolabs_guard_test_notification', array($this, 'handle_test_notification'));
     321        add_action('init', array($this, 'maybe_upgrade'), 1);
     322
    306323        // Daily maintenance: log retention and uploads index.
    307324        add_action('secureprolabs_guard_cleanup_logs', array($this, 'run_daily_maintenance'));
    … …  
    309326    }
    310327
     328    /**
     329     * Apply schema changes once per database version. Runs early on every request but does work only after an update.
     330     */
     331    public function maybe_upgrade() {
     332        if ((int) get_option('secureprolabs_guard_db_version', 1) >= SECUREPROLABS_GUARD_DB_VERSION || !$this->logger) {
     333            return;
     334        }
     335        $this->logger->create_log_table();
     336        SecureProLabs_Guard_Notification_Manager::create_table();
     337        SecureProLabs_Guard_VAPT::create_table();
     338        // New notification settings. Existing on/off toggles are left exactly as they were.
     339        add_option('secureprolabs_guard_notify_profile', 'balanced');
     340        add_option('secureprolabs_guard_notify_digest', 'daily');
     341        // Start with empty counters so nothing recorded before Smart Notifications existed is ever emailed.
     342        if ((int) get_option('secureprolabs_guard_db_version', 1) < 2) {
     343            delete_option(SecureProLabs_Guard_Notification_Manager::STATE_OPTION);
     344        }
     345        update_option('secureprolabs_guard_db_version', SECUREPROLABS_GUARD_DB_VERSION);
     346    }
     347
     348    public function handle_test_notification() {
     349        $this->require_admin_post('secureprolabs_guard_test_notification');
     350        $result = $this->notification_manager ? $this->notification_manager->send_test() : 'failed';
     351        $map = array('sent' => 'test_sent', 'wait' => 'test_wait', 'busy' => 'test_wait', 'failed' => 'test_failed');
     352        $this->redirect_admin_action('settings', $map[$result] ?? 'test_failed', 'notifications');
     353    }
     354
    311355    public function schedule_daily_maintenance() {
    312356        if (!wp_next_scheduled('secureprolabs_guard_cleanup_logs')) {
    … …  
    320364    public function run_daily_maintenance() {
    321365        $this->delete_old_logs();
     366        if ($this->notification_manager) {
     367            $days = (int) get_option('secureprolabs_guard_log_retention', 30);
     368            $this->notification_manager->prune($days > 0 ? $days : 90);
     369        }
    322370        if (get_option('secureprolabs_guard_server_hardening', true)) {
    323371            SecureProLabs_Guard_Server_Hardening::ensure_uploads_index();
    … …  
    361409        $this->logger->create_log_table();
    362410        $this->lockout_manager->create_lockout_table();
     411        SecureProLabs_Guard_Notification_Manager::create_table();
     412        SecureProLabs_Guard_VAPT::create_table();
     413        add_option('secureprolabs_guard_notify_profile', 'balanced');
     414        add_option('secureprolabs_guard_notify_digest', 'daily');
     415        update_option('secureprolabs_guard_db_version', SECUREPROLABS_GUARD_DB_VERSION);
     416        $this->notification_manager->schedule_digest();
    363417        $this->lockout_manager->schedule_cleanup();
    364418        $this->schedule_daily_maintenance();
    … …  
    404458        wp_clear_scheduled_hook('secureprolabs_guard_cleanup_logs');
    405459        wp_clear_scheduled_hook('secureprolabs_guard_lockout_expiry_check');
     460        wp_clear_scheduled_hook(SecureProLabs_Guard_Notification_Manager::DISPATCH_HOOK);
     461        wp_clear_scheduled_hook(SecureProLabs_Guard_Notification_Manager::DIGEST_HOOK);
    406462    }
    407463   
    … …  
    417473        );
    418474       
     475        add_submenu_page(
     476            'secureprolabs-guard',
     477            __('VAPT Assessment', 'secureprolabs-guard'),
     478            __('VAPT Assessment', 'secureprolabs-guard'),
     479            'manage_options',
     480            'secureprolabs-guard-vapt',
     481            array($this, 'display_settings_page')
     482        );
     483
    419484        // Add submenu for lockout management
    420485        add_submenu_page(
    … …  
    574639            'sanitize_callback' => array($this, 'sanitize_checkbox'),
    575640            'default'           => false,
     641        ));
     642        register_setting('secureprolabs_guard_notification_settings', 'secureprolabs_guard_notify_profile', array(
     643            'type'              => 'string',
     644            'sanitize_callback' => array($this, 'sanitize_notify_profile'),
     645            'default'           => 'balanced',
     646        ));
     647        register_setting('secureprolabs_guard_notification_settings', 'secureprolabs_guard_notify_rules', array(
     648            'type'              => 'array',
     649            'sanitize_callback' => array($this, 'sanitize_notify_rules'),
     650        ));
     651        register_setting('secureprolabs_guard_notification_settings', 'secureprolabs_guard_notify_digest', array(
     652            'type'              => 'string',
     653            'sanitize_callback' => array($this, 'sanitize_notify_digest'),
     654            'default'           => 'daily',
    576655        ));
    577656        register_setting('secureprolabs_guard_advanced_settings', 'secureprolabs_guard_authorized_cron_ips', array(
    … …  
    667746    }
    668747
     748    /**
     749     * One to five comma-separated addresses. Invalid input keeps the saved value.
     750     */
    669751    public function sanitize_notification_email($value) {
    670         if (is_string($value) && is_email($value)) {
    671             return sanitize_email($value);
    672         }
    673         return get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
     752        $valid = array();
     753        foreach (explode(',', is_string($value) ? $value : '') as $email) {
     754            $email = sanitize_email(trim($email));
     755            if ($email !== '' && is_email($email)) {
     756                $valid[] = $email;
     757            }
     758        }
     759        $valid = array_slice(array_values(array_unique($valid)), 0, 5);
     760        if (!$valid) {
     761            return get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
     762        }
     763        return implode(', ', $valid);
     764    }
     765
     766    public function sanitize_notify_profile($value) {
     767        return in_array($value, array('quiet', 'balanced', 'verbose', 'custom'), true) ? $value : 'balanced';
     768    }
     769
     770    /**
     771     * Custom rules are only posted while the Custom profile is selected; otherwise keep the saved ones.
     772     */
     773    public function sanitize_notify_rules($value) {
     774        if (!is_array($value)) {
     775            $value = get_option('secureprolabs_guard_notify_rules', array());
     776        }
     777        return SecureProLabs_Guard_Notification_Manager::clean_rules($value);
     778    }
     779
     780    public function sanitize_notify_digest($value) {
     781        return in_array($value, array('daily', 'weekly', 'off'), true) ? $value : 'daily';
    674782    }
    675783
    … …  
    715823     * Enqueue admin assets (CSS/JS) and localize variables
    716824     */
     825    /**
     826     * Plugin version plus the file's modification time, so browsers pick up changed admin assets without a hard reload.
     827     */
     828    private function asset_version($path) {
     829        $mtime = @filemtime(SECUREPROLABS_GUARD_PLUGIN_DIR . $path); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- A missing file just falls back to the plugin version.
     830        return SECUREPROLABS_GUARD_VERSION . ($mtime ? '.' . $mtime : '');
     831    }
     832
    717833    public function enqueue_admin_assets($hook_suffix) {
    718834        // Only load on our plugin pages to keep admin light
    … …  
    720836            'toplevel_page_secureprolabs-guard', get_plugin_page_hookname('secureprolabs-guard-lockouts', 'secureprolabs-guard'),
    721837            get_plugin_page_hookname('secureprolabs-guard-logs', 'secureprolabs-guard'),
     838            get_plugin_page_hookname('secureprolabs-guard-vapt', 'secureprolabs-guard'),
    722839        ), true);
    723840        if (!$is_guard_page) {
    … …  
    727844        // Styles
    728845        wp_enqueue_style(
     846            'secureprolabs-design-tokens',
     847            SECUREPROLABS_GUARD_PLUGIN_URL . 'admin/css/tokens.css',
     848            array(),
     849            $this->asset_version('admin/css/tokens.css')
     850        );
     851        wp_enqueue_style(
    729852            'secureprolabs-guard-admin',
    730853            SECUREPROLABS_GUARD_PLUGIN_URL . 'admin/css/admin.css',
    731             array(),
    732             SECUREPROLABS_GUARD_VERSION
     854            array('secureprolabs-design-tokens'),
     855            $this->asset_version('admin/css/admin.css')
    733856        );
    734857
    … …  
    738861            SECUREPROLABS_GUARD_PLUGIN_URL . 'admin/js/admin.js',
    739862            array('jquery'),
    740             SECUREPROLABS_GUARD_VERSION,
     863            $this->asset_version('admin/js/admin.js'),
    741864            true
    742865        );
    … …  
    754877                'confirmDelete'  => __('Are you sure you want to delete this lockout record?', 'secureprolabs-guard'),
    755878                'confirmLockout' => __('Are you sure you want to lockout this IP address?', 'secureprolabs-guard'),
     879                /* translators: 1: check name, 2: current number, 3: total. */
     880                'healthChecking' => __('Checking %1$s (%2$d of %3$d)', 'secureprolabs-guard'),
     881                'healthSaving'   => __('Saving results…', 'secureprolabs-guard'),
     882                'healthFailed'   => __('The assessment stopped. Your previous results were kept.', 'secureprolabs-guard'),
     883                'healthRun'      => __('Run Security Assessment', 'secureprolabs-guard'),
     884                'healthRunning'  => __('Assessing…', 'secureprolabs-guard'),
     885                'healthSession'  => __('Your sign-in has expired. Reload the page, sign in again, and run the assessment.', 'secureprolabs-guard'),
    756886            ),
    757887        ));
    … …  
    9301060            'secureprolabs_guard_notify_xmlrpc' => true,
    9311061            'secureprolabs_guard_notify_cron' => false,
     1062            'secureprolabs_guard_notify_profile' => 'balanced',
     1063            'secureprolabs_guard_notify_digest' => 'daily',
    9321064            'secureprolabs_guard_authorized_cron_ips' => '',
    9331065            'secureprolabs_guard_log_retention' => 30,
    … …  
    10431175       
    10441176        // CSV headers
    1045         $this->write_csv_row($output, array('ID', 'Event Type', 'Event Action', 'Details', 'IP Address', 'Created'));
     1177        $this->write_csv_row($output, array('ID', 'Event Type', 'Event Action', 'Details', 'IP Address', 'Created', 'Occurrences', 'Last Seen'));
    10461178       
    10471179        // CSV data
    … …  
    10531185                $this->csv_text($log->details),
    10541186                $this->csv_text($log->ip_address),
    1055                 $this->csv_text($log->created)
     1187                $this->csv_text($log->created),
     1188                (int) ($log->occurrences ?? 1),
     1189                $this->csv_text($log->last_seen ?? $log->created)
    10561190            ));
    10571191        }
  • secureprolabs-guard/tags/2.4.6/uninstall.php

    r3839918 r3841085  
    3333        'secureprolabs_guard_notify_login_failures',
    3434        'secureprolabs_guard_notify_xmlrpc',
     35        'secureprolabs_guard_notify_profile',
     36        'secureprolabs_guard_notify_rules',
     37        'secureprolabs_guard_notify_digest',
     38        'secureprolabs_guard_notify_state',
     39        'secureprolabs_guard_db_version',
     40        'secureprolabs_guard_assessment',
     41        'secureprolabs_guard_assessment_run',
     42        'secureprolabs_guard_risk_acceptances',
     43        'secureprolabs_guard_xmlrpc_notify_after',
    3544        'secureprolabs_guard_password_reset_rate_limiting',
    3645        'secureprolabs_guard_rate_limit_cf7',
    … …  
    4554        'secureprolabs_guard_xmlrpc_mail_after',
    4655        'secureprolabs_guard_xmlrpc_security',
     56        'secureprolabs_guard_migration_done',
    4757    );
    4858
    … …  
    106116        }
    107117
     118        // Cron alert gate: removed directly so it also clears from a persistent object cache.
     119        delete_transient('secureprolabs_guard_cron_notify_gate');
     120
    108121        // Form limit counters are short lived transients (at most the configured window,
    109122        // 24 hours at most). With a persistent object cache they are not stored in the
    … …  
    111124        $logs_table = $wpdb->prefix . 'secureprolabs_guard_logs';
    112125        $lockouts_table = $wpdb->prefix . 'secureprolabs_guard_lockouts';
    113         $wpdb->query($wpdb->prepare('DROP TABLE IF EXISTS %i, %i', $logs_table, $lockouts_table));
     126        $notices_table = $wpdb->prefix . 'secureprolabs_guard_notices';
     127        $findings_table = $wpdb->prefix . 'secureprolabs_guard_findings';
     128        $wpdb->query($wpdb->prepare('DROP TABLE IF EXISTS %i, %i, %i, %i', $logs_table, $lockouts_table, $notices_table, $findings_table));
    114129
    115130        wp_clear_scheduled_hook('secureprolabs_guard_cleanup_logs');
    116131        wp_clear_scheduled_hook('secureprolabs_guard_lockout_expiry_check');
     132        wp_clear_scheduled_hook('secureprolabs_guard_notify_dispatch');
     133        wp_clear_scheduled_hook('secureprolabs_guard_notify_digest');
    117134    }
    118135}
  • secureprolabs-guard/trunk/admin/css/admin.css

    r3839918 r3841085  
    10971097    }
    10981098}
     1099
     1100
     1101/* Smart Notifications */
     1102.splg-profile-table { max-width: 760px; margin: 4px 0 16px; }
     1103.splg-profile-table th, .splg-profile-table td { padding: 8px 12px; }
     1104.splg-profile-table .splg-profile-active { background: #e6f6fb; font-weight: 600; }
     1105.splg-notify-custom { border: 1px solid #dcdcde; border-radius: 4px; padding: 4px 16px 0; margin: 0 0 16px; max-width: 760px; }
     1106.splg-notify-custom[disabled] { opacity: .55; }
     1107.splg-notify-custom legend { padding: 0 6px; font-weight: 600; }
     1108.splg-notify-diagnostics { margin-top: 24px; padding-top: 8px; border-top: 1px solid #dcdcde; }
     1109.splg-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0 16px; padding: 0; list-style: none; }
     1110.splg-stat { margin: 0; padding: 12px 14px; background: #fff; border: 1px solid #dcdcde; border-radius: 6px; }
     1111.splg-stat-alert { border-color: #d63638; }
     1112.splg-stat-value { display: block; font-size: 22px; line-height: 1.3; font-weight: 600; }
     1113.splg-stat-label { display: block; color: #50575e; }
     1114.splg-stat-week { color: #787c82; }
     1115.splg-notify-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
     1116.splg-notify-meta dt { font-weight: 600; }
     1117.splg-notify-meta dd { margin: 0; }
     1118.splg-mail-error { color: #b32d2e; }
     1119.splg-sev { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #f0f0f1; }
     1120.splg-sev-4 { background: #fcf0f1; color: #8a2424; }
     1121.splg-sev-3 { background: #fcf2e8; color: #8a4b0f; }
     1122.splg-sev-2 { background: #fcf9e8; color: #6b5300; }
     1123.splg-test-notification { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
     1124.log-occurrences { margin-left: 10px; color: #50575e; }
     1125@media (max-width: 782px) {
     1126    .splg-notify-meta { grid-template-columns: 1fr; }
     1127    .splg-profile-table { font-size: 13px; }
     1128}
     1129
     1130/* Inside the SecureProLabs application shell the old white tab panel is not used. */
     1131.spl-app .tab-content { background: transparent; border: 0; padding: 0; min-height: 0; }
     1132body.splg-has-unsaved-changes .spl-nav a:not([aria-current="page"]) { opacity: .6; }
     1133body.splg-has-unsaved-changes .spl-nav a:not([aria-current="page"])::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--spl-warning); margin-left: 6px; }
     1134
     1135/* Security Health: dark theme scoped to this dashboard only */
     1136.splg-health {
     1137    /* Local names kept for existing rules; every value comes from the SecureProLabs tokens. */
     1138    --splg-bg: var(--spl-bg); --splg-card: var(--spl-surface); --splg-line: var(--spl-border); --splg-text: var(--spl-text); --splg-muted: var(--spl-text-2);
     1139    --splg-cyan: var(--spl-cyan); --splg-amber: var(--spl-warning); --splg-red: var(--spl-critical); --splg-green: var(--spl-success); --splg-tone: var(--spl-neutral);
     1140    background: transparent; color: var(--spl-text);
     1141}
     1142.splg-health[data-tone="good"] { --splg-tone: var(--splg-cyan); }
     1143.splg-health[data-tone="warn"] { --splg-tone: var(--splg-amber); }
     1144.splg-health[data-tone="bad"] { --splg-tone: var(--splg-red); }
     1145.splg-health a { color: var(--splg-cyan); }
     1146.splg-health a:focus { outline: 2px solid var(--splg-cyan); outline-offset: 2px; box-shadow: none; }
     1147.splg-health h2, .splg-health h3 { color: var(--splg-text); }
     1148.splg-health-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
     1149.splg-health-title { font-size: 24px; margin: 0 0 4px; }
     1150.splg-health-sub, .splg-health-when { margin: 2px 0; color: var(--splg-muted); }
     1151.splg-muted { color: var(--splg-muted); }
     1152.splg-btn-primary { background: var(--splg-cyan); color: var(--spl-on-cyan); border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; font-size: 14px; }
     1153.splg-btn-primary:hover { filter: brightness(1.08); }
     1154.splg-btn-primary:focus-visible { outline: 2px solid var(--spl-cyan); outline-offset: 2px; }
     1155.splg-btn-primary[disabled] { opacity: .7; cursor: progress; }
     1156.splg-card { background: var(--splg-card); border: 1px solid var(--splg-line); border-radius: 10px; padding: 20px; }
     1157.splg-health-top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
     1158.splg-health-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
     1159.splg-dial-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
     1160.splg-dial { width: 100%; max-width: 280px; height: auto; }
     1161.splg-dial-ticks line { stroke: var(--spl-border); stroke-width: 1.5; }
     1162.splg-dial-track { fill: none; stroke: var(--spl-elevated); stroke-width: 14; }
     1163.splg-dial-arc { fill: none; stroke: var(--splg-tone); stroke-width: 14; stroke-linecap: round; stroke-dasharray: var(--splg-score) 100; animation: splg-dial-in .9s ease-out both; }
     1164@keyframes splg-dial-in { from { stroke-dasharray: 0 100; } }
     1165.splg-dial-num { fill: var(--splg-text); font-size: 64px; font-weight: 700; }
     1166.splg-dial-of { fill: var(--splg-muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
     1167.splg-dial-class { fill: var(--splg-tone); font-size: 17px; font-weight: 600; }
     1168.splg-dial-empty { font-size: 19px; }
     1169.splg-dial-notes { width: 100%; }
     1170.splg-dial-calc { margin: 8px 0; color: var(--splg-muted); }
     1171.splg-restriction { text-align: left; border: 1px solid var(--splg-line); border-left: 3px solid var(--splg-tone); border-radius: 0; padding: 10px 14px; margin: 10px 0; background: var(--spl-bg); }
     1172.splg-restriction p, .splg-restriction ul { margin: 4px 0; }
     1173.splg-restriction ul { padding-left: 0; list-style: none; }
     1174.splg-disclaimer { font-size: 12px; color: var(--splg-muted); margin: 10px 0 0; }
     1175.splg-state-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
     1176.splg-state { display: grid; grid-template-columns: 28px auto 1fr; align-items: center; column-gap: 10px; margin: 0; }
     1177.splg-state .dashicons { font-size: 22px; width: 22px; height: 22px; }
     1178.splg-state-num { font-size: 30px; font-weight: 700; line-height: 1; }
     1179.splg-state-label { font-weight: 600; }
     1180.splg-state-help { grid-column: 2 / 4; color: var(--splg-muted); font-size: 12px; }
     1181.splg-state-verified .dashicons, .splg-state-verified .splg-state-num { color: var(--splg-green); }
     1182.splg-state-misconfigured .dashicons, .splg-state-misconfigured .splg-state-num { color: var(--splg-amber); }
     1183.splg-state-unverified .dashicons, .splg-state-unverified .splg-state-num { color: var(--spl-neutral); }
     1184.splg-state-untested .dashicons, .splg-state-untested .splg-state-num { color: var(--splg-muted); }
     1185.splg-coverage { border-top: 1px solid var(--splg-line); margin-top: 18px; padding-top: 14px; }
     1186.splg-coverage-head { display: flex; justify-content: space-between; margin: 0 0 8px; }
     1187.splg-coverage-head strong { color: var(--splg-cyan); font-size: 18px; }
     1188.splg-bar { height: 8px; background: var(--spl-elevated); border-radius: 4px; overflow: hidden; }
     1189.splg-bar-fill { display: block; height: 100%; background: var(--splg-muted); border-radius: 4px; transition: width .4s ease-out; }
     1190.splg-bar-cyan { background: var(--splg-cyan); }
     1191.splg-bar-amber { background: var(--splg-amber); }
     1192.splg-health-progress { margin: 0 0 16px; }
     1193.splg-health-progress p { margin: 6px 0 0; color: var(--splg-muted); }
     1194.splg-breakdown { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
     1195.splg-breakdown li { margin: 0; }
     1196.splg-breakdown-head { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
     1197.splg-breakdown-head span:last-child { color: var(--splg-muted); }
     1198.splg-actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
     1199.splg-actions li { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin: 0; align-items: start; }
     1200.splg-actions p { margin: 0 0 4px; }
     1201.splg-action-title { font-weight: 600; }
     1202.splg-action-links a { margin-right: 14px; }
     1203.splg-sev-pill { display: inline-block; min-width: 64px; text-align: center; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
     1204.splg-sev-pill.splg-sev-critical { color: var(--splg-red); }
     1205.splg-sev-pill.splg-sev-high { color: var(--spl-high); }
     1206.splg-sev-pill.splg-sev-medium { color: var(--splg-amber); }
     1207.splg-sev-pill.splg-sev-low { color: var(--spl-sev-low); }
     1208.splg-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; background: var(--spl-elevated); color: var(--spl-text-2); margin-left: 6px; }
     1209.splg-tag-warn { background: var(--spl-elevated); color: var(--spl-warning); }
     1210.splg-checks, .splg-method { margin-top: 16px; }
     1211.splg-checks summary, .splg-method summary { cursor: pointer; }
     1212.splg-checks summary h3 { display: inline; font-size: 15px; }
     1213.splg-method ul { margin: 10px 0 0 18px; list-style: disc; color: var(--splg-muted); }
     1214.splg-check-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
     1215.splg-check-table th, .splg-check-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--splg-line); vertical-align: top; }
     1216.splg-check-table th { color: var(--splg-muted); font-weight: 600; }
     1217.splg-check-table tr:target { background: var(--spl-elevated); }
     1218@media (max-width: 960px) {
     1219    .splg-health-top, .splg-health-bottom { grid-template-columns: minmax(0, 1fr); }
     1220}
     1221@media (max-width: 600px) {
     1222    .splg-health { padding: 14px; border-radius: 0; margin-left: -10px; margin-right: -10px; }
     1223    .splg-dial { max-width: 220px; }
     1224    .splg-state-list { grid-template-columns: 1fr 1fr; }
     1225    .splg-state-help { display: none; }
     1226    .splg-check-table thead { display: none; }
     1227    .splg-check-table td { display: block; border: 0; padding: 4px 0; }
     1228    .splg-check-table tr { display: block; border-bottom: 1px solid var(--splg-line); padding: 8px 0; }
     1229}
     1230@media (prefers-reduced-motion: reduce) {
     1231    .splg-dial-arc { animation: none; }
     1232    .splg-bar-fill { transition: none; }
     1233}
     1234.splg-breakdown-hint { margin: -6px 0 12px; font-size: 12px; }
     1235.splg-cat { display: block; width: 100%; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; margin: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; box-sizing: border-box; }
     1236.splg-cat:hover { background: var(--spl-elevated); }
     1237.splg-cat:focus-visible { outline: 2px solid var(--splg-cyan); outline-offset: 1px; }
     1238.splg-cat[aria-pressed="true"] { background: var(--spl-elevated); border-color: var(--splg-cyan); }
     1239.splg-cat .splg-breakdown-head { display: flex; }
     1240.splg-cat .splg-bar { display: block; }
     1241.splg-cat-name { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
     1242.splg-cat-score { color: var(--splg-muted); white-space: nowrap; }
     1243.splg-count { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; border: 1px solid currentColor; }
     1244.splg-count-fix { color: var(--splg-amber); }
     1245.splg-count-verify { color: var(--spl-text-2); border-color: var(--spl-control); }
     1246.splg-actions-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
     1247.splg-link-btn { background: none; border: 0; padding: 0; color: var(--splg-cyan); cursor: pointer; text-decoration: underline; font: inherit; }
     1248.splg-action-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--splg-muted); }
     1249.splg-actions li.splg-dim { opacity: .35; }
     1250.splg-snippet { background: var(--spl-bg); border: 1px solid var(--splg-line); border-radius: 6px; padding: 8px 10px; margin: 6px 0; overflow-x: auto; font-size: 12px; color: var(--spl-text); }
     1251/* Author display rules must never override the hidden attribute inside the dashboard. */
     1252.splg-health [hidden] { display: none !important; }
     1253.splg-actions li { border-radius: 8px; padding: 6px; margin: -6px; transition: background-color .3s ease-out, box-shadow .3s ease-out; }
     1254.splg-actions li.splg-flash { animation: splg-flash 1.6s ease-out 1; }
     1255.splg-actions li.splg-flash-fix { --splg-flash: rgba(251, 191, 36, .55); }
     1256.splg-actions li.splg-flash-verify { --splg-flash: rgba(34, 211, 238, .55); }
     1257@keyframes splg-flash {
     1258    0% { background-color: transparent; box-shadow: 0 0 0 0 var(--splg-flash); }
     1259    20% { background-color: var(--spl-elevated); box-shadow: 0 0 0 2px var(--splg-flash); }
     1260    100% { background-color: transparent; box-shadow: 0 0 0 0 transparent; }
     1261}
     1262@media (prefers-reduced-motion: reduce) {
     1263    .splg-actions li { transition: none; }
     1264    .splg-actions li.splg-flash { animation: none; background-color: var(--spl-elevated); box-shadow: 0 0 0 2px var(--splg-flash); }
     1265}
     1266
     1267/* VAPT Assessment */
     1268.splg-vapt-buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
     1269.splg-btn-secondary { display: inline-block; background: transparent; color: var(--splg-cyan) !important; border: 1px solid var(--splg-cyan); border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 14px; text-decoration: none; }
     1270.splg-btn-secondary:hover { background: rgba(34, 211, 238, .1); }
     1271.splg-btn-secondary:focus-visible { outline: 2px solid var(--spl-cyan); outline-offset: 2px; }
     1272.splg-sev-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; }
     1273.splg-sev-card { padding: 0; margin: 0; border-top: 3px solid var(--splg-muted); }
     1274.splg-sev-card a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; text-decoration: none; color: var(--splg-text); }
     1275.splg-health .splg-sev-card a { color: var(--splg-text); }
     1276.splg-sev-card-label { font-weight: 600; }
     1277.splg-sev-card-num { font-size: 30px; font-weight: 700; line-height: 1.2; }
     1278.splg-sev-card.splg-sev-critical { border-top-color: var(--splg-red); }
     1279.splg-sev-card.splg-sev-high { border-top-color: var(--spl-high); }
     1280.splg-sev-card.splg-sev-medium { border-top-color: var(--splg-amber); }
     1281.splg-sev-card.splg-sev-low { border-top-color: var(--spl-sev-low); }
     1282.splg-sev-pill.splg-sev-info { color: var(--splg-muted); }
     1283.splg-vapt-progress h3, .splg-findings h3 { margin-top: 0; font-size: 15px; }
     1284.splg-vapt-progress .splg-coverage-head { margin-top: 10px; }
     1285.splg-vapt-lines { margin: 14px 0 0; padding: 0; list-style: none; color: var(--splg-muted); }
     1286.splg-vapt-lines li { margin: 4px 0; }
     1287.splg-findings, .splg-ext-form { margin-top: 16px; }
     1288.splg-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 4px 0 14px; }
     1289.splg-filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--splg-muted); }
     1290.splg-health select, .splg-health input[type="text"], .splg-health input[type="date"], .splg-health textarea {
     1291    background: var(--spl-bg); color: var(--splg-text); border: 1px solid var(--spl-control); border-radius: 6px; max-width: 100%;
     1292}
     1293.splg-health input[type="date"] { color-scheme: dark; }
     1294.splg-health select:focus, .splg-health input:focus, .splg-health textarea:focus { border-color: var(--splg-cyan); box-shadow: 0 0 0 1px var(--splg-cyan); outline: none; }
     1295.splg-finding { border-top: 1px solid var(--splg-line); }
     1296.splg-finding > summary { display: grid; grid-template-columns: 84px 92px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px; cursor: pointer; list-style: none; }
     1297.splg-finding > summary::-webkit-details-marker { display: none; }
     1298.splg-finding > summary:focus-visible { outline: 2px solid var(--splg-cyan); outline-offset: 2px; }
     1299.splg-finding[open] > summary { background: var(--spl-elevated); }
     1300.splg-finding-id { font-weight: 600; font-size: 13px; line-height: 1.3; }
     1301.splg-finding-id .splg-muted { font-weight: 400; font-size: 12px; }
     1302.splg-finding-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
     1303.splg-finding-title { font-weight: 600; }
     1304.splg-finding-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
     1305.splg-finding-status .splg-tag { margin-left: 0; }
     1306.splg-status { color: var(--splg-muted); }
     1307.splg-status + .splg-status::before { content: "·"; margin-right: 6px; }
     1308.splg-ver-failed, .splg-rem-open { color: var(--spl-critical); }
     1309.splg-ver-local, .splg-ver-independent { color: var(--splg-green); }
     1310.splg-ver-pending, .splg-rem-accepted { color: var(--splg-amber); }
     1311.splg-finding-open { color: var(--splg-cyan); font-size: 13px; white-space: nowrap; }
     1312.splg-finding[open] .splg-finding-open { visibility: hidden; }
     1313.splg-finding-body { padding: 4px 4px 16px 108px; }
     1314.splg-finding-body dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; margin: 8px 0; }
     1315.splg-finding-body dt { color: var(--splg-muted); }
     1316.splg-finding-body dd { margin: 0; }
     1317.splg-finding-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-start; }
     1318.splg-inline-form { display: inline; margin: 0; }
     1319.splg-health .splg-danger { color: var(--splg-red); }
     1320.splg-accept { flex-basis: 100%; }
     1321.splg-accept > summary { cursor: pointer; color: var(--splg-cyan); }
     1322.splg-form label { display: block; font-weight: 600; margin: 10px 0 4px; }
     1323.splg-form textarea, .splg-form input[type="text"] { width: 100%; }
     1324.splg-accept .splg-form { max-width: 560px; }
     1325.splg-ext-form > summary { cursor: pointer; }
     1326.splg-ext-form > summary h3 { display: inline; font-size: 15px; }
     1327.splg-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; max-width: 900px; }
     1328.splg-form-grid p { margin: 0; }
     1329.splg-form-grid select { width: 100%; }
     1330.splg-span-2 { grid-column: 1 / -1; }
     1331.splg-span-2 .splg-btn-primary { margin: 16px 12px 0 0; }
     1332.splg-help { display: block; font-size: 12px; margin-top: 4px; }
     1333.splg-finding.splg-flash > summary { animation: splg-flash 1.6s ease-out 1; --splg-flash: var(--splg-amber); }
     1334@media screen and (max-width: 960px) {
     1335    .splg-sev-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
     1336    .splg-finding-body { padding-left: 4px; }
     1337}
     1338@media screen and (max-width: 600px) {
     1339    .splg-sev-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
     1340    .splg-finding > summary { grid-template-columns: 70px minmax(0, 1fr); }
     1341    .splg-finding > summary .splg-finding-main { grid-column: 1 / -1; }
     1342    .splg-finding-open { display: none; }
     1343    .splg-finding-body dl, .splg-form-grid { grid-template-columns: minmax(0, 1fr); }
     1344}
     1345@media (prefers-reduced-motion: reduce) {
     1346    .splg-finding.splg-flash > summary { animation: none; }
     1347}
     1348
     1349/* Stage 1 visual refinement: Security Health signature dial and breakdown */
     1350.splg-dial { max-width: 300px; }
     1351.splg-dial-ring { fill: none; stroke: var(--spl-border); stroke-width: 1; }
     1352.splg-dial-inner { stroke-opacity: .8; }
     1353.splg-dial-ticks line { stroke-linecap: round; }
     1354.splg-dial-ticks .splg-tick-minor { stroke: var(--spl-border); stroke-width: 1; }
     1355.splg-dial-ticks .splg-tick-major { stroke: var(--spl-control); stroke-width: 1.5; }
     1356.splg-dial-ticks .splg-tick-cardinal { stroke: var(--spl-text-2); stroke-width: 2; }
     1357.splg-dial-track { stroke: var(--spl-elevated); stroke-width: 10; }
     1358.splg-dial-arc { stroke-width: 10; animation-duration: var(--spl-dur-slow); animation-timing-function: var(--spl-ease); }
     1359.splg-dial-num { fill: var(--spl-text); font-family: var(--spl-font); font-size: 58px; font-weight: 600; letter-spacing: -.03em; }
     1360.splg-dial-of { fill: var(--spl-text-3); font-family: var(--spl-font); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; }
     1361.splg-dial-class { fill: var(--splg-tone); font-family: var(--spl-font); font-size: 13px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
     1362.splg-dial-empty { font-size: 15px; letter-spacing: .12em; }
     1363.splg-health[data-tone="neutral"] .splg-dial-class { fill: var(--spl-text-2); }
     1364.splg-ceiling-note { text-align: left; margin: 10px 0; padding: 10px 14px; border: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1365.splg-restriction { border-left-width: 1px; border-radius: var(--spl-radius-md); background: var(--spl-bg); }
     1366.splg-restriction > p:first-child strong { color: var(--splg-tone); }
     1367.splg-card { border-radius: var(--spl-radius-lg); }
     1368.splg-state-icon { flex: none; }
     1369.splg-state { grid-template-columns: 24px auto 1fr; }
     1370.splg-state-verified .splg-state-icon { color: var(--spl-success); }
     1371.splg-state-misconfigured .splg-state-icon { color: var(--spl-warning); }
     1372.splg-state-unverified .splg-state-icon, .splg-state-untested .splg-state-icon { color: var(--spl-neutral); }
     1373.splg-state-unverified .splg-state-num, .splg-state-untested .splg-state-num { color: var(--spl-text); }
     1374.splg-bar-green { background: var(--spl-success); }
     1375.splg-breakdown { gap: 8px; }
     1376.splg-cat { background: var(--spl-elevated); padding: 12px 14px; }
     1377.splg-cat:hover { background: #1d2c42; }
     1378.splg-cat .splg-bar { height: 6px; margin-bottom: 8px; }
     1379.splg-metric { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 5px; font-size: var(--spl-fs-sm); }
     1380.splg-metric-label { color: var(--spl-text-2); }
     1381.splg-metric-value { color: var(--spl-text); white-space: nowrap; }
     1382.splg-metric-note { display: block; color: var(--spl-warning); font-size: var(--spl-fs-xs); margin-top: 2px; }
     1383.splg-actions li { grid-template-columns: 84px minmax(0, 1fr); }
     1384.splg-actions .splg-sev-pill { margin-top: 2px; }
     1385.splg-health-title { font-size: var(--spl-fs-2xl); font-weight: var(--spl-fw-semibold); letter-spacing: -.01em; }
     1386.splg-checks summary h3, .splg-findings h3, .splg-vapt-progress h3 { font-size: var(--spl-fs-lg); font-weight: var(--spl-fw-semibold); }
     1387
     1388/* VAPT: severity cards with a coloured marker instead of a coloured top border */
     1389.splg-sev-card { border-top: 1px solid var(--spl-border); }
     1390.splg-sev-card-label { display: inline-flex; align-items: center; gap: 8px; font-weight: var(--spl-fw-regular); color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1391.splg-sev-card-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--spl-neutral); }
     1392.splg-sev-card.splg-sev-critical .splg-sev-card-label::before { background: var(--spl-sev-critical); }
     1393.splg-sev-card.splg-sev-high .splg-sev-card-label::before { background: var(--spl-sev-high); }
     1394.splg-sev-card.splg-sev-medium .splg-sev-card-label::before { background: var(--spl-sev-medium); }
     1395.splg-sev-card.splg-sev-low .splg-sev-card-label::before { background: var(--spl-sev-low); }
     1396.splg-sev-card.splg-sev-info .splg-sev-card-label::before { background: var(--spl-sev-info); }
     1397.splg-sev-card a:hover { text-decoration: none; background: var(--spl-elevated); border-radius: var(--spl-radius-lg); }
     1398.splg-sev-card-num { font-weight: var(--spl-fw-semibold); }
     1399.splg-source { display: inline-flex; align-items: center; gap: 5px; font-size: var(--spl-fs-xs); color: var(--spl-text-2); font-weight: var(--spl-fw-regular); }
     1400.splg-source-external { color: #C4B5FD; }
     1401.splg-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: var(--spl-radius-pill); background: var(--spl-elevated); }
     1402.splg-status + .splg-status::before { content: none; }
     1403.splg-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
     1404.splg-rem-mitigated, .splg-rem-na, .splg-ver-not_tested { color: var(--spl-text-2); }
     1405.splg-ver-external_required { color: var(--spl-info); }
     1406.splg-finding > summary { grid-template-columns: 96px 92px minmax(0, 1fr) auto; }
     1407.splg-finding > summary .splg-sev-pill { justify-self: start; }
     1408.splg-vapt-note { font-size: var(--spl-fs-xs); color: var(--spl-text-3); margin: 10px 0 0; }
     1409
     1410@media screen and (max-width: 600px) {
     1411    .splg-actions li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
     1412    .splg-sev-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
     1413    .splg-finding > summary { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
     1414    .splg-finding > summary .splg-finding-id { grid-column: 1; }
     1415    .splg-finding > summary .splg-sev-pill { grid-column: 2; justify-self: end; }
     1416    .splg-finding > summary .splg-finding-main { grid-column: 1 / -1; }
     1417    .splg-health-head { flex-direction: column; }
     1418    .splg-health-run, .splg-vapt-buttons { width: 100%; }
     1419    .splg-vapt-buttons > * { flex: 1 1 auto; }
     1420    .splg-filters label { flex: 1 1 140px; }
     1421    .splg-filters select { width: 100%; }
     1422}
     1423@media screen and (max-width: 600px) {
     1424    .splg-state-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
     1425    .splg-state { grid-template-columns: 20px auto; background: var(--spl-elevated); border-radius: var(--spl-radius-md); padding: 10px; row-gap: 2px; }
     1426    .splg-state-help { grid-column: 1 / -1; }
     1427    .splg-state-num { font-size: 24px; }
     1428    .splg-state-label { grid-column: 1 / -1; order: -1; font-size: var(--spl-fs-sm); }
     1429}
     1430
     1431/* ===== Stages 2 and 3: older tabs on the SecureProLabs design system (scoped to the shell) ===== */
     1432.spl-app .tab-content > div > h2:first-child, .spl-app .splg-settings > h2:first-child { margin: 0 0 20px; font-size: var(--spl-fs-2xl); font-weight: var(--spl-fw-semibold); letter-spacing: -.01em; }
     1433.spl-app .tab-content h3 { font-size: var(--spl-fs-lg); font-weight: var(--spl-fw-semibold); margin: 0 0 8px; }
     1434.spl-app .description, .spl-app .tab-content p.description { color: var(--spl-text-2); font-style: normal; }
     1435
     1436/* Module status: one compact strip */
     1437.spl-app .splg-module-status { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); padding: 14px 18px; margin: 0 0 24px; box-shadow: none; }
     1438.spl-app .splg-module-status h2 { font-size: var(--spl-fs-sm); font-weight: var(--spl-fw-semibold); color: var(--spl-text); margin: 0 0 2px; padding: 0; }
     1439.spl-app .splg-module-status .description { font-size: var(--spl-fs-xs); color: var(--spl-text-3); margin: 0 0 10px; }
     1440.spl-app .splg-module-status-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
     1441.spl-app .splg-module-status-list li { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 3px 10px; border-radius: var(--spl-radius-pill); border: 0; background: var(--spl-elevated); color: var(--spl-text-2); font-size: var(--spl-fs-xs); }
     1442.spl-app .splg-module-status-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
     1443.spl-app .splg-module-status-list li strong { color: var(--spl-text); font-weight: var(--spl-fw-semibold); }
     1444.spl-app .splg-module-status-loaded { color: var(--spl-success) !important; }
     1445.spl-app .splg-module-status-off { color: var(--spl-neutral) !important; }
     1446.spl-app .splg-module-status-attention { color: var(--spl-warning) !important; }
     1447
     1448/* Stat tiles */
     1449.spl-app .quick-stats { gap: 12px; margin: 0 0 24px; }
     1450.spl-app .stat-card { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); padding: 18px 20px; text-align: left; box-shadow: none; }
     1451.spl-app .stat-number { color: var(--spl-text); font-size: 28px; font-weight: var(--spl-fw-semibold); line-height: 1.2; }
     1452.spl-app .stat-label { color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1453
     1454/* Event lists */
     1455.spl-app .log-entry { background: var(--spl-surface); border: 1px solid var(--spl-border); border-left: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); padding: 12px 14px 12px 30px; margin: 0 0 8px; position: relative; color: var(--spl-text); }
     1456.spl-app .log-entry::before { content: ""; position: absolute; left: 13px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--spl-neutral); }
     1457.spl-app .log-entry.blocked::before { background: var(--spl-critical); }
     1458.spl-app .log-entry.failed::before, .spl-app .log-entry.rate_limited::before { background: var(--spl-high); }
     1459.spl-app .log-entry.success::before { background: var(--spl-success); }
     1460.spl-app .log-entry.info::before, .spl-app .log-entry.request::before { background: var(--spl-info); }
     1461.spl-app .log-details strong, .spl-app .log-type, .spl-app .log-type strong { color: var(--spl-text); }
     1462.spl-app .log-meta, .spl-app .log-time { color: var(--spl-text-3); font-size: var(--spl-fs-xs); }
     1463.spl-app .log-description { color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1464.spl-app .ip-address { background: var(--spl-elevated); color: var(--spl-text); border-radius: 4px; padding: 1px 6px; font-family: var(--spl-font-mono); font-size: var(--spl-fs-xs); }
     1465.spl-app .log-occurrences { color: var(--spl-text-3); }
     1466.spl-app .secureprolabs-guard-log-table th { background: transparent; }
     1467.spl-app .lockout-status { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: var(--spl-radius-pill); background: var(--spl-elevated); font-size: var(--spl-fs-xs); }
     1468.spl-app .lockout-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
     1469.spl-app .lockout-status.active { background: var(--spl-elevated); color: var(--spl-critical); }
     1470.spl-app .lockout-status.expired { background: var(--spl-elevated); color: var(--spl-success); }
     1471.spl-app .lockout-status.permanent { background: var(--spl-elevated); color: var(--spl-high); }
     1472.spl-app .tablenav { color: var(--spl-text-2); }
     1473.spl-app .tablenav .tablenav-pages a, .spl-app .tablenav-pages span.tablenav-pages-navspan { background: var(--spl-surface); border-color: var(--spl-control); color: var(--spl-text); }
     1474.spl-app .widefat td, .spl-app .widefat th { padding: 12px 14px; vertical-align: middle; }
     1475.spl-app .widefat tbody tr:hover { background: var(--spl-elevated); }
     1476.spl-app .splg-quick-actions { margin-top: 24px; }
     1477.spl-app .action-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
     1478.spl-app .button .dashicons { line-height: inherit; font-size: 16px; width: 16px; height: 16px; margin-top: -2px; vertical-align: middle; }
     1479
     1480/* Statistics charts */
     1481.spl-app .chart-container { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); box-shadow: none; }
     1482.spl-app .chart-container h3 { color: var(--spl-text); }
     1483.spl-app .chart-label { color: var(--spl-text-2); }
     1484.spl-app .chart-bar { background: var(--spl-elevated); border-radius: var(--spl-radius-pill); }
     1485.spl-app .chart-fill { background: var(--spl-cyan); border-radius: var(--spl-radius-pill); }
     1486.spl-app .chart-value { color: var(--spl-text); font-variant-numeric: tabular-nums; }
     1487.spl-app .daily-bar { background: var(--spl-cyan); border-radius: 4px 4px 0 0; }
     1488.spl-app .daily-count { color: var(--spl-on-cyan); }
     1489.spl-app .daily-date { color: var(--spl-text-3); }
     1490.spl-app .widefat td.num, .spl-app .widefat th.num { text-align: right; font-variant-numeric: tabular-nums; }
     1491
     1492/* Settings: sub-sections as a segmented control, rows as control cards */
     1493.spl-app .settings-tabs-wrapper { display: block; }
     1494.spl-app .settings-nav-tabs { display: inline-flex; flex-wrap: wrap; flex-direction: row; gap: 4px; padding: 4px; margin: 0 0 20px; width: auto; background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: 10px; }
     1495.spl-app .settings-nav-tab { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 8px 14px; min-height: 40px; width: auto; border: 0; border-radius: var(--spl-radius-md); background: transparent; color: var(--spl-text-2); text-decoration: none; box-shadow: none; }
     1496.spl-app .settings-nav-tab:hover { background: var(--spl-elevated); color: var(--spl-text); text-decoration: none; }
     1497.spl-app .settings-nav-tab.active { background: var(--spl-elevated); color: var(--spl-text); border: 0; }
     1498.spl-app .settings-nav-tab .tab-label { font-size: var(--spl-fs-sm); font-weight: var(--spl-fw-semibold); color: inherit; margin: 0; }
     1499.spl-app .settings-nav-tab .tab-desc { display: none; }
     1500.spl-app .settings-nav-tab .dashicons { font-size: 16px; width: 16px; height: 16px; color: var(--spl-cyan); margin: 0; }
     1501.spl-app .settings-content { background: transparent; border: 0; padding: 0; box-shadow: none; }
     1502.spl-app .settings-section { background: transparent; border: 0; padding: 0; }
     1503.spl-app .settings-section .description { color: var(--spl-text-2); }
     1504
     1505/* Sticky save bar with a clear saved and unsaved state */
     1506.spl-app .splg-top-save-area { position: sticky; top: 32px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 20px; padding: 12px 16px; background: var(--spl-surface); border: 1px solid var(--spl-border); border-left-width: 1px; border-radius: var(--spl-radius-lg); box-shadow: 0 8px 24px rgba(8, 15, 28, .6); }
     1507.spl-app .splg-save-wrapper { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
     1508.spl-app .splg-save-description { color: var(--spl-text-3); font-style: normal; font-size: var(--spl-fs-sm); }
     1509.spl-app .splg-save-state { order: -1; display: inline-flex; align-items: center; gap: 8px; font-size: var(--spl-fs-sm); color: var(--spl-text-2); }
     1510.spl-app .splg-save-state:empty { display: none; }
     1511.spl-app .splg-save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
     1512.spl-app .splg-save-state[data-state="unsaved"] { color: var(--spl-warning); }
     1513.spl-app .splg-save-state[data-state="saved"] { color: var(--spl-success); }
     1514.spl-app .splg-cancel-button { background: transparent !important; border-color: var(--spl-control) !important; color: var(--spl-text) !important; box-shadow: none; }
     1515.spl-app .splg-cancel-button:hover { background: var(--spl-elevated) !important; border-color: var(--spl-text-2) !important; color: var(--spl-text) !important; }
     1516.spl-app .splg-save-wrapper .button-primary { box-shadow: none; }
     1517
     1518/* Horizontal sub-tabs inside Security Features */
     1519.spl-app .splg-horizontal-tabs { display: flex; flex-wrap: wrap; gap: 2px; background: transparent; border: 0; border-bottom: 1px solid var(--spl-border); border-radius: 0; margin: 0 0 20px; padding: 0; }
     1520.spl-app .splg-tab-button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--spl-text-2); padding: 12px 12px 10px; min-height: 44px; font: inherit; cursor: pointer; }
     1521.spl-app .splg-tab-button:hover { background: transparent; color: var(--spl-text); }
     1522.spl-app .splg-tab-button.active { background: transparent; color: var(--spl-text); font-weight: var(--spl-fw-semibold); border-bottom-color: var(--spl-cyan); }
     1523.spl-app .splg-tab-pane > h3 { margin-top: 0; }
     1524
     1525/* Form rows as control cards */
     1526.spl-app .settings-content .form-table, .spl-app .settings-content .form-table > tbody { display: block; width: 100%; margin: 12px 0 20px; }
     1527.spl-app .settings-content .form-table tr { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 8px 24px; margin: 0 0 10px; padding: 16px 18px; background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: 10px; }
     1528.spl-app .settings-content .form-table th, .spl-app .settings-content .form-table td { display: block; width: auto; padding: 0; margin: 0; }
     1529.spl-app .settings-content .form-table th { font-weight: var(--spl-fw-semibold); color: var(--spl-text); line-height: 1.4; }
     1530.spl-app .settings-content .form-table th .spl-status { margin-top: 8px; }
     1531.spl-app .settings-content .form-table td label { display: inline-flex; align-items: center; color: var(--spl-text); }
     1532.spl-app .settings-content .form-table td > label + label { margin-top: 10px; }
     1533.spl-app .settings-content .form-table td .description { margin: 6px 0 0; }
     1534.spl-app .form-table tr:has(.splg-field-modified), .spl-app .form-table tr.splg-row-modified { background-color: var(--spl-surface); border-color: var(--spl-warning); }
     1535.spl-app .form-table tr:has(.splg-field-modified) th label, .spl-app .form-table tr.splg-row-modified th label,
     1536.spl-app .form-table tr:has(.splg-field-modified) th label::after, .spl-app .form-table tr.splg-row-modified th label::after { color: var(--spl-warning); }
     1537.spl-app .form-table tr:has(.splg-field-modified) .description, .spl-app .form-table tr.splg-row-modified .description { color: var(--spl-text-2); }
     1538.spl-app .form-table input.splg-field-modified:not([type="checkbox"]):not([type="radio"]), .spl-app .form-table select.splg-field-modified { background-color: var(--spl-bg); border-color: var(--spl-warning) !important; box-shadow: 0 0 0 1px var(--spl-warning); }
     1539.spl-app .form-table tr:has(.splg-field-saved), .spl-app .form-table tr.splg-row-saved { background-color: var(--spl-surface); border-color: rgba(74, 222, 128, .6); }
     1540.spl-app .form-table tr:has(.splg-field-saved) th label, .spl-app .form-table tr.splg-row-saved th label,
     1541.spl-app .form-table tr:has(.splg-field-saved) th label::after, .spl-app .form-table tr.splg-row-saved th label::after { color: var(--spl-success); }
     1542.spl-app .form-table input.splg-field-saved:not([type="checkbox"]):not([type="radio"]) { background-color: var(--spl-bg); border-color: var(--spl-success) !important; box-shadow: 0 0 0 1px var(--spl-success); }
     1543
     1544/* Evidence and helper boxes */
     1545.spl-app .splg-evidence { background: var(--spl-bg); border: 1px solid var(--spl-border); border-left: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); color: var(--spl-text-2); margin-top: 10px; }
     1546.spl-app .splg-evidence:empty { display: none; }
     1547.spl-app .splg-evidence a, .spl-app .splg-evidence .splg-evidence-inline { color: var(--spl-cyan); }
     1548.spl-app .splg-stats-info { background: var(--spl-bg); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); }
     1549.spl-app .splg-stats-info p { color: var(--spl-text-2); }
     1550
     1551/* Smart Notifications */
     1552.spl-app .splg-profile-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0 8px; padding: 0; border: 0; }
     1553.spl-app .splg-profile-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 16px 44px; border: 1px solid var(--spl-border); border-radius: 10px; background: var(--spl-surface); cursor: pointer; color: var(--spl-text); transition: border-color var(--spl-dur-fast) ease, background-color var(--spl-dur-fast) ease; }
     1554.spl-app .splg-profile-card:hover { border-color: var(--spl-control); }
     1555.spl-app .splg-profile-card input[type="radio"] { position: absolute; left: 16px; top: 17px; margin: 0; width: 18px; height: 18px; border: 2px solid var(--spl-control); background: transparent; }
     1556.spl-app .splg-profile-card input[type="radio"]:checked { border-color: var(--spl-cyan); }
     1557.spl-app .splg-profile-card input[type="radio"]:checked::before { background: var(--spl-cyan); width: 8px; height: 8px; margin: 3px; }
     1558.spl-app .splg-profile-card:has(input:checked) { border-color: var(--spl-cyan); background: var(--spl-elevated); }
     1559.spl-app .splg-profile-card:has(input:focus-visible) { box-shadow: var(--spl-focus); }
     1560.spl-app .splg-profile-name { font-weight: var(--spl-fw-semibold); }
     1561.spl-app .splg-profile-desc { color: var(--spl-text-2); font-size: var(--spl-fs-sm); }
     1562.spl-app .splg-profile-facts { color: var(--spl-text); font-size: var(--spl-fs-xs); line-height: 1.6; }
     1563.spl-app .splg-notify-custom { border: 1px solid var(--spl-border); border-radius: var(--spl-radius-lg); padding: 8px 18px 4px; margin: 16px 0; }
     1564.spl-app .splg-notify-custom legend { color: var(--spl-text); font-weight: var(--spl-fw-semibold); padding: 0 6px; }
     1565.spl-app .splg-notify-custom[disabled] { opacity: .55; }
     1566.spl-app .splg-notify-custom .form-table tr { background: transparent; border: 0; border-bottom: 1px solid var(--spl-border); border-radius: 0; padding: 12px 0; margin: 0; }
     1567.spl-app .splg-stat { background: var(--spl-surface); border: 1px solid var(--spl-border); border-radius: var(--spl-radius-md); }
     1568.spl-app .splg-stat-value { color: var(--spl-text); }
     1569.spl-app .splg-stat-alert { border-color: var(--spl-critical); }
     1570.spl-app .splg-stat-label { color: var(--spl-text-2); }
     1571.spl-app .splg-stat-week { color: var(--spl-text-3); }
     1572.spl-app .splg-mail-error { color: var(--spl-critical); }
     1573.spl-app .splg-sev { background: var(--spl-elevated); color: var(--spl-text-2); }
     1574.spl-app .splg-sev-4 { background: var(--spl-elevated); color: var(--spl-critical); }
     1575.spl-app .splg-sev-3 { background: var(--spl-elevated); color: var(--spl-high); }
     1576.spl-app .splg-sev-2 { background: var(--spl-elevated); color: var(--spl-warning); }
     1577
     1578/* Unsaved-changes dialog */
     1579.splg-dialog-overlay { background: rgba(8, 15, 28, .8); }
     1580.splg-dialog-content { background: #101B2B; color: #F8FAFC; border: 1px solid #263449; border-radius: 12px; box-shadow: 0 24px 48px rgba(0, 0, 0, .5); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
     1581.splg-dialog-header h3, .splg-dialog-header .dashicons { color: #FBBF24; }
     1582.splg-dialog-body p { color: #94A3B8; }
     1583.splg-dialog-body strong { color: #F8FAFC; }
     1584.splg-modified-fields-preview { background: #080F1C; border-color: #263449; }
     1585.splg-modified-fields-preview h4 { color: #F8FAFC; }
     1586.splg-modified-list li { color: #94A3B8; }
     1587.splg-modified-list li strong { color: #FBBF24; }
     1588.splg-dialog-actions .button { border-radius: 8px !important; min-height: 40px; }
     1589.splg-save-and-continue, .splg-save-and-continue:hover { background: #22D3EE !important; border-color: #22D3EE !important; color: #080F1C !important; }
     1590.splg-discard-and-continue, .splg-discard-and-continue:hover { background: transparent !important; border-color: #F87171 !important; color: #F87171 !important; }
     1591.splg-stay-here, .splg-stay-here:hover { background: transparent !important; border-color: #64748B !important; color: #F8FAFC !important; }
     1592
     1593@media screen and (max-width: 960px) {
     1594    .spl-app .splg-profile-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
     1595}
     1596@media screen and (max-width: 782px) {
     1597    .spl-app .splg-top-save-area { top: 46px; }
     1598    .spl-app .settings-content .form-table tr { grid-template-columns: minmax(0, 1fr); }
     1599    .spl-app .settings-nav-tabs { display: flex; }
     1600    .spl-app .settings-nav-tab { flex: 1 1 auto; justify-content: center; min-height: var(--spl-touch); }
     1601    .spl-app .splg-profile-cards { grid-template-columns: minmax(0, 1fr); }
     1602    .spl-app .widefat { display: block; overflow-x: auto; }
     1603}
     1604
     1605/* Review fixes: notices, button icons, save bar on small screens, daily chart */
     1606.spl-app .tab-content .notice.inline, .spl-app .tab-content .notice.inline p, .spl-app .tab-content .notice.inline strong { color: var(--spl-text); }
     1607.spl-app .tab-content .notice.inline p { display: block; padding-left: 18px; position: relative; font-size: var(--spl-fs-sm); line-height: 1.6; }
     1608.spl-app .tab-content .notice.inline p::before { position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; }
     1609.spl-app .tab-content .notice.inline strong { font-weight: var(--spl-fw-semibold); }
     1610.spl-app .tab-content .notice.inline a { color: var(--spl-cyan); }
     1611.spl-app .notice-warning.inline { border-color: rgba(251, 191, 36, .45); }
     1612
     1613.spl-app .action-buttons .button, .spl-app .tab-content .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; line-height: 1.2; margin: 0; }
     1614.spl-app .tab-content .button.button-small { min-height: 30px; padding: 0 10px; }
     1615.spl-app .tab-content .button .dashicons { margin: 0; width: 16px; height: 16px; font-size: 16px; line-height: 16px; vertical-align: 0; }
     1616
     1617.spl-app .daily-chart { display: flex; align-items: stretch; gap: 8px; height: 220px; margin: 12px 0 0; padding: 0; list-style: none; border: 0; }
     1618.spl-app .daily-col { flex: 1 1 0; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
     1619.spl-app .daily-track { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--spl-control); padding-top: 22px; }
     1620.spl-app .daily-bar { position: relative; display: block; width: 100%; min-height: 2px; padding: 0; background: var(--spl-cyan); border-radius: 4px 4px 0 0; }
     1621.spl-app .daily-count { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 4px; text-align: center; color: var(--spl-text); font-size: var(--spl-fs-xs); font-weight: var(--spl-fw-semibold); font-variant-numeric: tabular-nums; }
     1622.spl-app .daily-date { transform: none; text-align: center; color: var(--spl-text-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
     1623
     1624@media screen and (max-width: 782px) {
     1625    .spl-app .splg-top-save-area { flex-direction: column; align-items: stretch; }
     1626    .spl-app .splg-save-wrapper { margin-left: 0; flex-direction: column; align-items: stretch; }
     1627    .spl-app .splg-save-wrapper .button-primary, .spl-app .splg-cancel-button { width: 100%; min-height: var(--spl-touch); justify-content: center; }
     1628    .spl-app .splg-save-description { text-align: center; }
     1629    .spl-app .daily-chart { height: 180px; gap: 4px; }
     1630    .spl-app .daily-date { font-size: 10px; }
     1631}
     1632
     1633/* Badges beside text: consistent gap and vertical alignment everywhere */
     1634.spl-app .settings-content .form-table th { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 8px; align-content: flex-start; }
     1635.spl-app .settings-content .form-table th .spl-status { margin: 0; }
     1636.spl-app .spl-status, .spl-app .splg-tag, .spl-app .lockout-status { vertical-align: middle; }
     1637.spl-app .splg-health-when .splg-tag, .spl-app .splg-restriction .splg-tag { margin-left: 8px; }
     1638.spl-app .splg-check-table .splg-tag { margin-top: 6px; }
     1639.spl-app .splg-finding-status { column-gap: 8px; row-gap: 6px; }
     1640.spl-app .splg-cat-name { column-gap: 8px; row-gap: 4px; }
     1641.spl-app .spl-nav-list .spl-badge { margin-left: 2px; }
     1642
     1643/* Beta review: descriptions on their own line; login event dots */
     1644.spl-app .settings-content .form-table td .description, .spl-app .settings-content .form-table td p.description { display: block; }
     1645.spl-app .log-entry.successful_login::before, .spl-app .log-entry.allowed::before { background: var(--spl-success); }
     1646.spl-app .log-entry.failed_attempt::before, .spl-app .log-entry.failed_login::before { background: var(--spl-high); }
     1647.spl-app .log-entry.lockout::before, .spl-app .log-entry.locked::before, .spl-app .log-entry.permanent_lockout::before { background: var(--spl-critical); }
     1648.spl-app .log-entry.permanent_block_attempt::before { background: var(--spl-critical); }
     1649.spl-app .log-entry.ip_unlocked::before { background: var(--spl-success); }
     1650.spl-app input:disabled, .spl-app select:disabled, .spl-app textarea:disabled, .spl-app input[readonly] { background-color: var(--spl-elevated); color: var(--spl-text-3); border-color: var(--spl-border); box-shadow: none; opacity: 1; cursor: not-allowed; }
     1651/* Filter bars: each label beside its own field (WordPress floats .tablenav selects, which reorders them) */
     1652.spl-app .tablenav { height: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
     1653.spl-app .tablenav .actions, .spl-app .tablenav form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; float: none; padding: 0; overflow: visible; }
     1654.spl-app .tablenav select, .spl-app .tablenav input, .spl-app .tablenav .button { float: none; margin: 0; }
     1655.spl-app .tablenav label { color: var(--spl-text-2); font-size: var(--spl-fs-sm); margin-left: 4px; }
     1656.spl-app .tablenav br.clear { display: none; }
     1657@media screen and (max-width: 600px) {
     1658    .spl-app .splg-health-run .splg-btn-primary { width: 100%; }
     1659}
     1660.spl-app .splg-cat .splg-bar { background: var(--spl-border); }
     1661.spl-app .splg-sev-pill { justify-self: start; }
     1662.spl-app pre code { background: transparent; padding: 0; border-radius: 0; }
     1663.spl-app .splg-status + .splg-status::before { content: ""; margin: 0; }
     1664/* Brand focus ring on WordPress buttons and Settings sub-section tabs inside the shell */
     1665.spl-app .button:focus, .spl-app .button-primary:focus, .spl-app .button-secondary:focus, .spl-app input[type="submit"]:focus,
     1666.spl-app .settings-nav-tab:focus, .spl-app .splg-tab-button:focus-visible { box-shadow: var(--spl-focus); outline: none; }
  • secureprolabs-guard/trunk/admin/js/admin.js

    r3839918 r3841085  
    1414           
    1515            if (name && name !== '_wpnonce' && name !== '_wp_http_referer') {
    16                 if (type === 'checkbox' || type === 'radio') {
     16                if (type === 'radio') {
     17                    // Radios share one name: key each by its value so the group's choice is tracked.
     18                    data[name + '=' + $input.val()] = $input.is(':checked');
     19                } else if (type === 'checkbox') {
    1720                    data[name] = $input.is(':checked');
    1821                } else {
    … …  
    105108            // Add body class for disabled navigation styling
    106109            $('body').addClass('splg-has-unsaved-changes');
     110            $('.splg-save-state').each(function() { $(this).text($(this).data('unsaved')).attr('data-state', 'unsaved'); });
    107111        } else {
    108112            // Remove indicator from all tabs
    … …  
    114118            // Remove body class
    115119            $('body').removeClass('splg-has-unsaved-changes');
     120            $('.splg-save-state').text('').removeAttr('data-state');
    116121        }
    117122    }
    … …  
    141146    function setupTabNavigationPrevention() {
    142147        // Handle main tab navigation (Overview, Settings, Lockouts, etc.)
    143         $('.nav-tab').on('click', function(e) {
    144             if (formChanged) {
     148        $('.nav-tab, .spl-nav a').on('click', function(e) {
     149            if (formChanged && $(this).attr('aria-current') !== 'page') {
    145150                e.preventDefault();
    146151                showUnsavedChangesDialog($(this).attr('href'), 'main-tab');
    … …  
    471476                   
    472477                    if (name && name !== '_wpnonce' && name !== '_wp_http_referer' && name !== 'submit') {
    473                         if (originalData.hasOwnProperty(name)) {
    474                             if (type === 'checkbox' || type === 'radio') {
     478                        if (type === 'radio' && originalData.hasOwnProperty(name + '=' + $field.val())) {
     479                            $field.prop('checked', originalData[name + '=' + $field.val()]);
     480                        } else if (originalData.hasOwnProperty(name)) {
     481                            if (type === 'checkbox') {
    475482                                $field.prop('checked', originalData[name]);
    476483                            } else {
    … …  
    554561    });
    555562});
     563
     564
     565// Smart Notifications: enable custom rules only for the Custom profile and highlight the chosen preset.
     566jQuery(function($) {
     567    var $profile = $('input[name="secureprolabs_guard_notify_profile"]');
     568    if (!$profile.length) {
     569        return;
     570    }
     571    function sync() {
     572        var value = $profile.filter(':checked').val();
     573        $('.splg-notify-custom').prop('disabled', value !== 'custom');
     574        $('.splg-profile-table [data-profile]').removeClass('splg-profile-active');
     575        $('.splg-profile-table [data-profile="' + value + '"]').addClass('splg-profile-active');
     576    }
     577    $profile.on('change', sync);
     578    sync();
     579});
     580
     581// Security Health: run one check per request so no single request runs long.
     582jQuery(function($) {
     583    var $btn = $('#splg-health-run');
     584    if (!$btn.length) {
     585        return;
     586    }
     587    var cfg = window.SecureProLabsGuard || {};
     588    var i18n = cfg.i18n || {};
     589    var $progress = $('#splg-health-progress');
     590    var $fill = $progress.find('.splg-bar-fill');
     591    var $bar = $progress.find('.splg-bar');
     592    var $label = $('#splg-health-progress-label');
     593    var started = false;
     594
     595    function call(step, control) {
     596        return $.post(cfg.ajax_url, { action: 'secureprolabs_guard_health', nonce: cfg.nonce, step: step, control: control || '' });
     597    }
     598    function format(tpl, a, b, c) {
     599        return String(tpl || '').replace('%1$s', a).replace('%2$d', b).replace('%3$d', c);
     600    }
     601    function fail(xhr) {
     602        var msg = (xhr && xhr.responseJSON && xhr.responseJSON.data && xhr.responseJSON.data.message) || i18n.healthFailed;
     603        // WordPress answers 0 or -1 when the session expired or the page's security token is too old.
     604        if (xhr && (xhr.status === 400 || xhr.status === 403) && /^-?[01]$/.test(String(xhr.responseText || '').trim())) {
     605            msg = i18n.healthSession;
     606        }
     607        $label.text(msg);
     608        $btn.prop('disabled', false).text(i18n.healthRun);
     609        if (started) { call('cancel'); started = false; }
     610    }
     611    $btn.on('click', function() {
     612        $btn.prop('disabled', true).text(i18n.healthRunning);
     613        $progress.prop('hidden', false);
     614        call('start').done(function(res) {
     615            if (!res || !res.success) { return fail(); }
     616            started = true;
     617            var list = res.data.controls, i = 0;
     618            (function next() {
     619                if (i >= list.length) {
     620                    $label.text(i18n.healthSaving);
     621                    call('finish').done(function(r) {
     622                        if (r && r.success) { window.location.reload(); } else { fail(); }
     623                    }).fail(fail);
     624                    return;
     625                }
     626                $label.text(format(i18n.healthChecking, list[i].title, i + 1, list.length));
     627                call('check', list[i].id).done(function(r) {
     628                    if (!r || !r.success) { return fail(); }
     629                    i++;
     630                    var pct = Math.round(i / list.length * 100);
     631                    $fill.css('width', pct + '%');
     632                    $bar.attr('aria-valuenow', pct);
     633                    next();
     634                }).fail(fail);
     635            })();
     636        }).fail(fail);
     637    });
     638});
     639
     640// Security Health: select a category to list its open items; select again to go back to the top actions.
     641jQuery(function($) {
     642    var $cats = $('.splg-cat');
     643    var $items = $('#splg-action-list > li');
     644    var $reset = $('#splg-actions-reset');
     645    var $note = $('#splg-actions-filter');
     646    var $more = $('#splg-actions-more');
     647    if (!$cats.length) {
     648        return;
     649    }
     650    function showTop() {
     651        $cats.attr('aria-pressed', 'false');
     652        $items.each(function(i) { $(this).prop('hidden', i >= 5); });
     653        $reset.prop('hidden', true);
     654        $note.prop('hidden', true).text('');
     655        $more.prop('hidden', false);
     656    }
     657    $cats.on('click', function() {
     658        var $btn = $(this);
     659        if ($btn.attr('aria-pressed') === 'true') {
     660            return showTop();
     661        }
     662        var cat = $btn.data('category');
     663        $cats.attr('aria-pressed', 'false');
     664        $btn.attr('aria-pressed', 'true');
     665        var shown = 0;
     666        var $matches = $();
     667        $items.removeClass('splg-flash splg-flash-fix splg-flash-verify');
     668        $items.each(function() {
     669            var match = $(this).data('category') === cat;
     670            $(this).prop('hidden', !match);
     671            if (match) { shown++; $matches = $matches.add(this); }
     672        });
     673        if ($matches.length) {
     674            // Bring the first match into view (actions sit below the bars on narrow screens), then flash them.
     675            var first = $matches.get(0);
     676            var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
     677            var rect = first.getBoundingClientRect();
     678            if (rect.top < 0 || rect.bottom > window.innerHeight) {
     679                first.scrollIntoView({ behavior: reduce ? 'auto' : 'smooth', block: 'nearest' });
     680            }
     681            $matches.each(function() {
     682                var kind = $(this).find('.splg-action-cat').data('kind') === 'verify' ? 'splg-flash-verify' : 'splg-flash-fix';
     683                void this.offsetWidth; // restart the animation when the same category is chosen again
     684                $(this).addClass('splg-flash ' + kind);
     685            });
     686            clearTimeout($items.data('flashTimer'));
     687            $items.data('flashTimer', setTimeout(function() {
     688                $items.removeClass('splg-flash splg-flash-fix splg-flash-verify');
     689            }, reduce ? 1800 : 1700));
     690        }
     691        var name = $.trim($btn.find('.splg-cat-name').contents().first().text());
     692        $note.prop('hidden', false).text(shown ? name : name + ': ' + ($btn.closest('.splg-health').data('empty') || 'nothing open'));
     693        $reset.prop('hidden', false);
     694        $more.prop('hidden', true);
     695    });
     696    $reset.on('click', showTop);
     697    // "View details" opens the All checks panel so the target row is visible.
     698    $('.splg-health').on('click', 'a[href^="#splg-control-"]', function() {
     699        $('#splg-checks-details').prop('open', true);
     700    });
     701});
     702
     703// VAPT Assessment: open and highlight a finding linked from Security Health; confirm deletes.
     704jQuery(function($) {
     705    if (!$('.splg-vapt').length) {
     706        return;
     707    }
     708    var id = window.location.hash.replace(/^#/, '');
     709    if (/^finding-(SPL|EXT)-\d+$/.test(id)) {
     710        var el = document.getElementById(id);
     711        if (el) {
     712            el.open = true;
     713            el.scrollIntoView({ block: 'center', behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' });
     714            $(el).addClass('splg-flash');
     715            window.setTimeout(function() { $(el).removeClass('splg-flash'); }, 1700);
     716        }
     717    }
     718    $('.splg-delete-form').on('submit', function(e) {
     719        if (!window.confirm($(this).data('confirm'))) {
     720            e.preventDefault();
     721        }
     722    });
     723});
     724
     725// SecureProLabs shell: switch semantics for settings checkboxes, and a saved confirmation in the save bar.
     726jQuery(function($) {
     727    var $app = $('.spl-app');
     728    if (!$app.length) {
     729        return;
     730    }
     731    $app.find('.form-table input[type="checkbox"]').attr('role', 'switch');
     732    if (/[?&]settings-updated=true/.test(window.location.search)) {
     733        $('.splg-save-state').each(function() { $(this).text($(this).data('saved')).attr('data-state', 'saved'); });
     734    }
     735});
  • secureprolabs-guard/trunk/admin/partials/admin-tabs.php

    r3839918 r3841085  
    99    exit;
    1010}
     11
     12// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    1113
    1214// Verify user permissions
    … …  
    2628$active_tab = $this->request_text($_GET, 'tab'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    2729$current_page_slug = $this->request_text($_GET, 'page'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    28 if (!in_array($active_tab, array('overview', 'settings', 'lockouts', 'logs', 'statistics'), true)) {
    29     $active_tab = array('secureprolabs-guard-lockouts' => 'lockouts', 'secureprolabs-guard-logs' => 'logs')[$current_page_slug] ?? 'overview';
     30if (!in_array($active_tab, array('health', 'vapt', 'overview', 'settings', 'lockouts', 'logs', 'statistics'), true)) {
     31    $active_tab = array('secureprolabs-guard-lockouts' => 'lockouts', 'secureprolabs-guard-logs' => 'logs', 'secureprolabs-guard-vapt' => 'vapt')[$current_page_slug] ?? 'health';
    3032}
    3133$notice = $this->request_text($_GET, 'splg_notice'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    … …  
    4345    'lockout_deleted' => array('success', __('Lockout record deleted.', 'secureprolabs-guard')),
    4446    'lockout_change_failed' => array('error', __('No matching lockout changed. Refresh the list and try again.', 'secureprolabs-guard')),
     47    'test_sent' => array('success', __('Test notification submitted to your mail system. Check the inbox, including spam.', 'secureprolabs-guard')),
     48    'test_wait' => array('info', __('A test was sent less than a minute ago. Please wait a moment.', 'secureprolabs-guard')),
     49    'vapt_added' => array('success', __('External finding added.', 'secureprolabs-guard')),
     50    'vapt_saved' => array('success', __('Finding updated.', 'secureprolabs-guard')),
     51    'vapt_deleted' => array('success', __('External finding deleted.', 'secureprolabs-guard')),
     52    'vapt_accepted' => array('success', __('Risk acceptance recorded. The finding still limits the Security Health score until it is fixed and verified.', 'secureprolabs-guard')),
     53    'vapt_revoked' => array('success', __('Risk acceptance removed.', 'secureprolabs-guard')),
     54    'vapt_invalid' => array('error', __('The finding was not saved. A title and a valid severity, status, related check and date are required.', 'secureprolabs-guard')),
     55    'vapt_auditor' => array('error', __('Independently verified needs the auditor reference, for example the retest report number.', 'secureprolabs-guard')),
     56    'vapt_justify' => array('error', __('Add a justification of at least 10 characters to accept a risk.', 'secureprolabs-guard')),
     57    'vapt_review_date' => array('error', __('Choose a review date in the future, at most one year away.', 'secureprolabs-guard')),
     58    'vapt_not_open' => array('error', __('Only an open finding can be accepted as a risk.', 'secureprolabs-guard')),
     59    'vapt_missing' => array('error', __('That finding no longer exists. Refresh the list.', 'secureprolabs-guard')),
     60    'vapt_failed' => array('error', __('The finding could not be saved. Try again.', 'secureprolabs-guard')),
     61    'test_failed' => array('error', __('WordPress could not submit the test email. See the last mail error under Notification Activity.', 'secureprolabs-guard')),
    4562);
    4663?>
    4764
    48 <div class="wrap">
    49     <h1><?php echo esc_html__('SecureProLabs Guard Dashboard', 'secureprolabs-guard'); ?></h1>
     65<?php
     66$splg_sections = array(
     67    'health' => __('Security Health', 'secureprolabs-guard'),
     68    'vapt' => __('VAPT Assessment', 'secureprolabs-guard'),
     69    'overview' => __('Overview', 'secureprolabs-guard'),
     70    'settings' => __('Settings', 'secureprolabs-guard'),
     71    'lockouts' => __('Lockouts', 'secureprolabs-guard'),
     72    'logs' => __('Security Logs', 'secureprolabs-guard'),
     73    'statistics' => __('Statistics', 'secureprolabs-guard'),
     74);
     75$splg_section_url = static function ($tab) {
     76    return admin_url('admin.php?page=secureprolabs-guard&tab=' . $tab);
     77};
     78?>
     79<div class="wrap splg-wrap">
     80    <?php // WordPress places its own and other plugins' notices here, outside the dark application shell. ?>
     81    <hr class="wp-header-end" />
    5082
    51     <?php if (isset($notices[$notice])): ?>
    52         <div class="notice notice-<?php echo esc_attr($notices[$notice][0]); ?> is-dismissible">
    53             <p><?php echo esc_html($notices[$notice][1]); ?></p>
    54         </div>
    55     <?php endif; ?>
    56     <?php require SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/module-status.php'; ?>
    57    
    58     <!-- Tab Navigation -->
    59     <nav class="nav-tab-wrapper wp-clearfix">
    60         <a href="?page=secureprolabs-guard&tab=overview" class="nav-tab <?php echo esc_attr($active_tab === 'overview' ? 'nav-tab-active' : ''); ?>">
    61             <span class="dashicons dashicons-dashboard"></span> <?php echo esc_html__('Overview', 'secureprolabs-guard'); ?>
    62         </a>
    63         <a href="?page=secureprolabs-guard&tab=settings" class="nav-tab <?php echo esc_attr($active_tab === 'settings' ? 'nav-tab-active' : ''); ?>">
    64             <span class="dashicons dashicons-admin-settings"></span> <?php echo esc_html__('Settings', 'secureprolabs-guard'); ?>
    65         </a>
    66         <a href="?page=secureprolabs-guard&tab=lockouts" class="nav-tab <?php echo esc_attr($active_tab === 'lockouts' ? 'nav-tab-active' : ''); ?>">
    67             <span class="dashicons dashicons-lock"></span> <?php echo esc_html__('Lockouts', 'secureprolabs-guard'); ?>
    68             <?php if ($active_lockouts > 0): ?>
    69                 <span class="update-plugins"><span class="plugin-count"><?php echo esc_html((string) $active_lockouts); ?></span></span>
     83    <div class="spl-app" data-spl-product="guard">
     84        <header class="spl-header">
     85            <div class="spl-brand">
     86                <svg class="spl-brand-icon" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M12 3l7 3v5c0 4.5-3 8.3-7 10-4-1.7-7-5.5-7-10V6l7-3z"/><path d="M9 12l2 2 4-4"/></svg>
     87                <div>
     88                <h1 class="spl-wordmark">SecureProLabs <span>Guard</span></h1>
     89                <p class="spl-tagline"><?php echo esc_html__('Protect. Verify. Fortify.', 'secureprolabs-guard'); ?></p>
     90                </div>
     91            </div>
     92            <p class="spl-version"><?php
     93                /* translators: %s: plugin version. */
     94                echo esc_html(sprintf(__('Version %s', 'secureprolabs-guard'), SECUREPROLABS_GUARD_VERSION));
     95            ?></p>
     96        </header>
     97
     98        <nav class="spl-nav" aria-label="<?php echo esc_attr__('Guard sections', 'secureprolabs-guard'); ?>">
     99            <ul class="spl-nav-list">
     100                <?php foreach ($splg_sections as $splg_key => $splg_label): ?>
     101                    <li>
     102                        <a href="<?php echo esc_url($splg_section_url($splg_key)); ?>" <?php echo $active_tab === $splg_key ? 'aria-current="page"' : ''; ?>>
     103                            <?php echo esc_html($splg_label); ?>
     104                            <?php if ($splg_key === 'lockouts' && $active_lockouts > 0): ?>
     105                                <span class="spl-badge"><span class="screen-reader-text"><?php echo esc_html__('Active lockouts:', 'secureprolabs-guard'); ?> </span><?php echo esc_html((string) $active_lockouts); ?></span>
     106                            <?php endif; ?>
     107                        </a>
     108                    </li>
     109                    <?php if ($splg_key === 'vapt'): ?><li class="spl-nav-divider" aria-hidden="true"></li><?php endif; ?>
     110                <?php endforeach; ?>
     111            </ul>
     112            <details class="spl-nav-mobile">
     113                <summary>
     114                    <span><span class="spl-nav-label"><?php echo esc_html__('Section:', 'secureprolabs-guard'); ?></span> <?php echo esc_html($splg_sections[$active_tab] ?? $splg_sections['overview']); ?></span>
     115                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 9l6 6 6-6"></path></svg>
     116                </summary>
     117                <ul>
     118                    <?php foreach ($splg_sections as $splg_key => $splg_label): ?>
     119                        <li>
     120                            <a href="<?php echo esc_url($splg_section_url($splg_key)); ?>" <?php echo $active_tab === $splg_key ? 'aria-current="page"' : ''; ?>>
     121                                <?php echo esc_html($splg_label); ?>
     122                                <?php if ($splg_key === 'lockouts' && $active_lockouts > 0): ?>
     123                                    <span class="spl-badge"><span class="screen-reader-text"><?php echo esc_html__('Active lockouts:', 'secureprolabs-guard'); ?> </span><?php echo esc_html((string) $active_lockouts); ?></span>
     124                                <?php endif; ?>
     125                            </a>
     126                        </li>
     127                        <?php if ($splg_key === 'vapt'): ?><li class="spl-nav-sep" aria-hidden="true"></li><?php endif; ?>
     128                    <?php endforeach; ?>
     129                </ul>
     130            </details>
     131        </nav>
     132
     133        <div class="spl-main">
     134            <?php if (isset($notices[$notice])): ?>
     135                <div class="notice notice-<?php echo esc_attr($notices[$notice][0]); ?> inline is-dismissible" role="<?php echo esc_attr($notices[$notice][0] === 'error' ? 'alert' : 'status'); ?>">
     136                    <p><?php echo esc_html($notices[$notice][1]); ?></p>
     137                </div>
    70138            <?php endif; ?>
    71         </a>
    72         <a href="?page=secureprolabs-guard&tab=logs" class="nav-tab <?php echo esc_attr($active_tab === 'logs' ? 'nav-tab-active' : ''); ?>">
    73             <span class="dashicons dashicons-list-view"></span> <?php echo esc_html__('Security Logs', 'secureprolabs-guard'); ?>
    74         </a>
    75         <a href="?page=secureprolabs-guard&tab=statistics" class="nav-tab <?php echo esc_attr($active_tab === 'statistics' ? 'nav-tab-active' : ''); ?>">
    76             <span class="dashicons dashicons-chart-bar"></span> <?php echo esc_html__('Statistics', 'secureprolabs-guard'); ?>
    77         </a>
    78     </nav>
     139            <?php if (!in_array($active_tab, array('health', 'vapt'), true)) { require SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/module-status.php'; } ?>
    79140
    80141    <div class="tab-content">
    81142        <?php
    82143        switch ($active_tab) {
     144            case 'health':
     145                include_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/tab-health.php';
     146                break;
     147            case 'vapt':
     148                include_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/tab-vapt.php';
     149                break;
    83150            case 'overview':
    84151                include_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'admin/partials/tab-overview.php';
    … …  
    101168        ?>
    102169    </div>
     170        </div>
     171    </div>
    103172</div>
    104173
  • secureprolabs-guard/trunk/admin/partials/module-status.php

    r3839918 r3841085  
    33    exit;
    44}
     5
     6// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    57
    68$modules = array(
  • secureprolabs-guard/trunk/admin/partials/tab-lockouts.php

    r3839918 r3841085  
    77    exit;
    88}
     9
     10// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    911
    1012$filter_ip = $this->request_text($_GET, 'ip'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
  • secureprolabs-guard/trunk/admin/partials/tab-logs.php

    r3839918 r3841085  
    77    exit;
    88}
     9
     10// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    911
    1012$filter_type = $this->request_text($_GET, 'type', 'all'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    … …  
    3638
    3739// Get log statistics
    38 $total_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $logs_table));
    39 $today_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE DATE(created) = %s", $logs_table,
     40$total_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i", $logs_table));
     41$today_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE DATE(created) = %s", $logs_table,
    4042    current_time('Y-m-d')
    4143));
    4244
    43 $event_types = $wpdb->get_results($wpdb->prepare("SELECT event_type, COUNT(*) as count FROM %i GROUP BY event_type ORDER BY count DESC", $logs_table));
    44 $event_actions = $wpdb->get_results($wpdb->prepare("SELECT event_action, COUNT(*) as count FROM %i GROUP BY event_action ORDER BY count DESC", $logs_table));
     45$event_types = $wpdb->get_results($wpdb->prepare("SELECT event_type, COALESCE(SUM(occurrences), 0) as count FROM %i GROUP BY event_type ORDER BY count DESC", $logs_table));
     46$event_actions = $wpdb->get_results($wpdb->prepare("SELECT event_action, COALESCE(SUM(occurrences), 0) as count FROM %i GROUP BY event_action ORDER BY count DESC", $logs_table));
    4547?>
    4648
    … …  
    123125    <!-- Logs Display -->
    124126    <?php if (empty($logs)): ?>
    125         <div class="notice notice-info">
     127        <div class="notice notice-info inline">
    126128            <p><?php echo esc_html__('No security logs found.', 'secureprolabs-guard'); ?></p>
    127129        </div>
    … …  
    155157                    <div class="log-meta">
    156158                        <span class="log-time"><?php echo esc_html($log->created); ?></span>
     159                        <?php if (isset($log->occurrences) && (int) $log->occurrences > 1): ?>
     160                            <span class="log-occurrences">
     161                                <?php
     162                                /* translators: 1: number of occurrences, 2: time of the last one. */
     163                                echo esc_html(sprintf(__('Repeated %1$d times, last at %2$s', 'secureprolabs-guard'), (int) $log->occurrences, $log->last_seen));
     164                                ?>
     165                            </span>
     166                        <?php endif; ?>
    157167                    </div>
    158168                   
    … …  
    165175       
    166176        <?php if (count($logs) >= 200): ?>
    167             <div class="notice notice-info">
     177            <div class="notice notice-info inline">
    168178                <p><?php echo esc_html__('Showing the 200 most recent logs. Use filters to narrow down results.', 'secureprolabs-guard'); ?></p>
    169179            </div>
  • secureprolabs-guard/trunk/admin/partials/tab-overview.php

    r3839918 r3841085  
    33    exit;
    44}
     5
     6// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    57
    68/**
    … …  
    1921    time()
    2022));
    21 $total_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $logs_table));
    22 $today_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE DATE(created) = %s", $logs_table,
     23$total_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i", $logs_table));
     24$today_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE DATE(created) = %s", $logs_table,
    2325    current_time('Y-m-d')
    2426));
    … …  
    3133
    3234$top_blocked_ips = $wpdb->get_results($wpdb->prepare("
    33     SELECT ip_address, COUNT(*) as attempts
     35    SELECT ip_address, COALESCE(SUM(occurrences), 0) as attempts
    3436    FROM %i
    3537    WHERE event_action = 'blocked'
    … …  
    152154   
    153155    <!-- Quick Actions -->
    154     <div style="margin-top: 30px; padding: 20px; background: #f8f9fa; border-radius: 4px;">
     156    <div class="spl-panel splg-quick-actions">
    155157        <h3><?php echo esc_html__('Quick Actions', 'secureprolabs-guard'); ?></h3>
    156158        <div class="action-buttons">
  • secureprolabs-guard/trunk/admin/partials/tab-settings.php

    r3839918 r3841085  
    88}
    99
     10// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
     11
    1012$settings_subtab = $this->request_text($_GET, 'subtab', 'security-features'); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin view filter, sanitized and allowlisted; changes no data.
    1113if (!in_array($settings_subtab, array('security-features', 'lockout', 'notifications', 'advanced'), true)) {
    1214    $settings_subtab = 'security-features';
    1315}
     16
     17// Assessment status per setting, from the last Security Health run (display only).
     18$splg_health = SecureProLabs_Guard_Security_Health::summary();
     19$splg_option_controls = array();
     20foreach (SecureProLabs_Guard_Security_Controls::all() as $splg_cid => $splg_control) {
     21    // A control's options list every setting that can make its result stale; the pill belongs only on the
     22    // setting that turns the protection on (the first one, or the matching name when it has one).
     23    if (!$splg_control['options']) {
     24        continue;
     25    }
     26    $splg_main = in_array($splg_cid, $splg_control['options'], true) ? $splg_cid : $splg_control['options'][0];
     27    $splg_option_controls[$splg_main][] = $splg_cid;
     28}
     29$splg_pill = static function ($option) use ($splg_health, $splg_option_controls) {
     30    if (empty($splg_health['assessed']) || empty($splg_option_controls[$option])) {
     31        return;
     32    }
     33    // When one setting drives several checks, show the one that needs attention most.
     34    $rank = array('misconfigured' => 0, 'changed' => 1, 'untested' => 2, 'unverified' => 3, 'verified' => 4, 'na' => 5);
     35    $labels = array(
     36        'misconfigured' => __('Misconfigured', 'secureprolabs-guard'),
     37        'changed' => __('Changed since last assessment', 'secureprolabs-guard'),
     38        'untested' => __('Untested', 'secureprolabs-guard'),
     39        'unverified' => __('Unverified', 'secureprolabs-guard'),
     40        'verified' => __('Verified', 'secureprolabs-guard'),
     41        'na' => __('Not applicable', 'secureprolabs-guard'),
     42    );
     43    $worst = null;
     44    $ids = array();
     45    foreach ($splg_option_controls[$option] as $cid) {
     46        if (!isset($splg_health['controls'][$cid])) {
     47            continue;
     48        }
     49        $c = $splg_health['controls'][$cid];
     50        $state = $c['changed'] ? 'changed' : $c['state'];
     51        $ids[] = $c['finding'];
     52        if ($worst === null || $rank[$state] < $rank[$worst]) {
     53            $worst = $state;
     54        }
     55    }
     56    if ($worst === null) {
     57        return;
     58    }
     59    printf(
     60        '<span class="spl-status spl-status-%1$s" title="%2$s">%3$s</span>',
     61        esc_attr($worst),
     62        /* translators: %s: finding IDs. */
     63        esc_attr(sprintf(__('Last assessment, checks %s', 'secureprolabs-guard'), implode(', ', $ids))),
     64        esc_html($labels[$worst])
     65    );
     66};
    1467?>
    1568
    … …  
    1871   
    1972    <!-- Unsaved Changes Notice -->
    20     <div id="splg-unsaved-notice" class="notice notice-warning is-dismissible" style="display: none;">
     73    <div id="splg-unsaved-notice" class="notice notice-warning inline" style="display: none;">
    2174        <p>
    2275            <strong><?php echo esc_html__('You have unsaved changes!', 'secureprolabs-guard'); ?></strong>
    … …  
    2679   
    2780    <!-- Uninstall Warning Notice -->
    28     <div class="notice notice-warning">
     81    <div class="notice notice-warning inline">
    2982        <p><strong><?php echo esc_html__('Important:', 'secureprolabs-guard'); ?></strong>
    3083        <?php echo esc_html__('If you uninstall this plugin, all security logs and lockout data will be permanently deleted. Make sure to backup any important security data before uninstalling.', 'secureprolabs-guard'); ?>
    … …  
    74127                    <!-- Top Save Button Area -->
    75128                    <div class="splg-top-save-area">
     129                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    76130                        <div class="splg-save-wrapper">
    77131                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    91145                    <!-- Top Save Button Area -->
    92146                    <div class="splg-top-save-area">
     147                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    93148                        <div class="splg-save-wrapper">
    94149                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    108163                    <!-- Top Save Button Area -->
    109164                    <div class="splg-top-save-area">
     165                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    110166                        <div class="splg-save-wrapper">
    111167                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    125181                    <!-- Top Save Button Area -->
    126182                    <div class="splg-top-save-area">
     183                        <span class="splg-save-state" role="status" aria-live="polite" data-unsaved="<?php echo esc_attr__('Unsaved changes', 'secureprolabs-guard'); ?>" data-saved="<?php echo esc_attr__('All changes saved', 'secureprolabs-guard'); ?>"></span>
    127184                        <div class="splg-save-wrapper">
    128185                            <?php submit_button(__('Save Settings', 'secureprolabs-guard'), 'primary', 'submit', false); ?>
    … …  
    160217                                <table class="form-table">
    161218                                    <tr>
    162                                         <th scope="row"><?php echo esc_html__('WP-Cron Security', 'secureprolabs-guard'); ?></th>
     219                                        <th scope="row"><?php echo esc_html__('WP-Cron Security', 'secureprolabs-guard'); ?><?php $splg_pill('cron_security'); ?></th>
    163220                                        <td>
    164221                                            <label>
    … …  
    175232                                   
    176233                                    <tr>
    177                                         <th scope="row"><?php echo esc_html__('REST API Security', 'secureprolabs-guard'); ?></th>
     234                                        <th scope="row"><?php echo esc_html__('REST API Security', 'secureprolabs-guard'); ?><?php $splg_pill('rest_api_security'); ?></th>
    178235                                        <td>
    179236                                            <label>
    … …  
    190247                                   
    191248                                    <tr>
    192                                         <th scope="row"><?php echo esc_html__('XML-RPC Protection', 'secureprolabs-guard'); ?></th>
     249                                        <th scope="row"><?php echo esc_html__('XML-RPC Protection', 'secureprolabs-guard'); ?><?php $splg_pill('xmlrpc_security'); ?></th>
    193250                                        <td>
    194251                                            <label>
    … …  
    205262                                   
    206263                                    <tr>
    207                                         <th scope="row"><?php echo esc_html__('Block XML-RPC Completely', 'secureprolabs-guard'); ?></th>
     264                                        <th scope="row"><?php echo esc_html__('Block XML-RPC Completely', 'secureprolabs-guard'); ?><?php $splg_pill('block_xmlrpc_completely'); ?></th>
    208265                                        <td>
    209266                                            <label>
    … …  
    220277                                   
    221278                                    <tr>
    222                                         <th scope="row"><?php echo esc_html__('Block Suspicious XML-RPC Methods', 'secureprolabs-guard'); ?></th>
     279                                        <th scope="row"><?php echo esc_html__('Block Suspicious XML-RPC Methods', 'secureprolabs-guard'); ?><?php $splg_pill('block_suspicious_methods'); ?></th>
    223280                                        <td>
    224281                                            <label>
    … …  
    243300                                <table class="form-table">
    244301                                    <tr>
    245                                         <th scope="row"><?php echo esc_html__('Server Information Hiding', 'secureprolabs-guard'); ?></th>
     302                                        <th scope="row"><?php echo esc_html__('Server Information Hiding', 'secureprolabs-guard'); ?><?php $splg_pill('server_hardening'); ?></th>
    246303                                        <td>
    247304                                            <label>
    … …  
    266323                                   
    267324                                    <tr>
    268                                         <th scope="row"><?php echo esc_html__('Security Headers', 'secureprolabs-guard'); ?></th>
     325                                        <th scope="row"><?php echo esc_html__('Security Headers', 'secureprolabs-guard'); ?><?php $splg_pill('security_headers'); ?></th>
    269326                                        <td>
    270327                                            <label>
    … …  
    297354                                <table class="form-table">
    298355                                    <tr>
    299                                         <th scope="row"><?php echo esc_html__('Login Rate Limiting', 'secureprolabs-guard'); ?></th>
     356                                        <th scope="row"><?php echo esc_html__('Login Rate Limiting', 'secureprolabs-guard'); ?><?php $splg_pill('login_rate_limiting'); ?></th>
    300357                                        <td>
    301358                                            <label>
    … …  
    312369                                   
    313370                                    <tr>
    314                                         <th scope="row"><?php echo esc_html__('Password Reset Rate Limiting', 'secureprolabs-guard'); ?></th>
     371                                        <th scope="row"><?php echo esc_html__('Password Reset Rate Limiting', 'secureprolabs-guard'); ?><?php $splg_pill('password_reset_rate_limiting'); ?></th>
    315372                                        <td>
    316373                                            <label>
    … …  
    327384                                            $table_name = $wpdb->prefix . 'secureprolabs_guard_logs';
    328385                                            $one_hour_ago = get_date_from_gmt(gmdate('Y-m-d H:i:s', time() - HOUR_IN_SECONDS));
    329                                             $attempt_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE event_type = 'password_reset_rate_limiting' AND event_action = 'request' AND created >= %s", $table_name,
     386                                            $attempt_count = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE event_type = 'password_reset_rate_limiting' AND event_action = 'request' AND created >= %s", $table_name,
    330387                                                $one_hour_ago
    331388                                            ));
    … …  
    342399                                   
    343400                                    <tr>
    344                                         <th scope="row"><?php echo esc_html__('Hide Lost Password Link', 'secureprolabs-guard'); ?></th>
     401                                        <th scope="row"><?php echo esc_html__('Hide Lost Password Link', 'secureprolabs-guard'); ?><?php $splg_pill('hide_lost_password_link'); ?></th>
    345402                                        <td>
    346403                                            <label>
    … …  
    356413                                   
    357414                                    <tr>
    358                                         <th scope="row"><?php echo esc_html__('General Rate Limiting', 'secureprolabs-guard'); ?></th>
     415                                        <th scope="row"><?php echo esc_html__('General Rate Limiting', 'secureprolabs-guard'); ?><?php $splg_pill('general_rate_limiting'); ?></th>
    359416                                        <td>
    360417                                            <label>
    … …  
    370427                                    </tr>
    371428                                    <tr>
    372                                         <th scope="row"><?php echo esc_html__('Contact Form Plugins', 'secureprolabs-guard'); ?></th>
     429                                        <th scope="row"><?php echo esc_html__('Contact Form Plugins', 'secureprolabs-guard'); ?><?php $splg_pill('rate_limit_cf7'); ?></th>
    373430                                        <td>
    374431                                            <fieldset>
    … …  
    398455                                    </tr>
    399456                                    <tr>
    400                                         <th scope="row"><?php echo esc_html__('Elementor Pro Anti-Spam', 'secureprolabs-guard'); ?></th>
     457                                        <th scope="row"><?php echo esc_html__('Elementor Pro Anti-Spam', 'secureprolabs-guard'); ?><?php $splg_pill('elementor_honeypot'); ?></th>
    401458                                        <td>
    402459                                            <label>
    … …  
    554611                        <table class="form-table">
    555612                            <tr>
    556                                 <th scope="row"><?php echo esc_html__('Enable Admin Notifications', 'secureprolabs-guard'); ?></th>
     613                                <th scope="row"><?php echo esc_html__('Enable Admin Notifications', 'secureprolabs-guard'); ?><?php $splg_pill('notify_admin'); ?></th>
    557614                                <td>
    558615                                    <label>
    … …  
    570627                                <th scope="row"><?php echo esc_html__('Notification Email', 'secureprolabs-guard'); ?></th>
    571628                                <td>
    572                                     <input type="email" name="secureprolabs_guard_notify_email"
     629                                    <input type="text" name="secureprolabs_guard_notify_email"
    573630                                           value="<?php echo esc_attr(get_option('secureprolabs_guard_notify_email', get_option('admin_email'))); ?>"
    574                                            class="regular-text" />
     631                                           class="regular-text" autocomplete="email" />
    575632                                    <p class="description">
    576                                         <?php echo esc_html__('Email address to receive security notifications. Defaults to admin email.', 'secureprolabs-guard'); ?>
     633                                        <?php echo esc_html__('Up to 5 addresses, separated by commas. Each recipient counts as one email toward the limits below.', 'secureprolabs-guard'); ?>
    577634                                    </p>
    578635                                </td>
    … …  
    585642                        <table class="form-table">
    586643                            <tr>
    587                                 <th scope="row"><?php echo esc_html__('Login Failures', 'secureprolabs-guard'); ?></th>
     644                                <th scope="row"><?php echo esc_html__('Failed Logins', 'secureprolabs-guard'); ?><?php $splg_pill('notify_login_failures'); ?></th>
    588645                                <td>
    589646                                    <label>
    590647                                        <input type="checkbox" name="secureprolabs_guard_notify_login_failures" value="1"
    591648                                            <?php checked(1, get_option('secureprolabs_guard_notify_login_failures', true)); ?> />
    592                                         <?php echo esc_html__('Notify on failed login attempts', 'secureprolabs-guard'); ?>
     649                                        <?php echo esc_html__('Include failed login counts in the digest', 'secureprolabs-guard'); ?>
    593650                                    </label>
    594                                 </td>
    595                             </tr>
    596                            
    597                             <tr>
    598                                 <th scope="row"><?php echo esc_html__('IP Lockouts', 'secureprolabs-guard'); ?></th>
     651                                    <p class="description"><?php echo esc_html__('Single failed logins never send an email on their own. Lockouts are controlled below.', 'secureprolabs-guard'); ?></p>
     652                                </td>
     653                            </tr>
     654                           
     655                            <tr>
     656                                <th scope="row"><?php echo esc_html__('IP Lockouts', 'secureprolabs-guard'); ?><?php $splg_pill('notify_lockouts'); ?></th>
    599657                                <td>
    600658                                    <label>
    … …  
    607665                           
    608666                            <tr>
    609                                 <th scope="row"><?php echo esc_html__('XML-RPC Attacks', 'secureprolabs-guard'); ?></th>
     667                                <th scope="row"><?php echo esc_html__('XML-RPC Attacks', 'secureprolabs-guard'); ?><?php $splg_pill('notify_xmlrpc'); ?></th>
    610668                                <td>
    611669                                    <label>
    … …  
    618676                           
    619677                            <tr>
    620                                 <th scope="row"><?php echo esc_html__('Cron Security', 'secureprolabs-guard'); ?></th>
     678                                <th scope="row"><?php echo esc_html__('Cron Security', 'secureprolabs-guard'); ?><?php $splg_pill('notify_cron'); ?></th>
    621679                                <td>
    622680                                    <label>
    … …  
    625683                                        <?php echo esc_html__('Notify on unauthorized cron access attempts', 'secureprolabs-guard'); ?>
    626684                                    </label>
     685                                </td>
     686                            </tr>
     687                        </table>
     688
     689                        <?php
     690                        $splg_profiles = SecureProLabs_Guard_Notification_Manager::profiles();
     691                        $splg_profile = get_option('secureprolabs_guard_notify_profile', 'balanced');
     692                        $splg_custom = SecureProLabs_Guard_Notification_Manager::clean_rules(get_option('secureprolabs_guard_notify_rules', array()));
     693                        $splg_digest = get_option('secureprolabs_guard_notify_digest', 'daily');
     694                        $splg_sev = array(
     695                            SecureProLabs_Guard_Notification_Manager::SEV_CRITICAL => __('Critical only', 'secureprolabs-guard'),
     696                            SecureProLabs_Guard_Notification_Manager::SEV_HIGH => __('High and Critical', 'secureprolabs-guard'),
     697                            SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM => __('Medium, High and Critical', 'secureprolabs-guard'),
     698                        );
     699                        ?>
     700                        <h3 id="smart-notifications"><?php echo esc_html__('Smart Notifications', 'secureprolabs-guard'); ?></h3>
     701                        <p class="description"><?php echo esc_html__('Every event is always recorded in the security log. These rules only decide which events are emailed right away, which are grouped, and which wait for the digest.', 'secureprolabs-guard'); ?></p>
     702
     703                        <fieldset class="splg-profile-cards">
     704                            <legend class="screen-reader-text"><?php echo esc_html__('Notification Profile', 'secureprolabs-guard'); ?></legend>
     705                            <?php
     706                            $splg_profile_desc = array(
     707                                'quiet' => __('Critical alerts only. Everything else waits for the digest.', 'secureprolabs-guard'),
     708                                'balanced' => __('Medium events and above by email, grouped. Recommended.', 'secureprolabs-guard'),
     709                                'verbose' => __('Every Medium event and above, with short cooldowns.', 'secureprolabs-guard'),
     710                                'custom' => __('Set your own limits below.', 'secureprolabs-guard'),
     711                            );
     712                            $splg_profile_names = array(
     713                                'quiet' => __('Quiet', 'secureprolabs-guard'),
     714                                'balanced' => __('Balanced', 'secureprolabs-guard'),
     715                                'verbose' => __('Verbose', 'secureprolabs-guard'),
     716                                'custom' => __('Custom', 'secureprolabs-guard'),
     717                            );
     718                            foreach ($splg_profile_names as $splg_p => $splg_pname):
     719                                $splg_vals = $splg_p === 'custom' ? $splg_custom : $splg_profiles[$splg_p];
     720                                ?>
     721                                <label class="splg-profile-card" for="splg-notify-profile-<?php echo esc_attr($splg_p); ?>">
     722                                    <input type="radio" id="splg-notify-profile-<?php echo esc_attr($splg_p); ?>" name="secureprolabs_guard_notify_profile" value="<?php echo esc_attr($splg_p); ?>" <?php checked($splg_profile, $splg_p); ?> />
     723                                    <span class="splg-profile-name"><?php echo esc_html($splg_pname); ?></span>
     724                                    <span class="splg-profile-desc"><?php echo esc_html($splg_profile_desc[$splg_p]); ?></span>
     725                                    <span class="splg-profile-facts">
     726                                        <?php
     727                                        /* translators: 1: emails per hour, 2: emails per day. */
     728                                        echo esc_html(sprintf(__('Up to %1$d an hour, %2$d a day', 'secureprolabs-guard'), $splg_vals['hourly'], $splg_vals['daily']));
     729                                        ?><br />
     730                                        <?php
     731                                        /* translators: %d: minutes. */
     732                                        echo esc_html(sprintf(__('Same alert repeated: %d min cooldown', 'secureprolabs-guard'), $splg_vals['cooldown']));
     733                                        ?><br />
     734                                        <?php
     735                                        /* translators: %s: which severities are emailed right away. */
     736                                        echo esc_html(sprintf(__('Right away: %s', 'secureprolabs-guard'), $splg_sev[$splg_vals['immediate']] ?? ''));
     737                                        ?>
     738                                    </span>
     739                                </label>
     740                            <?php endforeach; ?>
     741                        </fieldset>
     742                        <p class="description"><?php echo esc_html__('Every profile keeps part of each limit free for critical alerts, groups repeated events, and records everything in the security log.', 'secureprolabs-guard'); ?></p>
     743
     744                        <fieldset class="splg-notify-custom" <?php disabled($splg_profile !== 'custom'); ?>>
     745                            <legend><?php echo esc_html__('Custom rules', 'secureprolabs-guard'); ?></legend>
     746                            <table class="form-table">
     747                                <tr>
     748                                    <th scope="row"><label for="splg-rule-hourly"><?php echo esc_html__('Emails per hour', 'secureprolabs-guard'); ?></label></th>
     749                                    <td><input id="splg-rule-hourly" type="number" min="1" max="60" name="secureprolabs_guard_notify_rules[hourly]" value="<?php echo esc_attr($splg_custom['hourly']); ?>" class="small-text" /></td>
     750                                </tr>
     751                                <tr>
     752                                    <th scope="row"><label for="splg-rule-daily"><?php echo esc_html__('Emails per day', 'secureprolabs-guard'); ?></label></th>
     753                                    <td><input id="splg-rule-daily" type="number" min="1" max="200" name="secureprolabs_guard_notify_rules[daily]" value="<?php echo esc_attr($splg_custom['daily']); ?>" class="small-text" /></td>
     754                                </tr>
     755                                <tr>
     756                                    <th scope="row"><label for="splg-rule-cooldown"><?php echo esc_html__('Cooldown (minutes)', 'secureprolabs-guard'); ?></label></th>
     757                                    <td><input id="splg-rule-cooldown" type="number" min="1" max="1440" name="secureprolabs_guard_notify_rules[cooldown]" value="<?php echo esc_attr($splg_custom['cooldown']); ?>" class="small-text" />
     758                                        <p class="description"><?php echo esc_html__('Events of one kind arriving during the cooldown are grouped into the next email.', 'secureprolabs-guard'); ?></p></td>
     759                                </tr>
     760                                <tr>
     761                                    <th scope="row"><label for="splg-rule-reserved"><?php echo esc_html__('Reserved for critical alerts', 'secureprolabs-guard'); ?></label></th>
     762                                    <td><input id="splg-rule-reserved" type="number" min="0" max="10" name="secureprolabs_guard_notify_rules[reserved]" value="<?php echo esc_attr($splg_custom['reserved']); ?>" class="small-text" />
     763                                        <p class="description"><?php echo esc_html__('Part of the hourly and daily limits kept free for critical alerts, so an attack cannot use it all up.', 'secureprolabs-guard'); ?></p></td>
     764                                </tr>
     765                                <tr>
     766                                    <th scope="row"><label for="splg-rule-immediate"><?php echo esc_html__('Email right away', 'secureprolabs-guard'); ?></label></th>
     767                                    <td>
     768                                        <select id="splg-rule-immediate" name="secureprolabs_guard_notify_rules[immediate]">
     769                                            <?php foreach ($splg_sev as $splg_level => $splg_text): ?>
     770                                                <option value="<?php echo esc_attr($splg_level); ?>" <?php selected($splg_custom['immediate'], $splg_level); ?>><?php echo esc_html($splg_text); ?></option>
     771                                            <?php endforeach; ?>
     772                                        </select>
     773                                    </td>
     774                                </tr>
     775                                <tr>
     776                                    <th scope="row"><?php echo esc_html__('Grouping', 'secureprolabs-guard'); ?></th>
     777                                    <td>
     778                                        <label><input type="checkbox" name="secureprolabs_guard_notify_rules[grouping]" value="1" <?php checked(1, $splg_custom['grouping']); ?> />
     779                                        <?php echo esc_html__('Group events of the same kind from different IPs into one email', 'secureprolabs-guard'); ?></label><br />
     780                                        <label><input type="checkbox" name="secureprolabs_guard_notify_rules[dedup]" value="1" <?php checked(1, $splg_custom['dedup']); ?> />
     781                                        <?php echo esc_html__('Do not alert again about the same IP during the cooldown', 'secureprolabs-guard'); ?></label>
     782                                    </td>
     783                                </tr>
     784                            </table>
     785                        </fieldset>
     786
     787                        <table class="form-table">
     788                            <tr>
     789                                <th scope="row"><label for="splg-notify-digest"><?php echo esc_html__('Security Digest', 'secureprolabs-guard'); ?></label></th>
     790                                <td>
     791                                    <select id="splg-notify-digest" name="secureprolabs_guard_notify_digest">
     792                                        <option value="daily" <?php selected($splg_digest, 'daily'); ?>><?php echo esc_html__('Daily', 'secureprolabs-guard'); ?></option>
     793                                        <option value="weekly" <?php selected($splg_digest, 'weekly'); ?>><?php echo esc_html__('Weekly (Mondays)', 'secureprolabs-guard'); ?></option>
     794                                        <option value="off" <?php selected($splg_digest, 'off'); ?>><?php echo esc_html__('Off', 'secureprolabs-guard'); ?></option>
     795                                    </select>
     796                                    <p class="description"><?php echo esc_html__('A summary of everything recorded, sent around 08:00 site time. Skipped when nothing happened. It does not count toward the limits.', 'secureprolabs-guard'); ?></p>
    627797                                </td>
    628798                            </tr>
    … …  
    638808                    ?>
    639809                </form>
     810
     811                    <?php if ($this->notification_manager): ?>
     812                        <?php
     813                        $splg_stats = $this->notification_manager->stats(1);
     814                        $splg_week = $this->notification_manager->stats(7);
     815                        $splg_next_digest = wp_next_scheduled(SecureProLabs_Guard_Notification_Manager::DIGEST_HOOK);
     816                        $splg_recent = $this->notification_manager->recent_notices(10);
     817                        $splg_status_labels = array(
     818                            'pending' => __('Waiting (grouping or limit)', 'secureprolabs-guard'),
     819                            'sending' => __('Sending', 'secureprolabs-guard'),
     820                            'sent' => __('Submitted', 'secureprolabs-guard'),
     821                            'failed' => __('Failed', 'secureprolabs-guard'),
     822                            'digested' => __('Moved to digest', 'secureprolabs-guard'),
     823                        );
     824                        ?>
     825                        <section class="splg-notify-diagnostics" aria-labelledby="splg-notify-diag-title">
     826                            <h3 id="splg-notify-diag-title"><?php echo esc_html__('Notification Activity', 'secureprolabs-guard'); ?></h3>
     827                            <p class="description"><?php echo esc_html__('Today, with the last 7 days in brackets. "Submitted" means WordPress handed the email to your mail system; delivery to the inbox cannot be confirmed from WordPress.', 'secureprolabs-guard'); ?></p>
     828                            <ul class="splg-stat-grid" role="list">
     829                                <?php
     830                                $splg_cards = array(
     831                                    'recorded' => __('Events sent to notifications', 'secureprolabs-guard'),
     832                                    'sent' => __('Emails submitted', 'secureprolabs-guard'),
     833                                    'grouped' => __('Events grouped', 'secureprolabs-guard'),
     834                                    'suppressed' => __('Repeat alerts suppressed', 'secureprolabs-guard'),
     835                                    'digest_only' => __('Sent to digest only', 'secureprolabs-guard'),
     836                                    'failed' => __('Failed submissions', 'secureprolabs-guard'),
     837                                );
     838                                foreach ($splg_cards as $splg_key => $splg_label):
     839                                ?>
     840                                    <li class="splg-stat<?php echo $splg_key === 'failed' && $splg_stats['failed'] > 0 ? ' splg-stat-alert' : ''; ?>">
     841                                        <span class="splg-stat-value"><?php echo esc_html(number_format_i18n($splg_stats[$splg_key])); ?></span>
     842                                        <span class="splg-stat-label"><?php echo esc_html($splg_label); ?> <span class="splg-stat-week">(<?php echo esc_html(number_format_i18n($splg_week[$splg_key])); ?>)</span></span>
     843                                    </li>
     844                                <?php endforeach; ?>
     845                            </ul>
     846                            <dl class="splg-notify-meta">
     847                                <dt><?php echo esc_html__('Last notification', 'secureprolabs-guard'); ?></dt>
     848                                <dd><?php echo $splg_stats['last_notification'] ? esc_html(wp_date(get_option('date_format') . ' ' . get_option('time_format'), $splg_stats['last_notification'])) : esc_html__('None yet', 'secureprolabs-guard'); ?></dd>
     849                                <dt><?php echo esc_html__('Next digest', 'secureprolabs-guard'); ?></dt>
     850                                <dd><?php echo get_option('secureprolabs_guard_notify_digest', 'daily') === 'off' ? esc_html__('Off', 'secureprolabs-guard') : ($splg_next_digest ? esc_html(wp_date(get_option('date_format') . ' ' . get_option('time_format'), $splg_next_digest)) : esc_html__('Not scheduled yet', 'secureprolabs-guard')); ?></dd>
     851                                <dt><?php echo esc_html__('Emails used this hour / today', 'secureprolabs-guard'); ?></dt>
     852                                <dd><?php echo esc_html($splg_stats['hour_count'] . ' / ' . $splg_stats['day_count']); ?></dd>
     853                                <?php if ($splg_stats['last_error'] !== ''): ?>
     854                                    <dt><?php echo esc_html__('Last mail error', 'secureprolabs-guard'); ?></dt>
     855                                    <dd class="splg-mail-error"><?php echo esc_html($splg_stats['last_error']); ?></dd>
     856                                <?php endif; ?>
     857                            </dl>
     858
     859                            <h4><?php echo esc_html__('Recent notices', 'secureprolabs-guard'); ?></h4>
     860                            <?php if (!$splg_recent): ?>
     861                                <p><?php echo esc_html__('No notices yet.', 'secureprolabs-guard'); ?></p>
     862                            <?php else: ?>
     863                                <table class="widefat striped">
     864                                    <thead><tr>
     865                                        <th scope="col"><?php echo esc_html__('Severity', 'secureprolabs-guard'); ?></th>
     866                                        <th scope="col"><?php echo esc_html__('Notice', 'secureprolabs-guard'); ?></th>
     867                                        <th scope="col"><?php echo esc_html__('Events', 'secureprolabs-guard'); ?></th>
     868                                        <th scope="col"><?php echo esc_html__('Last event', 'secureprolabs-guard'); ?></th>
     869                                        <th scope="col"><?php echo esc_html__('Status', 'secureprolabs-guard'); ?></th>
     870                                    </tr></thead>
     871                                    <tbody>
     872                                    <?php foreach ($splg_recent as $splg_n): ?>
     873                                        <tr>
     874                                            <td><span class="splg-sev splg-sev-<?php echo esc_attr((int) $splg_n->severity); ?>"><?php echo esc_html(SecureProLabs_Guard_Notification_Manager::severity_label($splg_n->severity)); ?></span></td>
     875                                            <td><?php echo esc_html($splg_n->title); ?></td>
     876                                            <td><?php echo esc_html(number_format_i18n((int) $splg_n->event_count)); ?></td>
     877                                            <td><?php echo esc_html(wp_date(get_option('time_format') . ', ' . get_option('date_format'), (int) $splg_n->last_seen)); ?></td>
     878                                            <td>
     879                                                <?php echo esc_html($splg_status_labels[$splg_n->status] ?? $splg_n->status); ?>
     880                                                <?php if ($splg_n->last_error !== ''): ?><br /><small class="splg-mail-error"><?php echo esc_html($splg_n->last_error); ?></small><?php endif; ?>
     881                                            </td>
     882                                        </tr>
     883                                    <?php endforeach; ?>
     884                                    </tbody>
     885                                </table>
     886                            <?php endif; ?>
     887
     888                            <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" class="splg-test-notification">
     889                                <?php wp_nonce_field('secureprolabs_guard_test_notification'); ?>
     890                                <input type="hidden" name="action" value="secureprolabs_guard_test_notification" />
     891                                <?php submit_button(__('Send test notification', 'secureprolabs-guard'), 'secondary', 'submit', false); ?>
     892                                <span class="description"><?php echo esc_html__('Sends to the addresses above straight away. Does not use the alert limits.', 'secureprolabs-guard'); ?></span>
     893                            </form>
     894                        </section>
     895                    <?php endif; ?>
    640896                   
    641897                <?php elseif ($settings_subtab === 'advanced'): ?>
    … …  
    7521008                           
    7531009                            <tr>
    754                                 <th scope="row"><?php echo esc_html__('Debug Mode', 'secureprolabs-guard'); ?></th>
     1010                                <th scope="row"><?php echo esc_html__('Debug Mode', 'secureprolabs-guard'); ?><?php $splg_pill('debug_mode'); ?></th>
    7551011                                <td>
    7561012                                    <label>
  • secureprolabs-guard/trunk/admin/partials/tab-statistics.php

    r3839918 r3841085  
    33    exit;
    44}
     5
     6// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Admin template included from a SecureProLabs_Guard admin page method; its variables are local to that method, not globals.
    57
    68/**
    … …  
    2527    time()
    2628));
    27 $total_logs = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $logs_table));
    28 $blocked_attempts = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE event_action = 'blocked'", $logs_table));
     29$total_logs = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i", $logs_table));
     30$blocked_attempts = $wpdb->get_var($wpdb->prepare("SELECT COALESCE(SUM(occurrences), 0) FROM %i WHERE event_action = 'blocked'", $logs_table));
    2931
    3032// Daily statistics for the last 30 days
    3133$daily_stats = $wpdb->get_results($wpdb->prepare("
    32     SELECT DATE(created) as date, COUNT(*) as count
     34    SELECT DATE(created) as date, COALESCE(SUM(occurrences), 0) as count
    3335    FROM %i
    3436    WHERE created >= %s
    … …  
    3941// Event type breakdown
    4042$event_type_stats = $wpdb->get_results($wpdb->prepare("
    41     SELECT event_type, COUNT(*) as count
     43    SELECT event_type, COALESCE(SUM(occurrences), 0) as count
    4244    FROM %i
    4345    GROUP BY event_type
    … …  
    4749// Event action breakdown
    4850$event_action_stats = $wpdb->get_results($wpdb->prepare("
    49     SELECT event_action, COUNT(*) as count
     51    SELECT event_action, COALESCE(SUM(occurrences), 0) as count
    5052    FROM %i
    5153    GROUP BY event_action
    … …  
    5557// Top blocked IPs
    5658$top_blocked_ips = $wpdb->get_results($wpdb->prepare("
    57     SELECT ip_address, COUNT(*) as attempts
     59    SELECT ip_address, COALESCE(SUM(occurrences), 0) as attempts
    5860    FROM %i
    5961    WHERE event_action = 'blocked'
    … …  
    7375// Recent activity (last 24 hours)
    7476$recent_activity = $wpdb->get_results($wpdb->prepare("
    75     SELECT event_type, event_action, COUNT(*) as count
     77    SELECT event_type, event_action, COALESCE(SUM(occurrences), 0) as count
    7678    FROM %i
    7779    WHERE created >= %s
    … …  
    252254            <h3><?php echo esc_html__('Daily Activity (Last 30 Days)', 'secureprolabs-guard'); ?></h3>
    253255           
    254             <div class="daily-chart">
     256            <ul class="daily-chart" role="list">
    255257                <?php
    256                 $max_count = max(array_column($daily_stats, 'count'));
     258                $max_count = max(1, (int) max(array_column($daily_stats, 'count')));
    257259                foreach (array_reverse($daily_stats) as $day):
     260                    $day_label = wp_date('M j', strtotime($day->date . ' UTC'), new DateTimeZone('UTC'));
    258261                ?>
    259                     <div class="daily-bar" style="height: <?php echo esc_attr(($day->count / $max_count) * 100); ?>%">
    260                         <span class="daily-count"><?php echo esc_html($day->count); ?></span>
    261                         <span class="daily-date"><?php echo esc_html(wp_date('M j', strtotime($day->date . ' UTC'), new DateTimeZone('UTC'))); ?></span>
    262                     </div>
     262                    <li class="daily-col">
     263                        <span class="daily-track">
     264                            <span class="daily-bar" style="height: <?php echo esc_attr(max(2, round(($day->count / $max_count) * 100))); ?>%">
     265                                <span class="daily-count"><?php echo esc_html(number_format_i18n((int) $day->count)); ?></span>
     266                            </span>
     267                        </span>
     268                        <span class="daily-date"><?php echo esc_html($day_label); ?></span>
     269                    </li>
    263270                <?php endforeach; ?>
    264             </div>
     271            </ul>
    265272        </div>
    266273    <?php endif; ?>
  • secureprolabs-guard/trunk/includes/class-cron-security.php

    r3839918 r3841085  
    9898    private function block_cron_access() {
    9999        $ip = $this->get_client_ip();
     100        if (class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request()) {
     101            wp_die(esc_html__('Forbidden', 'secureprolabs-guard'), esc_html__('Access Denied', 'secureprolabs-guard'), array('response' => 403));
     102        }
    100103       
    101104        // Log the blocked attempt
    … …  
    103106            'Unauthorized cron access attempt from IP: ' . $ip, $ip);
    104107       
    105         // Notify admin if enabled, at most once per hour
    106         if (get_option('secureprolabs_guard_notify_admin', true) && get_option('secureprolabs_guard_notify_cron', false)
    107             && !get_transient('secureprolabs_guard_cron_mail_sent')) {
    108             set_transient('secureprolabs_guard_cron_mail_sent', 1, HOUR_IN_SECONDS);
    109             $this->notify_admin_cron_blocked($ip);
     108        $manager = SecureProLabs_Guard_Notification_Manager::instance();
     109        // High-frequency path: hand at most one event a minute to notifications; the log keeps exact counts.
     110        if ($manager && !get_transient('secureprolabs_guard_cron_notify_gate')) {
     111            set_transient('secureprolabs_guard_cron_notify_gate', 1, MINUTE_IN_SECONDS);
     112            $manager->submit('cron_blocked', SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM,
     113                __('Unauthorized wp-cron.php access blocked', 'secureprolabs-guard'), $ip);
    110114        }
    111115       
    112116        // Send 403 Forbidden
    113117        wp_die(esc_html__('Forbidden', 'secureprolabs-guard'), esc_html__('Access Denied', 'secureprolabs-guard'), array('response' => 403));
    114     }
    115    
    116     /**
    117      * Notify admin about blocked cron access
    118      */
    119     private function notify_admin_cron_blocked($ip) {
    120         $admin_email = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    121        
    122         $subject = '[SecureProLabs Guard] Cron Access Blocked';
    123         $message = sprintf(
    124             "Unauthorized wp-cron.php access blocked from IP: %s\n\n" .
    125             "Time: %s\n" .
    126             "Site: %s\n\n" .
    127             "You can configure authorized IPs in the SecureProLabs Guard settings.",
    128             $ip,
    129             current_time('mysql'),
    130             get_site_url()
    131         );
    132        
    133         wp_mail(
    134             $admin_email,
    135             $subject,
    136             $message,
    137             array('Content-Type: text/plain; charset=UTF-8')
    138         );
    139118    }
    140119   
  • secureprolabs-guard/trunk/includes/class-lockout-manager.php

    r3839918 r3841085  
    144144        }
    145145
    146         if ($result !== false && $duration > 0 && $failure_count >= 3) {
    147             $this->notifier->notify_admin_lockout($ip, $event_type, $failure_count);
     146        if ($result === false) {
     147            $this->notifier->notify_enforcement_failure($event_type);
     148        } elseif ($duration > 0 && $failure_count >= 3) {
     149            $permanent = $failure_count > 5 && $duration === (int) $settings['permanent'];
     150            $this->notifier->notify_admin_lockout($ip, $event_type, $failure_count, $permanent);
    148151        }
    149152
    150153        return $result === false ? null : ($duration > 0 && !$recovering);
     154    }
     155
     156    /**
     157     * Whether this IP reached a real lockout (3 or more failures) within the given number of hours.
     158     */
     159    public function had_recent_lockout($ip, $hours = 24) {
     160        global $wpdb;
     161        if (!filter_var($ip, FILTER_VALIDATE_IP)) {
     162            return false;
     163        }
     164        $since = gmdate('Y-m-d H:i:s', time() + (int) (get_option('gmt_offset') * HOUR_IN_SECONDS) - $hours * HOUR_IN_SECONDS);
     165        return (bool) $wpdb->get_var($wpdb->prepare(
     166            'SELECT id FROM %i WHERE ip_address = %s AND failure_count >= 3 AND modified >= %s LIMIT 1',
     167            $wpdb->prefix . 'secureprolabs_guard_lockouts', $ip, $since
     168        ));
    151169    }
    152170
  • secureprolabs-guard/trunk/includes/class-logger.php

    r3839918 r3841085  
    3232            ip_address varchar(45) NOT NULL,
    3333            created datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
     34            occurrences int(10) unsigned NOT NULL DEFAULT 1,
     35            last_seen datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
    3436            PRIMARY KEY  (id),
    3537            KEY event_type (event_type),
    … …  
    6163        $details = substr($details, 0, 1000); // Reasonable limit for details
    6264       
     65        // Identical events from one IP within 60 seconds update one row with a count, so an attack
     66        // cannot grow the table one row per request. Nothing is lost: the count and last time are kept.
     67        $now = current_time('mysql');
     68        if ($ip_address !== '0.0.0.0') {
     69            $recent = $wpdb->get_var($wpdb->prepare(
     70                'SELECT id FROM %i WHERE ip_address = %s AND event_type = %s AND event_action = %s AND details = %s AND created >= %s ORDER BY id DESC LIMIT 1',
     71                $this->table_name, $ip_address, $event_type, $event_action, $details,
     72                gmdate('Y-m-d H:i:s', strtotime($now . ' UTC') - 60)
     73            ));
     74            if ($recent) {
     75                return false !== $wpdb->query($wpdb->prepare(
     76                    'UPDATE %i SET occurrences = occurrences + 1, last_seen = %s WHERE id = %d',
     77                    $this->table_name, $now, (int) $recent
     78                ));
     79            }
     80        }
     81
    6382        // Use prepared statement for security
    6483        $result = $wpdb->insert(
    … …  
    6988                'details' => $details,
    7089                'ip_address' => $ip_address,
    71                 'created' => current_time('mysql')
     90                'created' => $now,
     91                'occurrences' => 1,
     92                'last_seen' => $now,
    7293            ),
    73             array('%s', '%s', '%s', '%s', '%s')
     94            array('%s', '%s', '%s', '%s', '%s', '%d', '%s')
    7495        );
    7596       
  • secureprolabs-guard/trunk/includes/class-login-rate-limiting.php

    r3839918 r3841085  
    4747            $this->get_user_agent(), $ip);
    4848       
     49        // An administrator signing in from an IP that was recently locked out may mean a guessed password.
     50        if ($user instanceof WP_User && user_can($user, 'manage_options') && $this->lockout_manager->had_recent_lockout($ip, 24)) {
     51            $manager = SecureProLabs_Guard_Notification_Manager::instance();
     52            if ($manager) {
     53                /* translators: %s: username. */
     54                $title = sprintf(__('Administrator "%s" signed in from an IP locked out in the last 24 hours', 'secureprolabs-guard'), $username);
     55                $manager->submit('login_after_lockout', SecureProLabs_Guard_Notification_Manager::SEV_CRITICAL, $title, $ip);
     56            }
     57        }
     58
    4959        // Clear any existing lockouts for this IP
    5060        $this->clear_lockout($ip);
  • secureprolabs-guard/trunk/includes/class-notifier.php

    r3839918 r3841085  
    44}
    55
     6/**
     7 * Lockout notifications, routed through Smart Notifications so they are grouped and rate limited.
     8 */
    69class SecureProLabs_Guard_Notifier {
    7    
     10
    811    private $logger;
    9    
    10     public function __construct($logger) {
     12    private $manager;
     13
     14    public function __construct($logger, $manager = null) {
    1115        $this->logger = $logger;
     16        $this->manager = $manager;
    1217    }
    13    
    14     public function notify_admin_lockout($ip, $event_type, $failure_count) {
    15         if (!$this->should_notify_lockout()) {
     18
     19    /**
     20     * @param bool $permanent Whether this step reached the permanent (24 hour) lockout.
     21     */
     22    public function notify_admin_lockout($ip, $event_type, $failure_count, $permanent = false) {
     23        if (!$this->manager) {
    1624            return;
    1725        }
    18         $to = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    19         /* translators: %s: IP address. */
    20         $subject = sprintf(__('SecureProLabs Guard: Lockout triggered for IP %s', 'secureprolabs-guard'), $ip);
    21         $message = sprintf(
    22             /* translators: 1: IP address, 2: event type, 3: failure count. */
    23             __('A lockout has been triggered for IP address %1$s due to %2$s events. Failure count: %3$d', 'secureprolabs-guard'),
    24             $ip, $event_type, $failure_count
    25         );
    26        
    27         wp_mail($to, $subject, $message);
    28        
    29         $this->logger->log_event('notification', 'lockout_triggered',
    30             'Admin notified about lockout for IP: ' . $ip . ', event: ' . $event_type);
    31     }
    32    
    33     public function notify_admin_permanent_lockout($ip, $event_type) {
    34         if (!$this->should_notify_lockout()) {
     26        $category = self::category_for($event_type);
     27        if ($permanent) {
     28            /* translators: %s: event type. */
     29            $title = sprintf(__('Permanent lockout after repeated %s events', 'secureprolabs-guard'), $event_type);
     30            $this->manager->submit('permanent_lockout', SecureProLabs_Guard_Notification_Manager::SEV_HIGH, $title, $ip);
    3531            return;
    3632        }
    37         $to = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    38         /* translators: %s: IP address. */
    39         $subject = sprintf(__('SecureProLabs Guard: Permanent lockout triggered for IP %s', 'secureprolabs-guard'), $ip);
    40         $message = sprintf(
    41             /* translators: 1: IP address, 2: event type. */
    42             __('A permanent lockout has been triggered for IP address %1$s due to repeated %2$s events.', 'secureprolabs-guard'),
    43             $ip, $event_type
    44         );
    45        
    46         wp_mail($to, $subject, $message);
    47        
    48         $this->logger->log_event('notification', 'permanent_lockout_triggered',
    49             'Admin notified about permanent lockout for IP: ' . $ip . ', event: ' . $event_type);
     33        /* translators: %s: event type. */
     34        $title = sprintf(__('IP lockout for %s', 'secureprolabs-guard'), $event_type);
     35        $this->manager->submit($category, SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM, $title, $ip);
    5036    }
    5137
    52     private function should_notify_lockout() {
    53         return get_option('secureprolabs_guard_notify_admin', true) && get_option('secureprolabs_guard_notify_lockouts', true);
     38    public function notify_admin_permanent_lockout($ip, $event_type) {
     39        $this->notify_admin_lockout($ip, $event_type, 0, true);
     40    }
     41
     42    /**
     43     * Guard could not store a lockout: protection may not be enforced.
     44     */
     45    public function notify_enforcement_failure($event_type) {
     46        if ($this->manager) {
     47            /* translators: %s: event type. */
     48            $title = sprintf(__('Guard could not record a %s lockout (database write failed)', 'secureprolabs-guard'), $event_type);
     49            $this->manager->submit('guard_failure', SecureProLabs_Guard_Notification_Manager::SEV_CRITICAL, $title);
     50        }
     51    }
     52
     53    public static function category_for($event_type) {
     54        $map = array(
     55            'login_failure' => 'lockout_login',
     56            'password_reset' => 'lockout_password_reset',
     57            'xmlrpc_pingback' => 'lockout_xmlrpc',
     58            'manual_admin_lockout' => 'lockout_manual',
     59        );
     60        return $map[$event_type] ?? 'lockout_form';
    5461    }
    5562}
  • secureprolabs-guard/trunk/includes/class-server-hardening.php

    r3839918 r3841085  
    5555    public function setup_server_hardening() {
    5656        // Remove X-Powered-By header if possible
    57         if (function_exists('header_remove')) {
     57        // Some requests (cron, background tasks) start output before init; headers can no longer change then.
     58        if (function_exists('header_remove') && !headers_sent()) {
    5859            header_remove('X-Powered-By');
    5960        }
    … …  
    161162            ? sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])) : 'Unknown';
    162163       
    163         // Log the blocked access attempt
    164         $this->logger->log_event(
    165             'server_hardening',
    166             'blocked_file_access',
    167             sprintf(
    168                 'Blocked access to sensitive file: %s from IP: %s, User Agent: %s',
    169                 sanitize_text_field($file_name),
    170                 $ip_address,
    171                 $user_agent
    172             ),
    173             $ip_address
    174         );
     164        // Log the blocked access attempt (not Guard's own Security Health checks)
     165        if (!(class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request())) {
     166            $this->logger->log_event(
     167                'server_hardening',
     168                'blocked_file_access',
     169                sprintf(
     170                    'Blocked access to sensitive file: %s from IP: %s, User Agent: %s',
     171                    sanitize_text_field($file_name),
     172                    $ip_address,
     173                    $user_agent
     174                ),
     175                $ip_address
     176            );
     177        }
    175178       
    176179        // Send 404 instead of 403 to avoid information disclosure
  • secureprolabs-guard/trunk/includes/class-xmlrpc-security.php

    r3839918 r3841085  
    168168
    169169        $ip = $this->get_client_ip();
     170        if (class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request()) {
     171            status_header(403);
     172            exit('Forbidden');
     173        }
    170174        $this->log_event('blocked',
    171175            'XML-RPC access blocked from IP: ' . $ip, $ip);
    172176
    173         if (get_option('secureprolabs_guard_notify_admin', true) && get_option('secureprolabs_guard_notify_xmlrpc', true)
    174             && $this->reserve_event_slot('secureprolabs_guard_xmlrpc_mail_after', 15 * MINUTE_IN_SECONDS)) {
    175             $this->notify_admin_xmlrpc_blocked($ip);
     177        $manager = SecureProLabs_Guard_Notification_Manager::instance();
     178        // High-frequency path: hand at most one event a minute to notifications; the log keeps exact counts.
     179        if ($manager && $this->reserve_event_slot('secureprolabs_guard_xmlrpc_notify_after', MINUTE_IN_SECONDS)) {
     180            $manager->submit('xmlrpc_blocked', SecureProLabs_Guard_Notification_Manager::SEV_MEDIUM,
     181                __('XML-RPC access blocked', 'secureprolabs-guard'), $ip);
    176182        }
    177183
    … …  
    194200    }
    195201   
    196     /**
    197      * Notify admin about blocked XML-RPC access
    198      */
    199     private function notify_admin_xmlrpc_blocked($ip) {
    200         $admin_email = get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
    201        
    202         $subject = '[SecureProLabs Guard] XML-RPC Access Blocked';
    203         $message = sprintf(
    204             "XML-RPC access blocked from IP: %s\n\n" .
    205             "Time: %s\n" .
    206             "Site: %s",
    207             $ip,
    208             current_time('mysql'),
    209             get_site_url()
    210         );
    211        
    212         wp_mail(
    213             $admin_email,
    214             $subject,
    215             $message,
    216             array('Content-Type: text/plain; charset=UTF-8')
    217         );
    218     }
    219    
    220202    private function log_event($action, $details, $ip) {
     203        // Guard's own Security Health probe is never logged; real requests are logged as before.
     204        if (class_exists('SecureProLabs_Guard_Security_Health') && SecureProLabs_Guard_Security_Health::is_assessment_request()) {
     205            return;
     206        }
    221207        if ($this->reserve_event_slot('secureprolabs_guard_xmlrpc_log_after', MINUTE_IN_SECONDS)) {
    222208            $this->logger->log_event('xmlrpc_security', $action, $details, $ip);
  • secureprolabs-guard/trunk/readme.txt

    r3839918 r3841085  
    11=== SecureProLabs Guard ===
    22Contributors: secureprolabs
    3 Tags: security, brute force, login security, rate limiting, hardening
     3Tags: security, brute force, login security, rate limiting, xml-rpc
    44Requires at least: 7.0
    55Tested up to: 7.1
    66Requires PHP: 8.2
    7 Stable tag: 2.4.5
     7Stable tag: 2.4.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1010
    11 Intelligent WordPress security and hardening with brute force protection, rate limiting, security headers and activity monitoring.
     11Login lockouts, brute force protection, form rate limiting, security headers and hardening for single-site WordPress.
    1212
    1313== Description ==
    1414
    15 **Protection with intelligence.**
     15SecureProLabs Guard is SecureProLabs’s free security plugin for single-site WordPress installations. Configure rate limits for login attempts, password resets and supported forms. Review lockouts, view security events and export logs as CSV from WordPress Admin.
    1616
    17 SecureProLabs Guard is SecureProLabs's free WordPress security and hardening plugin for single-site installations. Configure protection controls, review lockouts and security activity, and export event logs from WordPress Admin.
    18 
    19 = Core Security Features =
    20 
    21 * **Brute Force Protection:** Configure login rate limits and progressive lockouts based on the detected client IP address.
    22 * **Password Reset Protection:** Limit repeated password reset requests with optional IP-based lockouts.
    23 * **Form Protection:** Apply fixed, non-escalating submission limits to supported forms and registration requests.
    24 * **REST API Security:** Restrict access to the users collection and require a logged in user for single user requests by ID. Other routes retain their own WordPress permissions.
    25 * **XML-RPC Protection:** Restrict selected methods and pingbacks, or optionally block XML-RPC entirely.
    26 * **WP-Cron Protection:** Require a configured request header credential or an explicitly allowlisted IP address for WP-Cron HTTP requests when the control is enabled.
    27 * **Security Headers:** Configure HTTP security headers, with optional HSTS subdomain coverage.
    28 * **Server Hardening:** Apply basic server hardening controls. Files existing on disk are served by the web server.
    29 * **Security Activity Monitoring:** Review security events, manage lockouts and export logs as CSV from WordPress Admin.
    30 * **Security Notifications:** Enable configurable email notifications for security events.
    31 * **Cloudflare and Proxy Support:** Configure client IP detection through Cloudflare or explicitly trusted reverse proxies.
    32 * **Automatic Log Retention:** Delete older logs through a daily task using a configurable retention period, or choose "Never delete" to keep them.
    33 
    34 On a new installation, login protection and security event logging are enabled. Optional password-reset, Cron, REST API, XML-RPC, form, registration, server-hardening and security-header restrictions start disabled. Administrator email notifications remain disabled until configured. Existing installations retain their configured protections and historical defaults for missing settings. See the FAQ for lockout behavior and the different defaults applied by Reset Settings.
    35 
    36 = Privacy by Design =
    37 
    38 Security events are stored in your site's WordPress database. Logs include client IP addresses and can include usernames or user-agent strings. When enabled, email notifications send event details through your site's configured WordPress mail transport to the selected recipient, so your mail provider may receive that information.
    39 
    40 SecureProLabs Guard has no SecureProLabs telemetry, licensing connection or custom update service. See the FAQ for the full data, retention, export and uninstall disclosures.
    41 
    42 = Our Philosophy =
    43 
    44 Cybersecurity should be accessible to everyone.
    45 
    46 Our priorities are transparency, reliability and ease of use. We aim to help website owners, developers and agencies take greater control of their WordPress security through configurable protections and clear security activity information.
    47 
    48 Learn more at [SecureProLabs](https://secureprolabs.com/).
    49 
    50 = Compatibility =
    51 
    52 SecureProLabs Guard supports single-site WordPress installations. Multisite is not supported; the plugin refuses network activation and individual activation on multisite subsites.
     17Other available controls include XML-RPC method and pingback restrictions, optional full XML-RPC blocking, restrictions on the REST API users collection, WP-Cron HTTP request authentication, security headers and basic server hardening. Review the settings on staging before relying on them with a proxy, external scheduler or remote publishing workflow.
    5318
    5419Contact Form 7 6.1.2 was tested for accepted submissions, rate-limit feedback, email delivery and recovery after lockout expiry. Fluent Forms 6.2.17 was tested locally. Test your mail delivery and downstream actions on staging. Licensed Elementor Pro, payment and CRM integrations are outside these tested compatibility claims.
    55 
    56 Review the settings on staging before relying on them with a proxy, external scheduler or remote publishing workflow.
    5720
    5821== Installation ==
    … …  
    6528== Frequently Asked Questions ==
    6629
     30= How is the Security Health score calculated? =
     31
     32Each check has a risk weight (High 6, Medium 3, Low 1). The calculated score is the weight of verified checks divided by the weight of all checks that could be tested. Coverage is the share of applicable checks, by weight, that could be tested; checks Guard cannot prove from inside WordPress lower coverage, never the score. While a live check has observed an unresolved problem, the score is capped: Critical 49, High 74, Medium 89, each 5 lower per additional finding of that severity (never below 25, 50 and 75). A confirmed finding from an external report, entered on the VAPT Assessment tab, caps the score the same way until it is independently verified. Below 50% coverage no number is shown. A high score means the checks passed; it does not guarantee the site is secure.
     33
     34= What is the VAPT Assessment tab, and is it a penetration test? =
     35
     36No. It lists the results of Guard's own checks as findings, next to findings you copy in from an external penetration test or audit report. Guard does not scan other sites, run attacks, or certify compliance. An external finding with a report reference counts as confirmed and can limit the Security Health score until it is marked independently verified with an auditor reference. Without a reference it is shown as administrator-entered and unconfirmed, and does not affect the score. Only text is stored; there are no file uploads.
     37
     38= Does the assessment contact any outside service? =
     39
     40No. It sends requests only from your server to fixed addresses on your own site (for example the home page, /xmlrpc.php and /wp-json/wp/v2/users), when an administrator clicks Run Security Assessment. Response bodies are inspected in memory and not stored; only a one-line result per check is saved.
     41
     42= How many notification emails will I get? =
     43
     44With the default Balanced profile, at most 5 an hour and 15 a day, plus one digest. Events of the same kind are grouped into one email, and the same IP is not reported twice within the cooldown. Everything is still recorded in the security log. Choose Quiet to receive only critical alerts right away.
     45
     46= Does "submitted" mean the email was delivered? =
     47
     48No. WordPress can only confirm that it handed the email to your mail system. If notices show as submitted but never arrive, check your mail or SMTP setup and your spam folder.
     49
    6750= Which protections are enabled on a new installation? =
    6851
    … …  
    7154Existing installations retain their configured protections and historical defaults for missing settings. The lockout schedule is shared by login, reset and form controls. Review it when enabling those optional controls. Reset Settings restores the historical protection-heavy defaults, including optional restrictions; it does not restore this new-install profile.
    7255
    73 = How do I update an existing installation? =
     56= Can I update an existing private installation? =
    7457
    7558Keep the existing secureprolabs-guard plugin folder and use WordPress's in-place update or ZIP replacement workflow. Back up before updating. Use the replacement action rather than deleting the existing plugin first. Explicit uninstall removes the plugin-owned settings, Cron credential, security log table and lockout table. Updates and deactivation retain that data.
     59
     60= Can I upgrade a private version 2.1.2 installation? =
     61
     62An in-place update from private version 2.1.2 and rollback were verified on a single-site test installation. Existing settings and security records were preserved. Back up files and the database. Use WordPress's in-place replacement workflow, then verify ordinary login, reset email, XML-RPC and REST integrations, form delivery, and scheduled jobs before rolling out.
     63
     64Legacy Cron query-string credentials and implicit permission for same-server HTTP requests are no longer supported. Use the X-SecureProLabs-Guard-Cron request header with the configured key or an explicitly allowlisted IP address. Rotate any key previously embedded in a URL. If your site is behind a proxy, verify the effective client IP. Forwarded addresses are used only when the connection comes through a trusted proxy. Multisite installations are outside the supported upgrade path.
    7665
    7766= Does it support multisite? =
    … …  
    10594Use the plugin's WordPress.org support forum once the plugin is listed. Include plugin, WordPress and PHP versions and steps using test data. Keep credentials, reset links, Cron keys and private logs out of public posts.
    10695
     96== Screenshots ==
     97
     981. Security overview with synthetic activity.
     992. Settings for login, password-reset and form rate limits.
     1003. Lockouts dashboard with an active badge and expired history.
     1014. Security Logs with the administrator CSV export action.
     102
    107103== Changelog ==
     104
     105= 2.4.6 =
     106* New: Redesigned admin interface on the SecureProLabs design system: a branded application shell with flat navigation (a section menu on small screens), the Security Health dial, control cards with toggle switches and assessment status in Settings, and selectable notification profiles. Styles load only on Guard pages and are scoped to Guard's own screens.
     107* Improved: Security Health shows configuration score and verification coverage separately for each protection category, and says when a score ceiling applies but is not reducing the score.
     108* Improved: The settings save bar shows unsaved changes and a saved confirmation.
     109* New: Security Health, now the first tab. An administrator-run assessment checks 17 controls, mostly by sending requests from the server to fixed paths on its own site, and shows which are verified, misconfigured, unverified or untested.
     110* New: Security Health score with assessment coverage shown beside it. The score counts only controls a check could test, and is capped while a problem a live check observed remains unresolved. See "How is the Security Health score calculated?" below.
     111* New: VAPT Assessment tab. Guard's checks are listed as findings with separate remediation and verification states, filterable by severity, status and source. Findings from an external penetration test or audit can be added as text, with a report reference.
     112* New: Risk acceptance for open findings, recording who accepted it, why, when, and a review date (90 days by default). An accepted finding still limits the Security Health score until it is fixed and verified.
     113* New: Smart Notifications. Security events are grouped, rate limited and delivered by WP-Cron instead of inside the request that triggered them. Choose a Quiet, Balanced or Verbose profile, or set custom limits.
     114* New: Hourly and daily email limits, with part of each kept free for critical alerts.
     115* New: Daily or weekly security digest, including events that were grouped or held back by the limits.
     116* New: Critical alerts when Guard cannot record a lockout, and when an administrator signs in from an IP that was locked out in the last 24 hours. High alert for permanent lockouts and for many IPs locked out within 15 minutes.
     117* New: Notification Activity panel with submitted, grouped, suppressed and failed counts, recent notices, the last mail error, and a test notification button.
     118* New: Up to five notification recipients.
     119* Change: Identical log events from one IP within 60 seconds are stored as one row with a repeat count. Totals, statistics and CSV export include the repeats.
     120* Change: The "Login Failures" notification option now controls whether failed logins appear in the digest. Single failed logins never sent email before; the option had no effect.
     121* Fix: A "headers already sent" PHP warning on requests that start output before WordPress loads.
     122* Fix: Lockout and form limit emails had no cooldown or overall limit, so an attack from many IP addresses could send hundreds of emails a day.
    108123
    109124= 2.4.5 =
    … …  
    134149== Upgrade Notice ==
    135150
     151= 2.4.6 =
     152Adds Security Health, VAPT Assessment, Smart Notifications and a redesigned admin. Settings, logs and lockouts are kept. Security emails are now grouped and limited using the Balanced profile; review Settings > Notifications after updating.
     153
    136154= 2.4.4 =
    137155Adds Cloudflare and proxy IP detection, daily log cleanup and fairer form limits. Logs older than your retention period (30 days by default) are now deleted automatically. Choose Never delete in Settings > Advanced to keep them. Behind a proxy? Check Client IP Detection after updating.
    138156
    139157= 2.4.3 =
    140 Back up first. Replace secureprolabs-guard in place to retain settings and history.
     158Back up first. Replace secureprolabs-guard in place to retain settings and history. Upgrading from 2.1.2? Check Cron authorization and proxy IP detection on staging before updating.
  • secureprolabs-guard/trunk/secureprolabs-guard.php

    r3839918 r3841085  
    33 * Plugin Name: SecureProLabs Guard
    44 * Description: Login lockouts, brute force protection, form rate limiting, security headers and hardening for single-site WordPress.
    5  * Version: 2.4.5
     5 * Version: 2.4.6
    66 * Requires at least: 7.0
    77 * Requires PHP: 8.2
    … …  
    4949
    5050// Define plugin constants
    51 define('SECUREPROLABS_GUARD_VERSION', '2.4.5');
     51define('SECUREPROLABS_GUARD_VERSION', '2.4.6');
     52define('SECUREPROLABS_GUARD_DB_VERSION', 3);
    5253define('SECUREPROLABS_GUARD_PLUGIN_URL', plugin_dir_url(__FILE__));
    5354define('SECUREPROLABS_GUARD_PLUGIN_DIR', plugin_dir_path(__FILE__));
    … …  
    6465require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-lockout-manager.php';
    6566require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-logger.php';
     67require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-notification-manager.php';
     68require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-security-controls.php';
     69require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-security-health.php';
     70require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-vapt.php';
    6671require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-notifier.php';
    6772require_once SECUREPROLABS_GUARD_PLUGIN_DIR . 'includes/class-server-hardening.php';
    … …  
    8287    private $logger;
    8388    private $notifier;
     89    private $notification_manager;
     90    private $security_health;
     91    private $vapt;
    8492    private $server_hardening;
    8593    private $fresh_install = false;
    … …  
    160168            'secureprolabs_guard_notify_xmlrpc' => true,
    161169            'secureprolabs_guard_notify_cron' => false,
     170            'secureprolabs_guard_notify_profile' => 'balanced',
     171            'secureprolabs_guard_notify_digest' => 'daily',
    162172            'secureprolabs_guard_authorized_cron_ips' => '',
    163173            'secureprolabs_guard_log_retention' => 30,
    … …  
    272282    private function init_components() {
    273283        $this->logger = new SecureProLabs_Guard_Logger();
    274         $this->notifier = new SecureProLabs_Guard_Notifier($this->logger);
     284        $this->notification_manager = new SecureProLabs_Guard_Notification_Manager($this->logger);
     285        $this->notifier = new SecureProLabs_Guard_Notifier($this->logger, $this->notification_manager);
    275286        $this->lockout_manager = new SecureProLabs_Guard_Lockout_Manager($this->logger, $this->notifier);
    276287       
    … …  
    282293        $this->general_rate_limiting = new SecureProLabs_Guard_General_Rate_Limiting($this->logger, $this->lockout_manager);
    283294        $this->server_hardening = new SecureProLabs_Guard_Server_Hardening($this->logger);
     295        $this->security_health = new SecureProLabs_Guard_Security_Health();
     296        $this->vapt = new SecureProLabs_Guard_VAPT($this->logger);
    284297    }
    285298   
    … …  
    304317        add_filter('lost_password_html_link', array($this, 'maybe_hide_lost_password_link'));
    305318
     319        // Smart Notifications admin actions and schema upgrades.
     320        add_action('admin_post_secureprolabs_guard_test_notification', array($this, 'handle_test_notification'));
     321        add_action('init', array($this, 'maybe_upgrade'), 1);
     322
    306323        // Daily maintenance: log retention and uploads index.
    307324        add_action('secureprolabs_guard_cleanup_logs', array($this, 'run_daily_maintenance'));
    … …  
    309326    }
    310327
     328    /**
     329     * Apply schema changes once per database version. Runs early on every request but does work only after an update.
     330     */
     331    public function maybe_upgrade() {
     332        if ((int) get_option('secureprolabs_guard_db_version', 1) >= SECUREPROLABS_GUARD_DB_VERSION || !$this->logger) {
     333            return;
     334        }
     335        $this->logger->create_log_table();
     336        SecureProLabs_Guard_Notification_Manager::create_table();
     337        SecureProLabs_Guard_VAPT::create_table();
     338        // New notification settings. Existing on/off toggles are left exactly as they were.
     339        add_option('secureprolabs_guard_notify_profile', 'balanced');
     340        add_option('secureprolabs_guard_notify_digest', 'daily');
     341        // Start with empty counters so nothing recorded before Smart Notifications existed is ever emailed.
     342        if ((int) get_option('secureprolabs_guard_db_version', 1) < 2) {
     343            delete_option(SecureProLabs_Guard_Notification_Manager::STATE_OPTION);
     344        }
     345        update_option('secureprolabs_guard_db_version', SECUREPROLABS_GUARD_DB_VERSION);
     346    }
     347
     348    public function handle_test_notification() {
     349        $this->require_admin_post('secureprolabs_guard_test_notification');
     350        $result = $this->notification_manager ? $this->notification_manager->send_test() : 'failed';
     351        $map = array('sent' => 'test_sent', 'wait' => 'test_wait', 'busy' => 'test_wait', 'failed' => 'test_failed');
     352        $this->redirect_admin_action('settings', $map[$result] ?? 'test_failed', 'notifications');
     353    }
     354
    311355    public function schedule_daily_maintenance() {
    312356        if (!wp_next_scheduled('secureprolabs_guard_cleanup_logs')) {
    … …  
    320364    public function run_daily_maintenance() {
    321365        $this->delete_old_logs();
     366        if ($this->notification_manager) {
     367            $days = (int) get_option('secureprolabs_guard_log_retention', 30);
     368            $this->notification_manager->prune($days > 0 ? $days : 90);
     369        }
    322370        if (get_option('secureprolabs_guard_server_hardening', true)) {
    323371            SecureProLabs_Guard_Server_Hardening::ensure_uploads_index();
    … …  
    361409        $this->logger->create_log_table();
    362410        $this->lockout_manager->create_lockout_table();
     411        SecureProLabs_Guard_Notification_Manager::create_table();
     412        SecureProLabs_Guard_VAPT::create_table();
     413        add_option('secureprolabs_guard_notify_profile', 'balanced');
     414        add_option('secureprolabs_guard_notify_digest', 'daily');
     415        update_option('secureprolabs_guard_db_version', SECUREPROLABS_GUARD_DB_VERSION);
     416        $this->notification_manager->schedule_digest();
    363417        $this->lockout_manager->schedule_cleanup();
    364418        $this->schedule_daily_maintenance();
    … …  
    404458        wp_clear_scheduled_hook('secureprolabs_guard_cleanup_logs');
    405459        wp_clear_scheduled_hook('secureprolabs_guard_lockout_expiry_check');
     460        wp_clear_scheduled_hook(SecureProLabs_Guard_Notification_Manager::DISPATCH_HOOK);
     461        wp_clear_scheduled_hook(SecureProLabs_Guard_Notification_Manager::DIGEST_HOOK);
    406462    }
    407463   
    … …  
    417473        );
    418474       
     475        add_submenu_page(
     476            'secureprolabs-guard',
     477            __('VAPT Assessment', 'secureprolabs-guard'),
     478            __('VAPT Assessment', 'secureprolabs-guard'),
     479            'manage_options',
     480            'secureprolabs-guard-vapt',
     481            array($this, 'display_settings_page')
     482        );
     483
    419484        // Add submenu for lockout management
    420485        add_submenu_page(
    … …  
    574639            'sanitize_callback' => array($this, 'sanitize_checkbox'),
    575640            'default'           => false,
     641        ));
     642        register_setting('secureprolabs_guard_notification_settings', 'secureprolabs_guard_notify_profile', array(
     643            'type'              => 'string',
     644            'sanitize_callback' => array($this, 'sanitize_notify_profile'),
     645            'default'           => 'balanced',
     646        ));
     647        register_setting('secureprolabs_guard_notification_settings', 'secureprolabs_guard_notify_rules', array(
     648            'type'              => 'array',
     649            'sanitize_callback' => array($this, 'sanitize_notify_rules'),
     650        ));
     651        register_setting('secureprolabs_guard_notification_settings', 'secureprolabs_guard_notify_digest', array(
     652            'type'              => 'string',
     653            'sanitize_callback' => array($this, 'sanitize_notify_digest'),
     654            'default'           => 'daily',
    576655        ));
    577656        register_setting('secureprolabs_guard_advanced_settings', 'secureprolabs_guard_authorized_cron_ips', array(
    … …  
    667746    }
    668747
     748    /**
     749     * One to five comma-separated addresses. Invalid input keeps the saved value.
     750     */
    669751    public function sanitize_notification_email($value) {
    670         if (is_string($value) && is_email($value)) {
    671             return sanitize_email($value);
    672         }
    673         return get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
     752        $valid = array();
     753        foreach (explode(',', is_string($value) ? $value : '') as $email) {
     754            $email = sanitize_email(trim($email));
     755            if ($email !== '' && is_email($email)) {
     756                $valid[] = $email;
     757            }
     758        }
     759        $valid = array_slice(array_values(array_unique($valid)), 0, 5);
     760        if (!$valid) {
     761            return get_option('secureprolabs_guard_notify_email', get_option('admin_email'));
     762        }
     763        return implode(', ', $valid);
     764    }
     765
     766    public function sanitize_notify_profile($value) {
     767        return in_array($value, array('quiet', 'balanced', 'verbose', 'custom'), true) ? $value : 'balanced';
     768    }
     769
     770    /**
     771     * Custom rules are only posted while the Custom profile is selected; otherwise keep the saved ones.
     772     */
     773    public function sanitize_notify_rules($value) {
     774        if (!is_array($value)) {
     775            $value = get_option('secureprolabs_guard_notify_rules', array());
     776        }
     777        return SecureProLabs_Guard_Notification_Manager::clean_rules($value);
     778    }
     779
     780    public function sanitize_notify_digest($value) {
     781        return in_array($value, array('daily', 'weekly', 'off'), true) ? $value : 'daily';
    674782    }
    675783
    … …  
    715823     * Enqueue admin assets (CSS/JS) and localize variables
    716824     */
     825    /**
     826     * Plugin version plus the file's modification time, so browsers pick up changed admin assets without a hard reload.
     827     */
     828    private function asset_version($path) {
     829        $mtime = @filemtime(SECUREPROLABS_GUARD_PLUGIN_DIR . $path); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- A missing file just falls back to the plugin version.
     830        return SECUREPROLABS_GUARD_VERSION . ($mtime ? '.' . $mtime : '');
     831    }
     832
    717833    public function enqueue_admin_assets($hook_suffix) {
    718834        // Only load on our plugin pages to keep admin light
    … …  
    720836            'toplevel_page_secureprolabs-guard', get_plugin_page_hookname('secureprolabs-guard-lockouts', 'secureprolabs-guard'),
    721837            get_plugin_page_hookname('secureprolabs-guard-logs', 'secureprolabs-guard'),
     838            get_plugin_page_hookname('secureprolabs-guard-vapt', 'secureprolabs-guard'),
    722839        ), true);
    723840        if (!$is_guard_page) {
    … …  
    727844        // Styles
    728845        wp_enqueue_style(
     846            'secureprolabs-design-tokens',
     847            SECUREPROLABS_GUARD_PLUGIN_URL . 'admin/css/tokens.css',
     848            array(),
     849            $this->asset_version('admin/css/tokens.css')
     850        );
     851        wp_enqueue_style(
    729852            'secureprolabs-guard-admin',
    730853            SECUREPROLABS_GUARD_PLUGIN_URL . 'admin/css/admin.css',
    731             array(),
    732             SECUREPROLABS_GUARD_VERSION
     854            array('secureprolabs-design-tokens'),
     855            $this->asset_version('admin/css/admin.css')
    733856        );
    734857
    … …  
    738861            SECUREPROLABS_GUARD_PLUGIN_URL . 'admin/js/admin.js',
    739862            array('jquery'),
    740             SECUREPROLABS_GUARD_VERSION,
     863            $this->asset_version('admin/js/admin.js'),
    741864            true
    742865        );
    … …  
    754877                'confirmDelete'  => __('Are you sure you want to delete this lockout record?', 'secureprolabs-guard'),
    755878                'confirmLockout' => __('Are you sure you want to lockout this IP address?', 'secureprolabs-guard'),
     879                /* translators: 1: check name, 2: current number, 3: total. */
     880                'healthChecking' => __('Checking %1$s (%2$d of %3$d)', 'secureprolabs-guard'),
     881                'healthSaving'   => __('Saving results…', 'secureprolabs-guard'),
     882                'healthFailed'   => __('The assessment stopped. Your previous results were kept.', 'secureprolabs-guard'),
     883                'healthRun'      => __('Run Security Assessment', 'secureprolabs-guard'),
     884                'healthRunning'  => __('Assessing…', 'secureprolabs-guard'),
     885                'healthSession'  => __('Your sign-in has expired. Reload the page, sign in again, and run the assessment.', 'secureprolabs-guard'),
    756886            ),
    757887        ));
    … …  
    9301060            'secureprolabs_guard_notify_xmlrpc' => true,
    9311061            'secureprolabs_guard_notify_cron' => false,
     1062            'secureprolabs_guard_notify_profile' => 'balanced',
     1063            'secureprolabs_guard_notify_digest' => 'daily',
    9321064            'secureprolabs_guard_authorized_cron_ips' => '',
    9331065            'secureprolabs_guard_log_retention' => 30,
    … …  
    10431175       
    10441176        // CSV headers
    1045         $this->write_csv_row($output, array('ID', 'Event Type', 'Event Action', 'Details', 'IP Address', 'Created'));
     1177        $this->write_csv_row($output, array('ID', 'Event Type', 'Event Action', 'Details', 'IP Address', 'Created', 'Occurrences', 'Last Seen'));
    10461178       
    10471179        // CSV data
    … …  
    10531185                $this->csv_text($log->details),
    10541186                $this->csv_text($log->ip_address),
    1055                 $this->csv_text($log->created)
     1187                $this->csv_text($log->created),
     1188                (int) ($log->occurrences ?? 1),
     1189                $this->csv_text($log->last_seen ?? $log->created)
    10561190            ));
    10571191        }
  • secureprolabs-guard/trunk/uninstall.php

    r3839918 r3841085  
    3333        'secureprolabs_guard_notify_login_failures',
    3434        'secureprolabs_guard_notify_xmlrpc',
     35        'secureprolabs_guard_notify_profile',
     36        'secureprolabs_guard_notify_rules',
     37        'secureprolabs_guard_notify_digest',
     38        'secureprolabs_guard_notify_state',
     39        'secureprolabs_guard_db_version',
     40        'secureprolabs_guard_assessment',
     41        'secureprolabs_guard_assessment_run',
     42        'secureprolabs_guard_risk_acceptances',
     43        'secureprolabs_guard_xmlrpc_notify_after',
    3544        'secureprolabs_guard_password_reset_rate_limiting',
    3645        'secureprolabs_guard_rate_limit_cf7',
    … …  
    4554        'secureprolabs_guard_xmlrpc_mail_after',
    4655        'secureprolabs_guard_xmlrpc_security',
     56        'secureprolabs_guard_migration_done',
    4757    );
    4858
    … …  
    106116        }
    107117
     118        // Cron alert gate: removed directly so it also clears from a persistent object cache.
     119        delete_transient('secureprolabs_guard_cron_notify_gate');
     120
    108121        // Form limit counters are short lived transients (at most the configured window,
    109122        // 24 hours at most). With a persistent object cache they are not stored in the
    … …  
    111124        $logs_table = $wpdb->prefix . 'secureprolabs_guard_logs';
    112125        $lockouts_table = $wpdb->prefix . 'secureprolabs_guard_lockouts';
    113         $wpdb->query($wpdb->prepare('DROP TABLE IF EXISTS %i, %i', $logs_table, $lockouts_table));
     126        $notices_table = $wpdb->prefix . 'secureprolabs_guard_notices';
     127        $findings_table = $wpdb->prefix . 'secureprolabs_guard_findings';
     128        $wpdb->query($wpdb->prepare('DROP TABLE IF EXISTS %i, %i, %i, %i', $logs_table, $lockouts_table, $notices_table, $findings_table));
    114129
    115130        wp_clear_scheduled_hook('secureprolabs_guard_cleanup_logs');
    116131        wp_clear_scheduled_hook('secureprolabs_guard_lockout_expiry_check');
     132        wp_clear_scheduled_hook('secureprolabs_guard_notify_dispatch');
     133        wp_clear_scheduled_hook('secureprolabs_guard_notify_digest');
    117134    }
    118135}
Note: See TracChangeset for help on using the changeset viewer.