emailengine-app 2.79.3 → 2.79.4

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "2.79.3"
2
+ ".": "2.79.4"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.79.4](https://github.com/postalsys/emailengine/compare/v2.79.3...v2.79.4) (2026-08-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **accounts:** let re-authorization bring back an account the safety net switched off ([b4f04f5](https://github.com/postalsys/emailengine/commit/b4f04f54ce37342c69bbcda65f8b5eb1a331423c))
9
+ * **accounts:** report a switched-off account, and stop pretending to reconnect it ([6c19ea2](https://github.com/postalsys/emailengine/commit/6c19ea2cf05ea49d212b8fdbcd12aa9d8a6e36f5))
10
+ * **admin:** serve the SBOM download from the admin surface ([96aa63e](https://github.com/postalsys/emailengine/commit/96aa63ee1aaa409d1f279b4fffa89e1e04317484))
11
+
3
12
  ## [2.79.3](https://github.com/postalsys/emailengine/compare/v2.79.2...v2.79.3) (2026-08-24)
4
13
 
5
14
 
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Reads an account's stored `imap` blob.
5
+ *
6
+ * Three call sites need it before, or instead of, a full account load: the connection gate that
7
+ * asks whether syncing is switched off, the safety net that switches it off, and the recovery path
8
+ * that switches it back on. They all have to treat an unreadable blob the same way - rewriting one
9
+ * that does not parse would replace the account's IMAP configuration with a bare flag - so the
10
+ * decision lives here rather than in three copies of the same try/catch.
11
+ *
12
+ * @param {Object} redis - ioredis client
13
+ * @param {String} accountKey - Redis key of the account hash
14
+ * @param {Object} logger - Logger for the parse failure
15
+ * @param {String} [imapInfo] - The raw field when the caller has already read it, to save a round trip
16
+ * @returns {Promise<{imapData: Object|null, invalid: Boolean}>} The parsed blob, or null with
17
+ * `invalid` telling an absent field (an OAuth2 account has none) apart from an unreadable one
18
+ */
19
+ async function readImapData(redis, accountKey, logger, imapInfo) {
20
+ if (imapInfo === undefined) {
21
+ imapInfo = await redis.hget(accountKey, 'imap');
22
+ }
23
+
24
+ if (!imapInfo) {
25
+ return { imapData: null, invalid: false };
26
+ }
27
+
28
+ try {
29
+ return { imapData: JSON.parse(imapInfo), invalid: false };
30
+ } catch (err) {
31
+ logger.error({ msg: 'Failed parsing IMAP data', err });
32
+ return { imapData: null, invalid: true };
33
+ }
34
+ }
35
+
36
+ module.exports = { readImapData };
package/lib/account.js CHANGED
@@ -26,18 +26,19 @@ const settings = require('./settings');
26
26
  const { buildRetentionPolicy } = require('./queue-retention');
27
27
  const { isDocumentStoreEnabled, documentStoreFeatureEnabled } = require('./document-store');
28
28
  const redisScanDelete = require('./redis-scan-delete');
29
- const { extractMultiValues } = require('./redis-operations');
29
+ const { extractMultiValues, createTransaction } = require('./redis-operations');
30
30
  const outbox = require('./outbox');
31
31
  const tokens = require('./tokens');
32
32
  const { customAlphabet } = require('nanoid');
33
33
  const Lock = require('ioredfour');
34
34
  const { redis } = require('./db');
35
35
  const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 16);
36
- const { REDIS_PREFIX, ACCOUNT_DELETED_NOTIFY } = require('./consts');
36
+ const { REDIS_PREFIX, ACCOUNT_DELETED_NOTIFY, AUTH_FAILURE_DISABLED_FIELD } = require('./consts');
37
37
  const { messageWebSafeHtml, webSafeTextResponse, applyWebSafeHtmlOptions } = require('./web-safe-html');
38
38
  const { checkAccountScopes: checkScopes } = require('./oauth/scope-checker');
39
39
  const { ACCOUNT_STATES, ERROR_STATES, calculateEffectiveState, validateAccountState, getDisplayState, formatLastError } = require('./account/account-state');
40
40
  const { decodeStoredMailboxEntry } = require('./email-client/imap/listing-diff');
41
+ const { readImapData } = require('./account/imap-data');
41
42
 
42
43
  // Shared Lock instance to prevent Redis connection leak (one subscriber per Lock instance)
43
44
  // Previously, each Account created its own Lock, causing ~30k connections with 30k accounts
@@ -51,6 +52,54 @@ const defaultLock = new Lock({
51
52
  const ACCOUNT_UPDATE_LOCK_TTL = 10 * 1000;
52
53
  const ACCOUNT_UPDATE_LOCK_WAIT = 5 * 1000;
53
54
 
55
+ /**
56
+ * What an incoming account payload asks of `imap.disabled`.
57
+ *
58
+ * Must be read before persistUpdate() merges a `partial` payload into the stored object, which
59
+ * would otherwise pull `disabled` in from the old blob and make every partial update look like a
60
+ * decision about the flag.
61
+ *
62
+ * @param {Object} accountData - Account fields about to be written
63
+ * @returns {Boolean|null} What the payload sets the flag to, or null when it says nothing about it
64
+ */
65
+ function imapDisabledIntent(accountData) {
66
+ if (!accountData.imap || typeof accountData.imap !== 'object' || !('disabled' in accountData.imap)) {
67
+ return null;
68
+ }
69
+ return !!accountData.imap.disabled;
70
+ }
71
+
72
+ /**
73
+ * Whether syncing was switched off for an account, by either route.
74
+ *
75
+ * @param {Object} accountData - An unserialized account
76
+ * @returns {Boolean} True when `imap.disabled` is set
77
+ */
78
+ function isImapDisabled(accountData) {
79
+ return !!(accountData && accountData.imap && accountData.imap.disabled);
80
+ }
81
+
82
+ /**
83
+ * When the auth-failure safety net switched an account off, as opposed to the operator doing it.
84
+ *
85
+ * The single answer to "is this account parked", used by every surface that reports one: the API
86
+ * field, the admin state badge, the page alert, and the reconnect dispatches in create()/update().
87
+ *
88
+ * Both halves of the test matter. The marker can outlive the flag - an operator re-enables the
89
+ * account by hand and the stale marker is only retired on the next recovery pass - so reading it
90
+ * alone would report a healthy, syncing account as switched off. And re-authorizing a healthy
91
+ * account must not trigger the reconnect that un-parking one does.
92
+ *
93
+ * @param {Object} accountData - An unserialized account, carrying `_authFailureDisabledAt`
94
+ * @returns {String|null} ISO timestamp of the disable, or null when the safety net did not park it
95
+ */
96
+ function authFailureDisabledAt(accountData) {
97
+ if (!accountData || !accountData._authFailureDisabledAt || !isImapDisabled(accountData)) {
98
+ return null;
99
+ }
100
+ return accountData._authFailureDisabledAt;
101
+ }
102
+
54
103
  class Account {
55
104
  constructor(options) {
56
105
  this.redis = options.redis;
@@ -302,6 +351,10 @@ class Account {
302
351
 
303
352
  syncTime: accountData.sync,
304
353
 
354
+ // Lets a caller find every account the safety net parked without opening each one.
355
+ // Omitted rather than null when it did not, like the optional fields above.
356
+ authFailureDisabledAt: authFailureDisabledAt(accountData) || undefined,
357
+
305
358
  lastError: formatLastError(accountData),
306
359
 
307
360
  delegationError: accountData.delegationError || undefined
@@ -349,6 +402,15 @@ class Account {
349
402
  unserializeAccountData(accountData) {
350
403
  const result = {};
351
404
 
405
+ // The loop below drops every `_`-prefixed field, which is what keeps the auth-failure marker
406
+ // out of API responses - but the state label and the recovery paths both need it, and it is
407
+ // already in every hash read. Carry it across explicitly, under a name that is NOT the
408
+ // stored field's: a loaded account fed back through serializeAccountData then cannot
409
+ // resurrect a marker that has since been retired.
410
+ if (accountData[AUTH_FAILURE_DISABLED_FIELD]) {
411
+ result._authFailureDisabledAt = accountData[AUTH_FAILURE_DISABLED_FIELD];
412
+ }
413
+
352
414
  const counters = {};
353
415
 
354
416
  Object.keys(accountData).forEach(key => {
@@ -820,6 +882,9 @@ class Account {
820
882
  * @returns {Promise<Object>} `{ account }`
821
883
  */
822
884
  async update(accountData, { reauthorized = false } = {}) {
885
+ // Captured before persistUpdate() merges a `partial` payload into the stored object
886
+ const disabledIntent = imapDisabledIntent(accountData);
887
+
823
888
  const lock = this.getLock();
824
889
  const lockKey = `account:update:${accountData.account}`;
825
890
  let updateLock;
@@ -849,7 +914,7 @@ class Account {
849
914
  }
850
915
  }
851
916
 
852
- await this.dispatchPostUpdateCommands(accountData, oldAccountData, reauthorized);
917
+ await this.dispatchPostUpdateCommands(accountData, oldAccountData, reauthorized, disabledIntent);
853
918
 
854
919
  return {
855
920
  account: this.account
@@ -976,9 +1041,11 @@ class Account {
976
1041
  * @param {Object} accountData - The fields that were just written
977
1042
  * @param {Object} oldAccountData - The account as it was before the write
978
1043
  * @param {boolean} reauthorized - Whether the caller supplied fresh operator credentials
1044
+ * @param {Boolean|null} disabledIntent - What the payload asked of `imap.disabled`, read before
1045
+ * persistUpdate() merged it
979
1046
  * @returns {Promise<void>} Resolves once the dispatch has been attempted
980
1047
  */
981
- async dispatchPostUpdateCommands(accountData, oldAccountData, reauthorized) {
1048
+ async dispatchPostUpdateCommands(accountData, oldAccountData, reauthorized, disabledIntent) {
982
1049
  let reconnectRequested = false;
983
1050
 
984
1051
  if ('imap' in accountData && !reconnectRequested) {
@@ -1024,37 +1091,43 @@ class Account {
1024
1091
  }
1025
1092
  }
1026
1093
 
1027
- // When OAuth2 credentials are re-authorized for an account that is currently in a
1028
- // non-operational error state, trigger a full reconnect so syncing resumes without a
1029
- // manual "Reconnect".
1030
- //
1031
- // Requires explicit `reauthorized` intent from the caller. Account state cannot be used
1032
- // to infer it: unattended token renewal persists through update() as well, and it runs
1033
- // while the stored state is still the error state, so a state-only gate re-fired on every
1034
- // renewal and dispatched cmd:'reconnect'. That rebuilt the client, discarding its backoff,
1035
- // and invalidateAccessToken() forced the next cycle to renew again - latching a reconnect
1094
+ // Whether this update carries OAuth2 credentials the operator just re-authorized. The
1095
+ // `reauthorized` intent has to be explicit: account state cannot be used to infer it,
1096
+ // because unattended token renewal persists through update() as well, and it runs while
1097
+ // the stored state is still the error state. A state-only gate re-fired on every renewal
1098
+ // and dispatched cmd:'reconnect'. That rebuilt the client, discarding its backoff, and
1099
+ // invalidateAccessToken() forced the next cycle to renew again - latching a reconnect
1036
1100
  // loop that pinned the CPU at ~100%.
1037
- if (
1101
+ const oauth2Reauthorized =
1038
1102
  reauthorized &&
1039
- !reconnectRequested &&
1040
- accountData.oauth2?.accessToken &&
1041
- (accountData.oauth2.accessToken !== oldAccountData.oauth2?.accessToken ||
1042
- accountData.oauth2.refreshToken !== oldAccountData.oauth2?.refreshToken) &&
1043
- ERROR_STATES.includes(oldAccountData.state)
1044
- ) {
1103
+ !!accountData.oauth2?.accessToken &&
1104
+ (accountData.oauth2.accessToken !== oldAccountData.oauth2?.accessToken || accountData.oauth2.refreshToken !== oldAccountData.oauth2?.refreshToken);
1105
+
1106
+ // A reconnect cannot resume an account the auth-failure safety net has switched off, so
1107
+ // settle that first. For a password account the operator clears the flag by saving new IMAP
1108
+ // settings, but an OAuth2 account has none to save - the re-authorization IS the fix, and
1109
+ // without this the account stays off until somebody hand-edits it through the API.
1110
+ //
1111
+ // The lift is deliberately NOT gated on the account state, unlike the reconnect below: a
1112
+ // parked account does not sit in an error state, it reports `unset` (persisted on every
1113
+ // init for Gmail API and Outlook accounts), so by the time the operator re-authorizes, the
1114
+ // error state the old gate required is long gone.
1115
+ await this.resolveAuthFailureDisable(disabledIntent, oldAccountData, oauth2Reauthorized);
1116
+
1117
+ // Re-authorization for an account that is currently non-operational triggers a full
1118
+ // reconnect so syncing resumes without a manual "Reconnect". Being switched off is such a
1119
+ // state, and one the account cannot leave on its own. Read off the account as it stood
1120
+ // before the write, for the same reason as in create().
1121
+ const wasParked = !!authFailureDisabledAt(oldAccountData);
1122
+
1123
+ if (oauth2Reauthorized && !reconnectRequested && (ERROR_STATES.includes(oldAccountData.state) || wasParked)) {
1045
1124
  this.logger.info({
1046
- msg: 'OAuth2 credentials re-authorized for account in error state, requesting reconnect',
1125
+ msg: 'OAuth2 credentials re-authorized for non-operational account, requesting reconnect',
1047
1126
  account: this.account,
1048
- state: oldAccountData.state
1127
+ state: oldAccountData.state,
1128
+ wasParked
1049
1129
  });
1050
1130
 
1051
- // A reconnect cannot resume an account that the auth-failure safety net has switched
1052
- // off, so lift that first. For a password account the operator clears the flag by
1053
- // saving new IMAP settings, but an OAuth2 account has no IMAP settings to save - the
1054
- // re-authorization IS the fix, and without this the account would stay off until
1055
- // somebody hand-edited it through the API.
1056
- await this.clearAuthFailureDisable();
1057
-
1058
1131
  if (typeof this.call === 'function') {
1059
1132
  try {
1060
1133
  await this.call({
@@ -1097,37 +1170,94 @@ class Account {
1097
1170
  return id;
1098
1171
  }
1099
1172
 
1173
+ /**
1174
+ * Resolves the auth-failure disable against an account write that has just been persisted.
1175
+ *
1176
+ * @param {Boolean|null} disabledIntent - What the write asked of `imap.disabled`, from
1177
+ * imapDisabledIntent(), read before any partial merge
1178
+ * @param {Object} oldAccountData - The account as it stood before the write
1179
+ * @param {Boolean} mayLift - Whether this write is an explicit re-authorization, the only kind
1180
+ * that may resume a parked account on its own
1181
+ * @returns {Promise<Boolean>} True when this call re-enabled the account
1182
+ */
1183
+ async resolveAuthFailureDisable(disabledIntent, oldAccountData, mayLift) {
1184
+ if (disabledIntent === true) {
1185
+ // The write asks for IMAP to stay off, so there is nothing to lift. It takes ownership
1186
+ // of the flag only when it is what turned it on: the admin edit form submits its
1187
+ // "Disable IMAP" checkbox on every save, pre-checked from the stored flag, so treating
1188
+ // that restatement as a decision would let an unrelated save silently convert an
1189
+ // automatic park into a deliberate one - taking the page alert, the state badge and
1190
+ // "Resume syncing" with it, and leaving the account unrecoverable by re-authorization.
1191
+ if (!isImapDisabled(oldAccountData)) {
1192
+ await this.redis.hdel(this.getAccountKey(), AUTH_FAILURE_DISABLED_FIELD);
1193
+ }
1194
+ return false;
1195
+ }
1196
+
1197
+ // An explicit `disabled: false` has already re-enabled the account by itself, and the call
1198
+ // below retires the marker it leaves behind. Anything else may only lift a park when the
1199
+ // operator actually re-authorized.
1200
+ if (disabledIntent === false || mayLift) {
1201
+ return await this.clearAuthFailureDisable();
1202
+ }
1203
+
1204
+ return false;
1205
+ }
1206
+
1100
1207
  /**
1101
1208
  * Re-enables an account that setErrorState() switched off after a run of authentication
1102
- * failures. Called when fresh credentials arrive for an account in an error state.
1209
+ * failures. Called whenever fresh credentials arrive for the account, and by the admin UI's
1210
+ * "Resume syncing" action.
1211
+ *
1212
+ * Only ever lifts the safety net's own disable, never the operator's send-only switch - see
1213
+ * AUTH_FAILURE_DISABLED_FIELD for why the two need telling apart.
1103
1214
  *
1104
- * Reads the stored value rather than trusting the copy loaded before the update, because the
1215
+ * Reads the stored values rather than trusting the copy loaded before the update, because the
1105
1216
  * same update may have rewritten the `imap` field.
1106
1217
  *
1107
1218
  * @returns {Promise<Boolean>} True when a disable flag was actually lifted
1108
1219
  */
1109
1220
  async clearAuthFailureDisable() {
1110
- let imapInfo = await this.redis.hget(this.getAccountKey(), 'imap');
1111
- if (!imapInfo) {
1221
+ const accountKey = this.getAccountKey();
1222
+
1223
+ const [disabledAt, imapInfo] = await this.redis.hmget(accountKey, AUTH_FAILURE_DISABLED_FIELD, 'imap');
1224
+ if (!disabledAt) {
1225
+ // Either never parked, or an operator has already dealt with it. Not ours to lift.
1112
1226
  return false;
1113
1227
  }
1114
1228
 
1115
- let imapData;
1116
- try {
1117
- imapData = JSON.parse(imapInfo);
1118
- } catch (err) {
1119
- this.logger.error({ msg: 'Failed parsing IMAP data', account: this.account, err });
1229
+ const { imapData, invalid } = await readImapData(this.redis, accountKey, this.logger, imapInfo);
1230
+ if (invalid) {
1231
+ // Leave an unreadable configuration alone rather than replacing it with a bare flag.
1120
1232
  return false;
1121
1233
  }
1122
1234
 
1123
1235
  if (!imapData || !imapData.disabled) {
1236
+ // The flag is already gone - an operator re-enabled the account by hand, or a full
1237
+ // `imap` rewrite dropped it. Retire the marker so it cannot authorize lifting a
1238
+ // later, deliberate disable.
1239
+ await this.redis.hdel(accountKey, AUTH_FAILURE_DISABLED_FIELD);
1124
1240
  return false;
1125
1241
  }
1126
1242
 
1127
1243
  imapData.disabled = false;
1128
- await this.redis.hset(this.getAccountKey(), 'imap', JSON.stringify(imapData));
1129
1244
 
1130
- this.logger.info({ msg: 'Re-enabled IMAP for account after re-authorization', account: this.account });
1245
+ // hSetExists rather than hset, so a concurrent account delete cannot be resurrected as a
1246
+ // hash holding nothing but this flag. Same reason disableAfterAuthFailures() writes it
1247
+ // that way.
1248
+ const clearTxn = createTransaction(this.redis, { logger: this.logger });
1249
+ clearTxn.add('hSetExists', accountKey, 'imap', JSON.stringify(imapData));
1250
+ clearTxn.add('hdel', accountKey, AUTH_FAILURE_DISABLED_FIELD);
1251
+ const { error } = await clearTxn.exec();
1252
+
1253
+ if (error) {
1254
+ // Report what happened rather than a lifted flag the caller would follow with a
1255
+ // reconnect into an account that is still switched off.
1256
+ this.logger.error({ msg: 'Failed to re-enable IMAP for account', account: this.account, err: error });
1257
+ return false;
1258
+ }
1259
+
1260
+ this.logger.info({ msg: 'Re-enabled IMAP for account after re-authorization', account: this.account, disabledAt });
1131
1261
 
1132
1262
  return true;
1133
1263
  }
@@ -1215,8 +1345,17 @@ class Account {
1215
1345
  // existing user
1216
1346
  state = 'existing';
1217
1347
 
1348
+ // The account as it stood before the hmset above, from the snapshot the same pipeline
1349
+ // took. Read twice below - for the provider rebinding and for the recovery dispatch -
1350
+ // so it is unserialized once, outside the guard that only covers the rebinding.
1351
+ let oldAccountData = {};
1352
+ try {
1353
+ oldAccountData = this.unserializeAccountData(result[0][1]);
1354
+ } catch (err) {
1355
+ this.logger.error({ msg: 'Failed to read the stored account', account: this.account, err });
1356
+ }
1357
+
1218
1358
  try {
1219
- let oldAccountData = this.unserializeAccountData(result[0][1]);
1220
1359
  if (oldAccountData?.oauth2?.provider && oldAccountData?.oauth2?.auth?.user && oldAccountData.oauth2.provider !== accountData.oauth2?.provider) {
1221
1360
  // remove previous entry if provider was updated
1222
1361
  await this.redis.hdel(`${REDIS_PREFIX}oapp:h:${oldAccountData.oauth2.provider}`, oldAccountData.oauth2.auth?.user?.toLowerCase());
@@ -1225,22 +1364,36 @@ class Account {
1225
1364
  // ignore
1226
1365
  }
1227
1366
 
1367
+ // Re-registration is the operator supplying fresh credentials, and for an account the
1368
+ // auth-failure safety net has switched off it is the whole fix: the hosted
1369
+ // authentication form and POST /v1/account both land here, and neither has any other
1370
+ // way to reach the flag. Without this an OAuth2 account stayed parked no matter how
1371
+ // many times it was re-authorized, because create() writes no `imap` field of its own
1372
+ // and the synthesized `{"disabled":true}` blob survived untouched.
1373
+ //
1374
+ // The reconnect is decided by what was stored BEFORE this write, not by whether the
1375
+ // flag ended up lifted: a payload asking for IMAP to stay off lifts nothing, and either
1376
+ // way the account was not connecting and this write is what changed that.
1377
+ const wasParked = !!authFailureDisabledAt(oldAccountData);
1378
+ await this.resolveAuthFailureDisable(imapDisabledIntent(accountData), oldAccountData, true);
1379
+
1228
1380
  const oldState = result[0][1].state;
1229
- if (ERROR_STATES.includes(oldState)) {
1230
- // Re-registration of an account that was in a non-operational error state (the
1231
- // interactive OAuth re-auth redirect and the IMAP re-credentials form both land here).
1381
+ if (ERROR_STATES.includes(oldState) || wasParked) {
1382
+ // Re-registration of an account that is not operational (the interactive OAuth
1383
+ // re-auth redirect and the IMAP re-credentials form both land here).
1232
1384
  // cmd:'update' only calls reconnect() on the existing client instance, which cannot
1233
1385
  // switch client type (IMAP to API or back) and is a no-op against a torn-down
1234
1386
  // connection, so syncing would not resume without a manual "Reconnect". cmd:'reconnect'
1235
1387
  // closes and re-assigns a fresh client of the correct provider type. assignConnection
1236
1388
  // sets the state to "connecting" before any network work, so this cannot loop.
1237
- // Gated on the error state alone (unlike update(), which also requires the oauth2
1238
- // token to have changed): create() runs only on explicit re-registration, never on
1239
- // routine token renewal, so there is no healthy-account churn to suppress here.
1389
+ // Needs no credential-change check (unlike update()): create() runs only on explicit
1390
+ // re-registration, never on routine token renewal, so there is no healthy-account
1391
+ // churn to suppress here.
1240
1392
  this.logger.info({
1241
- msg: 'Account re-created while in error state, requesting full reconnect',
1393
+ msg: 'Account re-created while not operational, requesting full reconnect',
1242
1394
  account: this.account,
1243
- state: oldState
1395
+ state: oldState,
1396
+ wasParked
1244
1397
  });
1245
1398
  try {
1246
1399
  await this.call({
@@ -2629,18 +2782,38 @@ class Account {
2629
2782
  );
2630
2783
  }
2631
2784
 
2785
+ /**
2786
+ * Requests a fresh connection for the account.
2787
+ *
2788
+ * Answers false rather than reporting a reconnect it knows will not happen. A reconnect
2789
+ * rebuilds the client, but init() checks the auth-failure disable before it dials out and
2790
+ * returns without connecting, so for a parked account the dispatch is a no-op - and saying
2791
+ * "reconnecting" to a caller whose account then stays offline is worse than saying no.
2792
+ * Recovering it takes fresh credentials, or the admin UI's "Resume syncing".
2793
+ *
2794
+ * @param {Object} data
2795
+ * @param {Boolean} data.reconnect - Only reconnect when true
2796
+ * @returns {Promise<Boolean>} Whether a reconnect was actually requested
2797
+ */
2632
2798
  async requestReconnect(data) {
2633
- await this.loadAccountData(this.account, false);
2799
+ const accountData = await this.loadAccountData(this.account, false);
2634
2800
 
2635
- if (data.reconnect) {
2636
- await this.call({
2637
- cmd: 'reconnect',
2638
- account: this.account,
2639
- timeout: this.timeout
2640
- });
2641
- return true;
2801
+ if (!data.reconnect) {
2802
+ return false;
2642
2803
  }
2643
- return false;
2804
+
2805
+ const disabledAt = authFailureDisabledAt(accountData);
2806
+ if (disabledAt) {
2807
+ this.logger.info({ msg: 'Skipped reconnect request for an account that is switched off', account: this.account, disabledAt });
2808
+ return false;
2809
+ }
2810
+
2811
+ await this.call({
2812
+ cmd: 'reconnect',
2813
+ account: this.account,
2814
+ timeout: this.timeout
2815
+ });
2816
+ return true;
2644
2817
  }
2645
2818
 
2646
2819
  async requestSync(data) {
@@ -3162,4 +3335,4 @@ async function accountSummary(redis, account) {
3162
3335
  return { account, name: name || '', email: email || '', state: state || 'init' };
3163
3336
  }
3164
3337
 
3165
- module.exports = { Account, accountExists, accountsExist, accountSummary };
3338
+ module.exports = { Account, accountExists, accountsExist, accountSummary, authFailureDisabledAt };
@@ -2,7 +2,7 @@
2
2
 
3
3
  const crypto = require('crypto');
4
4
  const { redis } = require('../db');
5
- const { Account } = require('../account');
5
+ const { Account, authFailureDisabledAt } = require('../account');
6
6
  const getSecret = require('../get-secret');
7
7
  const { oauth2Apps, SERVICE_ACCOUNT_PROVIDERS } = require('../oauth2-apps');
8
8
  const settings = require('../settings');
@@ -888,6 +888,7 @@ async function init(args) {
888
888
  counters: accountCountersSchema,
889
889
 
890
890
  syncTime: Joi.date().iso().example('2021-02-17T13:43:18.860Z').description('Last sync time (IMAP accounts only)'),
891
+ authFailureDisabledAt: accountSchemas.authFailureDisabledAt,
891
892
  lastError: lastErrorSchema.allow(null),
892
893
  delegationError: Joi.string()
893
894
  .example('Delegated account was not found')
@@ -1033,6 +1034,9 @@ async function init(args) {
1033
1034
  result.lastError = accountData.state === 'connected' ? null : accountData.lastErrorState;
1034
1035
  }
1035
1036
 
1037
+ // Stated rather than inferred; see the field's description in lib/schemas.js
1038
+ result.authFailureDisabledAt = authFailureDisabledAt(accountData);
1039
+
1036
1040
  if (accountData.counters) {
1037
1041
  result.counters = accountData.counters;
1038
1042
  }
@@ -1110,6 +1114,8 @@ async function init(args) {
1110
1114
 
1111
1115
  imapIndexer: accountSchemas.imapIndexer,
1112
1116
 
1117
+ authFailureDisabledAt: accountSchemas.authFailureDisabledAt,
1118
+
1113
1119
  subconnections: accountSchemas.subconnections,
1114
1120
 
1115
1121
  webhooks: Joi.string()
package/lib/consts.js CHANGED
@@ -133,6 +133,18 @@ module.exports = {
133
133
  // IF IMAP authentications fail more than provided value, then disable IMAP for the account
134
134
  DEFAULT_MAX_IMAP_AUTH_FAILURE_TIME: 3 * 24 * 3600 * 1000, // 3 days
135
135
 
136
+ // Account hash field recording that the auth-failure safety net, rather than the operator, is
137
+ // what set `imap.disabled`. The two are the same flag - every connection gate already reads it -
138
+ // so without this marker nothing could tell an account parked after repeated authentication
139
+ // failures from one an operator deliberately made send-only, and the recovery paths would
140
+ // silently start syncing a mailbox somebody had switched off on purpose.
141
+ //
142
+ // Its value is the ISO timestamp of the disable. The leading underscore is the convention for a
143
+ // field unserializeAccountData() does not surface under its own name, so it can never ride an
144
+ // account object out into an API response or the OpenAPI document; what a loaded account does
145
+ // carry is the separate, read-only `_authFailureDisabledAt`.
146
+ AUTH_FAILURE_DISABLED_FIELD: '_authFailureDisabled',
147
+
136
148
  REDIS_PREFIX: ((process.env.EENGINE_REDIS_PREFIX || '').toString().trim() + ':').replace(/^:/, ''),
137
149
 
138
150
  REDIS_BATCH_DELETE_SIZE: 1000,
@@ -69,10 +69,12 @@ const {
69
69
  EMAIL_COMPLAINT_NOTIFY,
70
70
  MAX_INLINE_ATTACHMENT_SIZE,
71
71
  DEFAULT_MAX_IMAP_AUTH_FAILURE_TIME,
72
+ AUTH_FAILURE_DISABLED_FIELD,
72
73
  EMAIL_DELIVERY_ERROR_NOTIFY,
73
74
  EMAIL_SENT_NOTIFY
74
75
  } = require('../consts');
75
76
  const { buildRetentionPolicy } = require('../queue-retention');
77
+ const { readImapData } = require('../account/imap-data');
76
78
 
77
79
  // Configure download chunk size from environment or use default
78
80
  const DOWNLOAD_CHUNK_SIZE = getByteSize(readEnvValue('EENGINE_CHUNK_SIZE')) || DEFAULT_DOWNLOAD_CHUNK_SIZE;
@@ -594,18 +596,10 @@ class BaseClient {
594
596
  * @returns {Promise<Boolean>} True when the account must not connect
595
597
  */
596
598
  async isSyncDisabled() {
597
- const imapInfo = await this.redis.hget(this.getAccountKey(), 'imap');
598
- if (!imapInfo) {
599
- return false;
600
- }
601
-
602
- try {
603
- return !!JSON.parse(imapInfo).disabled;
604
- } catch (err) {
605
- // An unreadable blob is not a disable; stay noisy and let the connection proceed.
606
- this.logger.error({ msg: 'Failed parsing IMAP data', err });
607
- return false;
608
- }
599
+ // An unreadable blob is not a disable; readImapData() stays noisy about it and the
600
+ // connection proceeds.
601
+ const { imapData } = await readImapData(this.redis, this.getAccountKey(), this.logger);
602
+ return !!(imapData && imapData.disabled);
609
603
  }
610
604
 
611
605
  /**
@@ -635,17 +629,10 @@ class BaseClient {
635
629
  async disableAfterAuthFailures({ event, firstError, errorCount, data }) {
636
630
  const accountKey = this.getAccountKey();
637
631
 
638
- let imapData;
639
- const imapInfo = await this.redis.hget(accountKey, 'imap');
640
- if (imapInfo) {
641
- try {
642
- imapData = JSON.parse(imapInfo);
643
- } catch (err) {
644
- // Rewriting a blob that does not parse would replace the account's IMAP
645
- // configuration with a bare flag, so leave it alone and stay noisy instead.
646
- this.logger.error({ msg: 'Failed parsing IMAP data', err });
647
- return false;
648
- }
632
+ let { imapData, invalid } = await readImapData(this.redis, accountKey, this.logger);
633
+ if (invalid) {
634
+ // Leave an unreadable configuration alone rather than replacing it with a bare flag.
635
+ return false;
649
636
  }
650
637
 
651
638
  if (!imapData) {
@@ -668,6 +655,10 @@ class BaseClient {
668
655
  // Disable IMAP and reset error counters
669
656
  const disableTxn = createTransaction(this.redis, { logger: this.logger });
670
657
  disableTxn.add('hSetExists', accountKey, 'imap', JSON.stringify(imapData));
658
+ // Records that this disable is ours, not the operator's send-only switch. Account
659
+ // re-registration and re-authorization lift the flag only when this marker is present,
660
+ // so re-authorizing a deliberately send-only account never starts syncing its mailbox.
661
+ disableTxn.add('hSetExists', accountKey, AUTH_FAILURE_DISABLED_FIELD, new Date().toISOString());
671
662
  disableTxn.add('hdel', accountKey, 'lastError:errorCount', 'lastError:first');
672
663
  disableTxn.add(
673
664
  'hSetExists',
@@ -27,7 +27,7 @@ const ENUM_DESCRIPTIONS = {
27
27
  paused: 'Syncing was paused through the API. No connection is maintained',
28
28
  authenticationError: 'The credentials were rejected. Requires re-authentication before syncing resumes',
29
29
  connectError: 'The server could not be reached or the TLS handshake failed. Retried with backoff',
30
- unset: 'No IMAP or OAuth2 configuration is set, so the account is not synced'
30
+ unset: 'The account is not syncing: either no IMAP or OAuth2 configuration is set, or syncing was switched off - by the operator, or automatically after repeated authentication failures'
31
31
  },
32
32
 
33
33
  outboxStatus: {
package/lib/schemas.js CHANGED
@@ -1635,7 +1635,17 @@ const accountSchemas = {
1635
1635
  .example('full')
1636
1636
  .description('Override the global IMAP indexing strategy for this account')
1637
1637
  .meta({ enumDescriptions: ENUM_DESCRIPTIONS.imapIndexer, usage: FIELD_USAGE.imapIndexer })
1638
- .label('AccountImapIndexer')
1638
+ .label('AccountImapIndexer'),
1639
+
1640
+ // Read-only, and no `.label()`: the generator inlines scalars, so a label here would name a
1641
+ // public type that never appears in the document.
1642
+ authFailureDisabledAt: Joi.date()
1643
+ .iso()
1644
+ .allow(null)
1645
+ .example('2021-03-22T13:13:31.000Z')
1646
+ .description(
1647
+ "When EmailEngine switched syncing off for this account after repeated authentication failures, or `null`. Read-only. Supply working credentials - re-authorize an OAuth2 account, or save new IMAP settings - and syncing resumes. `imap.disabled` is also the operator's own send-only switch, so this is what tells an automatic disable from a deliberate one."
1648
+ )
1639
1649
  };
1640
1650
 
1641
1651
  const googleProjectIdSchema = Joi.string()
@@ -16,7 +16,7 @@ const tokens = require('../tokens');
16
16
  const { redis, documentsQueue } = require('../db');
17
17
  const getSecret = require('../get-secret');
18
18
  const capa = require('../capa');
19
- const { Account } = require('../account');
19
+ const { Account, authFailureDisabledAt } = require('../account');
20
20
  const { Gateway } = require('../gateway');
21
21
  const { autodetectImapSettings, resolveAppPassword, getAppPassword } = require('../autodetect-imap-settings');
22
22
  const { atomicIncrement } = require('../redis-operations');
@@ -1387,12 +1387,29 @@ function init(args) {
1387
1387
 
1388
1388
  const canReadMail = (accountData.imap || accountData.oauth2) && !(accountData.imap && accountData.imap.disabled) && !DISABLE_MESSAGE_BROWSER;
1389
1389
 
1390
+ // The auth-failure safety net parks an account by setting imap.disabled, and for a
1391
+ // Gmail API or Outlook account that is a flag with nowhere to show: the IMAP and SMTP
1392
+ // cards below are hidden for API accounts, so the parked account reported nothing but
1393
+ // a neutral "Not syncing" and the operator had no way back that did not involve a raw
1394
+ // API call.
1395
+ const disabledByAuthFailureAt = authFailureDisabledAt(accountData);
1396
+
1390
1397
  // Top-of-page alert for the account's primary problem, so a broken account is
1391
1398
  // impossible to miss. Gated on the effective connection state (stateLabel.type) so a
1392
1399
  // recovered account never shows a stale error; a stalled sync is surfaced separately
1393
1400
  // because the account can otherwise be connected.
1394
1401
  let accountAlert = null;
1395
- if (accountData.stateLabel && accountData.stateLabel.type === 'error') {
1402
+ if (disabledByAuthFailureAt) {
1403
+ // Ahead of the state alert: a parked account is not connecting at all, so why it
1404
+ // was switched off is the more actionable of the two.
1405
+ accountAlert = {
1406
+ title: 'Syncing was switched off',
1407
+ message:
1408
+ 'EmailEngine stopped connecting this account after repeated authentication failures. Re-authenticating it turns syncing back on; "Resume syncing" retries with the stored credentials.',
1409
+ timeLabel: 'Switched off',
1410
+ time: disabledByAuthFailureAt
1411
+ };
1412
+ } else if (accountData.stateLabel && accountData.stateLabel.type === 'error') {
1396
1413
  accountAlert = {
1397
1414
  title: accountData.stateLabel.name,
1398
1415
  message: accountData.stateLabel.error
@@ -1436,6 +1453,7 @@ function init(args) {
1436
1453
  menuAccounts: true,
1437
1454
  account: accountData,
1438
1455
  accountAlert,
1456
+ accountParked: !!disabledByAuthFailureAt,
1439
1457
  logs: logInfo,
1440
1458
  smtpError: accountData.smtpStatus && accountData.smtpStatus.status === 'error',
1441
1459
 
@@ -1559,10 +1577,17 @@ function init(args) {
1559
1577
  let account = request.params.account;
1560
1578
  try {
1561
1579
  request.logger.info({ msg: 'Requesting account reconnect', account });
1562
- try {
1563
- await call({ cmd: 'reconnect', account });
1564
- } catch (err) {
1565
- request.logger.error({ msg: 'Reconnect request failed', action: 'request_reconnect', account, err });
1580
+
1581
+ // Through requestReconnect() rather than dispatching here, so this button and
1582
+ // PUT /v1/account/{account}/reconnect share one answer. It declines for an account
1583
+ // the auth-failure safety net switched off, where the dispatch would be a no-op -
1584
+ // and since this caller always asks to reconnect, a false is that refusal. The
1585
+ // button is also rendered disabled in that state; this is what makes the refusal
1586
+ // real rather than cosmetic.
1587
+ let accountObject = new Account({ redis, account, call, secret: await getSecret() });
1588
+
1589
+ if (!(await accountObject.requestReconnect({ reconnect: true }))) {
1590
+ return { success: false, error: 'Syncing is switched off for this account. Use "Resume syncing" to turn it back on.' };
1566
1591
  }
1567
1592
 
1568
1593
  return {
@@ -1590,6 +1615,59 @@ function init(args) {
1590
1615
  }
1591
1616
  });
1592
1617
 
1618
+ // Turns an account back on after the auth-failure safety net switched it off. The only admin
1619
+ // UI route that reaches the flag for a Gmail API or Outlook account: their IMAP card, and with
1620
+ // it the "Disable IMAP" checkbox an IMAP account is re-enabled through, is not rendered.
1621
+ //
1622
+ // Lifts nothing but the safety net's own disable (see Account.clearAuthFailureDisable), so it
1623
+ // cannot be used to un-do an operator's deliberate send-only switch.
1624
+ server.route({
1625
+ method: 'POST',
1626
+ path: '/admin/accounts/{account}/resume',
1627
+ async handler(request) {
1628
+ let account = request.params.account;
1629
+ try {
1630
+ // clearAuthFailureDisable() needs nothing but the account hash, and the reconnect
1631
+ // below is dispatched from this module's own channel
1632
+ let accountObject = new Account({ redis, account });
1633
+
1634
+ if (!(await accountObject.clearAuthFailureDisable())) {
1635
+ return { success: false, error: 'This account was not switched off by EmailEngine' };
1636
+ }
1637
+
1638
+ request.logger.info({ msg: 'Resumed an account that was switched off after authentication failures', account });
1639
+
1640
+ try {
1641
+ await call({ cmd: 'reconnect', account });
1642
+ } catch (err) {
1643
+ // The flag is already lifted, so the account is no longer parked. Losing the
1644
+ // dispatch only delays the connection until the next periodic reconnect.
1645
+ request.logger.error({ msg: 'Reconnect request failed', action: 'resume_account', account, err });
1646
+ }
1647
+
1648
+ return { success: true };
1649
+ } catch (err) {
1650
+ request.logger.error({ msg: 'Failed to resume account', err, account });
1651
+ return { success: false, error: err.message };
1652
+ }
1653
+ },
1654
+ options: {
1655
+ validate: {
1656
+ options: {
1657
+ stripUnknown: true,
1658
+ abortEarly: false,
1659
+ convert: true
1660
+ },
1661
+
1662
+ failAction,
1663
+
1664
+ params: Joi.object({
1665
+ account: accountIdSchema.required()
1666
+ })
1667
+ }
1668
+ }
1669
+ });
1670
+
1593
1671
  server.route({
1594
1672
  method: 'POST',
1595
1673
  path: '/admin/accounts/{account}/sync',
@@ -4,6 +4,7 @@
4
4
  // /admin dashboard (stats counters), the legal page, and the upgrade page. Extracted
5
5
  // verbatim from lib/routes-ui.js. The API reference lives in reference-routes.js.
6
6
 
7
+ const pathlib = require('path');
7
8
  const { getStats, getBoolean, readEnvValue } = require('../tools');
8
9
  const settings = require('../settings');
9
10
  const { redis } = require('../db');
@@ -124,6 +125,27 @@ function init(args) {
124
125
  }
125
126
  });
126
127
 
128
+ // The same dependency inventory /sbom.json serves, on the admin surface.
129
+ //
130
+ // /sbom.json is deliberately behind the api-token strategy - the file names every package and
131
+ // version the instance runs - and that strategy has no session-cookie fallback, so a link to
132
+ // it from a rendered admin page answered a signed-in admin with a 401. Rather than widening
133
+ // the API gate for a browser, the download an operator clicks is served where their session
134
+ // already authenticates them, inside the EENGINE_ADMIN_ACCESS_ADDRESSES perimeter.
135
+ server.route({
136
+ method: 'GET',
137
+ path: '/admin/legal/sbom.json',
138
+ handler: {
139
+ file: {
140
+ path: pathlib.join(__dirname, '..', '..', 'sbom.json'),
141
+ confine: false,
142
+ // Named for the operator saving it, not for the route it came from
143
+ filename: 'sbom.json',
144
+ mode: 'attachment'
145
+ }
146
+ }
147
+ });
148
+
127
149
  server.route({
128
150
  method: 'GET',
129
151
  path: '/admin/upgrade',
@@ -19,7 +19,7 @@ const psl = require('psl');
19
19
  const settings = require('../settings');
20
20
  const { redis } = require('../db');
21
21
  const { toolGrants } = require('../mcp/tools');
22
- const { Account, accountsExist, accountSummary } = require('../account');
22
+ const { Account, accountsExist, accountSummary, authFailureDisabledAt } = require('../account');
23
23
  const { REDIS_PREFIX, DEFAULT_PAGE_SIZE } = require('../consts');
24
24
  const { oauth2ProviderData } = require('../oauth2-apps');
25
25
  const exampleDocumentsPayloads = require('../payload-examples-documents.json');
@@ -205,12 +205,18 @@ function formatAccountData(account, gt) {
205
205
 
206
206
  account.stateLabel = accountStateLabel(account.state, { lastErrorState: account.lastErrorState, disabledReason: account.disabledReason }, gt);
207
207
 
208
- // Check if IMAP was disabled due to errors - override state label to show error
209
- if (account.imap && account.imap.disabled && account.lastErrorState) {
208
+ // An account the auth-failure safety net switched off reports the neutral "Not syncing", which
209
+ // says nothing about why it stopped or that a human has to act. Override the label to say so.
210
+ //
211
+ // Keyed on the marker the safety net writes, not on `imap.disabled` plus a leftover error:
212
+ // that flag is also the operator's send-only switch, so the old guess badged a deliberately
213
+ // send-only account "Connection failed" if it had ever failed to connect, and stayed silent
214
+ // about a parked account whose lastErrorState had been overwritten since.
215
+ if (authFailureDisabledAt(account)) {
210
216
  account.stateLabel = {
211
217
  type: 'error',
212
- name: 'Connection failed',
213
- error: account.lastErrorState.description || account.lastErrorState.response
218
+ name: 'Syncing switched off',
219
+ error: account.lastErrorState && (account.lastErrorState.description || account.lastErrorState.response)
214
220
  };
215
221
  }
216
222
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emailengine-app",
3
- "version": "2.79.3",
3
+ "version": "2.79.4",
4
4
  "private": false,
5
5
  "productTitle": "EmailEngine",
6
6
  "description": "Email Sync Engine",
@@ -8,6 +8,9 @@
8
8
  {{#if accountAlert.message}}
9
9
  <div class="break-words"><small>{{accountAlert.message}}</small></div>
10
10
  {{/if}}
11
+ {{#if accountAlert.time}}
12
+ <div><small>{{accountAlert.timeLabel}} <span class="local-date-time" data-time="{{accountAlert.time}}"></span></small></div>
13
+ {{/if}}
11
14
  {{/ui/alert-banner}}
12
15
  {{/if}}
13
16
 
@@ -29,8 +32,13 @@
29
32
  <div class="bg-base-content/10 mx-1 hidden h-6 w-px self-center sm:block" aria-hidden="true"></div>
30
33
 
31
34
  {{!-- Operations: act on this account now --}}
32
- {{#> ui/tooltip text="Close and re-open the connection"}}
33
- <button type="button" class="btn btn-soft btn-sm" id="request-reconnect">
35
+ {{!-- Disabled while the account is switched off: a reconnect rebuilds the connection,
36
+ but init() checks the disable flag before it dials out and returns without
37
+ connecting, so the click would report success and do nothing. --}}
38
+ {{#> ui/tooltip text=(when accountParked "Syncing is switched off - use Resume syncing instead" "Close and re-open the connection")}}
39
+ {{!-- pointer-events-none so the tooltip above still explains why: browsers dispatch no
40
+ mouse events for a disabled control, so without it the wrapper never sees the hover --}}
41
+ <button type="button" class="btn btn-soft btn-sm{{#if accountParked}} pointer-events-none{{/if}}" id="request-reconnect"{{#if accountParked}} disabled{{/if}}>
34
42
  <span class="icon-[tabler--refresh] size-4" id="reconnect-icon"></span> Reconnect
35
43
  </button>
36
44
  {{/ui/tooltip}}
@@ -51,6 +59,14 @@
51
59
  {{/ui/tooltip}}
52
60
  {{/if}}
53
61
 
62
+ {{!-- Only for an account the auth-failure safety net switched off. An API account has
63
+ no IMAP card, so this is the one control that reaches the flag. --}}
64
+ {{#if accountParked}}
65
+ {{#> ui/tooltip text="Turn syncing back on with the stored credentials"}}
66
+ {{> ui/btn bare=true style="soft" size="sm" id="request-resume" icon="icon-[tabler--player-play]" label="Resume syncing"}}
67
+ {{/ui/tooltip}}
68
+ {{/if}}
69
+
54
70
  {{#if canSend}}
55
71
  {{#unless gateways}}
56
72
  {{#> ui/tooltip text="Test SMTP delivery settings for this account"}}
@@ -961,6 +977,35 @@ submitLabel="Delete account"}}
961
977
  })
962
978
  });
963
979
 
980
+ // Only rendered for an account the auth-failure safety net switched off
981
+ const requestResumeElm = document.getElementById('request-resume');
982
+ if (requestResumeElm) {
983
+ requestResumeElm.addEventListener('click', e => {
984
+ e.preventDefault();
985
+ // The disabled button is the re-entrancy guard
986
+ if (requestResumeElm.disabled) {
987
+ return
988
+ }
989
+
990
+ uiButtonBusy(requestResumeElm, true);
991
+ const account = document.getElementById('account-id').value.trim();
992
+ uiPostJson(`/admin/accounts/${account}/resume`, {}).then(data => {
993
+ if (data.success) {
994
+ // Both the button and the alert explaining why it was there belong to the
995
+ // switched-off state, so reload rather than leave either behind. No toast:
996
+ // the navigation would destroy it before it could be read.
997
+ window.location.reload();
998
+ return;
999
+ }
1000
+ uiButtonBusy(requestResumeElm, false);
1001
+ uiToastResult(data, 'Syncing resumed', 'Failed to resume syncing');
1002
+ }).catch(err => {
1003
+ uiButtonBusy(requestResumeElm, false);
1004
+ showToast('Request failed\n' + err.message, 'alert-triangle');
1005
+ })
1006
+ });
1007
+ }
1008
+
964
1009
  const syncAccount = async () => {
965
1010
  const account = document.getElementById('account-id').value.trim();
966
1011
 
package/views/legal.hbs CHANGED
@@ -71,7 +71,7 @@
71
71
  </li>
72
72
 
73
73
  <li class="px-6 py-4">
74
- <a href="/sbom.json" download="sbom.json" class="link link-animated">
74
+ <a href="/admin/legal/sbom.json" download="sbom.json" class="link link-animated">
75
75
  <span class="icon-[tabler--cloud-download] size-4 align-text-bottom"></span>
76
76
  <strong>Software Bill of Materials (SBOM)</strong>
77
77
  </a>