emailengine-app 2.87.1 → 2.87.2
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +8 -0
- package/lib/dbsc/index.js +292 -0
- package/lib/dbsc/jwt.js +157 -0
- package/lib/dbsc/protocol.js +132 -0
- package/lib/dbsc/store.js +136 -0
- package/lib/privileged-settings.js +6 -0
- package/lib/routes-ui.js +4 -1
- package/lib/schemas.js +8 -0
- package/lib/session-default.js +13 -3
- package/lib/ui-routes/admin-config-routes.js +27 -5
- package/lib/ui-routes/auth-routes.js +4 -0
- package/lib/ui-routes/dbsc-routes.js +43 -0
- package/package.json +1 -1
- package/static/css/flyonui.css +1 -1
- package/views/config/security.hbs +37 -0
- package/workers/api.js +20 -2
|
@@ -32,6 +32,43 @@
|
|
|
32
32
|
comma-separated IP addresses or CIDR ranges (e.g., "192.168.1.1,10.0.0.0/24").</span>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
+
<div>
|
|
36
|
+
{{> ui/setting-ref name="dbscEnabled"}}
|
|
37
|
+
|
|
38
|
+
{{#> ui/checkbox id="dbscEnabled" name="dbscEnabled" label="Device-Bound Admin Sessions"
|
|
39
|
+
checked=values.dbscEnabled error=errors.dbscEnabled}}
|
|
40
|
+
{{> ui/badge label="Beta" variant="info" soft=true}}
|
|
41
|
+
{{#if values.dbscEnabled}}
|
|
42
|
+
{{#if dbsc.active}}
|
|
43
|
+
{{> ui/badge label="enabled" variant="success"}}
|
|
44
|
+
{{else}}
|
|
45
|
+
{{> ui/badge label="inactive" variant="warning"}}
|
|
46
|
+
{{/if}}
|
|
47
|
+
{{else}}
|
|
48
|
+
{{> ui/badge label="disabled" variant="neutral"}}
|
|
49
|
+
{{/if}}
|
|
50
|
+
{{/ui/checkbox}}
|
|
51
|
+
<span class="helper-text">Ties each admin sign-in to a key in the device's security hardware, so a
|
|
52
|
+
copied session cookie stops working within minutes. Chrome on Windows and macOS binds
|
|
53
|
+
automatically; other browsers sign in as before.</span>
|
|
54
|
+
{{#if values.dbscEnabled}}
|
|
55
|
+
<p id="dbscCurrentSession" class="mt-2 flex items-start gap-1.5 text-sm">
|
|
56
|
+
{{#unless dbsc.active}}
|
|
57
|
+
<span class="icon-[tabler--alert-triangle] size-4 shrink-0 mt-0.5 text-warning"></span>
|
|
58
|
+
<span class="text-base-content/80">Not active: browsers only bind sessions on https. Set an https
|
|
59
|
+
<a href="/admin/config/service" class="link link-animated">Service URL</a> to turn it on.</span>
|
|
60
|
+
{{else if dbsc.currentBound}}
|
|
61
|
+
<span class="icon-[tabler--shield-check] size-4 shrink-0 mt-0.5 text-success"></span>
|
|
62
|
+
<span>This browser is bound to this device.</span>
|
|
63
|
+
{{else}}
|
|
64
|
+
<span class="icon-[tabler--shield] size-4 shrink-0 mt-0.5 text-base-content/60"></span>
|
|
65
|
+
<span class="text-base-content/80">This browser is not bound yet. A supported browser binds on its next
|
|
66
|
+
page load.</span>
|
|
67
|
+
{{/unless}}
|
|
68
|
+
</p>
|
|
69
|
+
{{/if}}
|
|
70
|
+
</div>
|
|
71
|
+
|
|
35
72
|
<div>
|
|
36
73
|
{{> ui/setting-ref name="EENGINE_ENABLE_OAUTH_TOKENS_API" plain=true}}
|
|
37
74
|
{{> ui/checkbox id="enableOAuthTokensApi" name="enableOAuthTokensApi"
|
package/workers/api.js
CHANGED
|
@@ -87,6 +87,7 @@ const tokenAuditLog = require('../lib/token-audit-log');
|
|
|
87
87
|
const { redis } = require('../lib/db');
|
|
88
88
|
const { createHealthChecks } = require('../lib/health');
|
|
89
89
|
const { requireSessionOnceSecured, TOTP_EXEMPT_PATHS } = require('../lib/session-default');
|
|
90
|
+
const { setupDbsc, registerDbscExtensions } = require('../lib/dbsc');
|
|
90
91
|
const { Account } = require('../lib/account');
|
|
91
92
|
const settings = require('../lib/settings');
|
|
92
93
|
|
|
@@ -690,7 +691,16 @@ function registerRequestContextExtension(server) {
|
|
|
690
691
|
|
|
691
692
|
// Both settings are needed on every request and neither depends on the other, so they are
|
|
692
693
|
// read in a single HMGET rather than two serialized round trips
|
|
693
|
-
let { enableApiProxy, disableTokens, serviceUrl } = await settings.getMulti(
|
|
694
|
+
let { enableApiProxy, disableTokens, serviceUrl, dbscEnabled } = await settings.getMulti(
|
|
695
|
+
'enableApiProxy',
|
|
696
|
+
'disableTokens',
|
|
697
|
+
'serviceUrl',
|
|
698
|
+
'dbscEnabled'
|
|
699
|
+
);
|
|
700
|
+
|
|
701
|
+
// Device-bound admin sessions only work on an https origin, which is what serviceUrl says
|
|
702
|
+
// the admin UI is reached on (the same signal that marks the cookies Secure)
|
|
703
|
+
request.app.dbscEnabled = !!dbscEnabled && isSecureOrigin(serviceUrl);
|
|
694
704
|
|
|
695
705
|
// Before anything can render a view (the allowlist refusal below does), so the nonce
|
|
696
706
|
// the template stamps on its scripts is the one the response header carries
|
|
@@ -832,11 +842,13 @@ async function registerSessionAuth(server) {
|
|
|
832
842
|
isSecure: secureCookie
|
|
833
843
|
});
|
|
834
844
|
|
|
845
|
+
const cookiePassword = await settings.get('cookiePassword');
|
|
846
|
+
|
|
835
847
|
// Authentication for admin pages
|
|
836
848
|
server.auth.strategy('session', 'cookie', {
|
|
837
849
|
cookie: {
|
|
838
850
|
name: 'ee',
|
|
839
|
-
password:
|
|
851
|
+
password: cookiePassword,
|
|
840
852
|
isSecure: secureCookie,
|
|
841
853
|
path: '/',
|
|
842
854
|
isSameSite: 'Lax'
|
|
@@ -923,6 +935,9 @@ async function registerSessionAuth(server) {
|
|
|
923
935
|
}
|
|
924
936
|
});
|
|
925
937
|
|
|
938
|
+
// Device-bound sessions ride on the same cookie settings (lib/dbsc)
|
|
939
|
+
setupDbsc(server, { redis, logger, secure: secureCookie, password: cookiePassword });
|
|
940
|
+
|
|
926
941
|
return secureCookie;
|
|
927
942
|
}
|
|
928
943
|
|
|
@@ -3218,6 +3233,9 @@ const init = async () => {
|
|
|
3218
3233
|
|
|
3219
3234
|
registerTotpExtension(server);
|
|
3220
3235
|
|
|
3236
|
+
// After the TOTP step and the error pages, see registerDbscExtensions()
|
|
3237
|
+
registerDbscExtensions(server);
|
|
3238
|
+
|
|
3221
3239
|
registerChangesRoute(server);
|
|
3222
3240
|
|
|
3223
3241
|
// setup web UI
|