domma-cms 0.84.0 → 0.84.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"note": "Written by `make sync-free-tier` in dcms-marketplace. Do not edit these plugins here - edit them there and sync.",
|
|
3
|
-
"source": "dcms-marketplace@
|
|
3
|
+
"source": "dcms-marketplace@46444b1",
|
|
4
4
|
"plugins": {
|
|
5
5
|
"blog": {
|
|
6
6
|
"version": "1.6.3",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"security": {
|
|
80
|
-
"version": "1.0.
|
|
80
|
+
"version": "1.0.3",
|
|
81
81
|
"files": {
|
|
82
82
|
"CLAUDE.md": "a9b7574236740de80513a535fb761127fa306f2177a5dda6e761213b1ad5b287",
|
|
83
83
|
"admin/lib/blocks.js": "5ef346b7de751518f8beb9212e3b89b270ae236560ae3d8a1f40d129c50918ff",
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
"admin/views/security.js": "dcd38e07c5e83bbe013f5d764c52edef76d28ed4c3fe1cba8c5a59ce1b93e962",
|
|
92
92
|
"bin/unlock.js": "5fcc3c0ef3ba3c424a366aa62896f51abad578183dfde283aa838a86549ca785",
|
|
93
93
|
"config.js": "e6a00f7816637687d6a68ebbac65a71489246a926c28523c2a78d859e75b7ae0",
|
|
94
|
-
"plugin.js": "
|
|
95
|
-
"plugin.json": "
|
|
94
|
+
"plugin.js": "3051c886f77b1b1e7f45873fbdcd78a5ba2d72caea97bde1235e84a298ab6114",
|
|
95
|
+
"plugin.json": "bdcc88f0f5dec2d707806687ca80e1697255af49b4f30f43650e3824775deef8",
|
|
96
96
|
"server/common-passwords.NOTICE": "3b148a49a569bfa24feaa7879db602da8f0607fa61ab6c52b7a62391fc7c009a",
|
|
97
97
|
"server/common-passwords.txt": "68782d6a4a19a4768d5f15dd66bd534e7a33055cc755411e33f16d18c50fdcce",
|
|
98
|
-
"server/facts.js": "
|
|
98
|
+
"server/facts.js": "25538a8d1cfe012688fceb8ec0d0dd7b43ac9e168430723d6fb731183701fb46",
|
|
99
99
|
"server/state.js": "1319b322e94a4aec176948990b2d674b28dfece761eef4d5685df474037bfc4a",
|
|
100
100
|
"tests/security.test.js": "951636a0e42ac8dbf78b69ca7e7e2adcd4e29d94a51998e738c3afa742c00866"
|
|
101
101
|
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* GET|PUT /settings
|
|
20
20
|
*/
|
|
21
21
|
import fs from 'node:fs';
|
|
22
|
+
import os from 'node:os';
|
|
22
23
|
import path from 'node:path';
|
|
23
24
|
import {fileURLToPath} from 'node:url';
|
|
24
25
|
import fp from 'fastify-plugin';
|
|
@@ -40,6 +41,14 @@ const NAME = 'security';
|
|
|
40
41
|
/** A call from this machine itself, not a relayed visitor. */
|
|
41
42
|
const genuinelyLocal = (request) => isLoopbackIp(request.raw?.socket?.remoteAddress) && !request.headers['x-forwarded-for'];
|
|
42
43
|
|
|
44
|
+
/**
|
|
45
|
+
* This machine's own addresses (public ones included). A request from one is the
|
|
46
|
+
* server calling itself through the public name - a site's health check, Site
|
|
47
|
+
* Manager's certificate checks - and is never blocked or counted as probing.
|
|
48
|
+
*/
|
|
49
|
+
const OWN = new Set(Object.values(os.networkInterfaces()).flat().filter(Boolean).map(i => plainIp(i.address)));
|
|
50
|
+
const isOwnAddress = (ip) => OWN.has(plainIp(ip));
|
|
51
|
+
|
|
43
52
|
let commonPasswords = null;
|
|
44
53
|
function common() {
|
|
45
54
|
if (commonPasswords) return commonPasswords;
|
|
@@ -72,6 +81,7 @@ async function security(fastify, options = {}) {
|
|
|
72
81
|
try {
|
|
73
82
|
if (genuinelyLocal(request)) return;
|
|
74
83
|
const ip = plainIp(request.ip);
|
|
84
|
+
if (isOwnAddress(ip)) return;
|
|
75
85
|
const now = Date.now();
|
|
76
86
|
const s = state.get();
|
|
77
87
|
const blocked = blockedBy(s, ip, now);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "security",
|
|
3
3
|
"displayName": "Security",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"tier": "free",
|
|
6
6
|
"description": "Keeps a Domma CMS site safe: a health check of what is weak and how to fix it, sign-in lockout after repeated wrong passwords, password rules, a log of every sign-in, and blocking of the scanners that probe every site for WordPress, .env files and the like.",
|
|
7
7
|
"author": "Domma CMS",
|
|
@@ -112,7 +112,9 @@ export async function gatherFacts(request, {settings, checks, twoFactor = false}
|
|
|
112
112
|
const [eng, cert, head, probes] = await Promise.all([
|
|
113
113
|
engine(),
|
|
114
114
|
isLocalHost(host) ? Promise.resolve(null) : certificate(host),
|
|
115
|
-
|
|
115
|
+
// Headers and HTTPS are about the PUBLIC site: without a public name to ask (a check run by the site
|
|
116
|
+
// itself, or on localhost) they are left unanswered rather than judged on the local port.
|
|
117
|
+
isLocalHost(host) ? Promise.resolve(null) : headers(origin),
|
|
116
118
|
probeFiles(port)
|
|
117
119
|
]);
|
|
118
120
|
const smtp = getConfig('site')?.smtp || {};
|