emailengine-app 2.79.2 → 2.79.3

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.
@@ -62,27 +62,35 @@ jobs:
62
62
  ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" deploy@$TARGET_HOST_02 "/opt/deploy.sh ${SERVICE_NAME}"
63
63
 
64
64
  docker:
65
- name: Build Docker Image
66
- runs-on: ubuntu-24.04
65
+ name: Build Docker Image (${{ matrix.arch }})
66
+ # One job per architecture, each on a runner of that architecture. The arm64 leg used to be
67
+ # emulated through QEMU on an x86 runner, where `npm ci` hit an illegal instruction and then
68
+ # hung until the job timeout - reliably on any commit that touches package-lock.json, since
69
+ # that busts the cached layer and forces the install to run in full. A native runner takes
70
+ # the emulator out of the picture, and each image now gets smoke tested on the architecture
71
+ # it was actually built for rather than only amd64.
72
+ runs-on: ${{ matrix.runner }}
67
73
  timeout-minutes: 30
68
74
  permissions:
69
75
  contents: read
70
76
  packages: write
77
+ strategy:
78
+ fail-fast: false
79
+ matrix:
80
+ include:
81
+ - arch: amd64
82
+ platform: linux/amd64
83
+ runner: ubuntu-24.04
84
+ - arch: arm64
85
+ platform: linux/arm64
86
+ runner: ubuntu-24.04-arm
71
87
 
72
88
  steps:
73
89
  - name: Checkout
74
90
  uses: actions/checkout@v6
75
91
 
76
- - name: Set up QEMU
77
- uses: docker/setup-qemu-action@v4
78
- with:
79
- platforms: 'arm64,arm'
80
-
81
92
  - name: Set up Docker Buildx
82
- id: buildx
83
93
  uses: docker/setup-buildx-action@v4
84
- with:
85
- platforms: linux/amd64,linux/arm64/v8
86
94
 
87
95
  - name: Login to Docker Hub
88
96
  uses: docker/login-action@v4
@@ -97,46 +105,91 @@ jobs:
97
105
  username: ${{ github.repository_owner }}
98
106
  password: ${{ secrets.GITHUB_TOKEN }}
99
107
 
100
- - name: Docker meta
101
- id: meta
102
- uses: docker/metadata-action@v6
103
- with:
104
- images: |
105
- ${{ github.repository }}
106
- ghcr.io/${{ github.repository }}
107
- # :latest is owned by the release workflow (release.yaml) and
108
- # always points at the newest release; per-push dev builds from
109
- # master are published as :edge instead
110
- tags: |
111
- type=raw,value=edge,enable=true
112
-
113
- # Build the amd64 image locally (no push) and smoke test the CLI BEFORE publishing, so a
114
- # broken image is never pushed - the previous version smoke tested the already-pushed
115
- # image and could only detect the regression, not prevent shipping it. This build replays
116
- # from the same gha cache the multi-arch push below reuses, so it is cheap.
117
- - name: Build for smoke test (amd64, local)
108
+ # Build locally and exercise the CLI BEFORE anything is published, so a broken image is
109
+ # never pushed. The push below replays from this build's local layer cache, so paying
110
+ # for the build twice costs almost nothing.
111
+ - name: Build for smoke test (local)
118
112
  uses: docker/build-push-action@v7
119
113
  with:
120
114
  context: .
121
- platforms: linux/amd64
115
+ platforms: ${{ matrix.platform }}
122
116
  load: true
123
117
  tags: emailengine:smoke-test
124
118
  # Without a cache backend BuildKit starts cold on every run: setup-buildx-action
125
- # creates a fresh builder on an ephemeral runner, so the emulated arm64 `npm ci`
126
- # re-runs in full regardless of how the Dockerfile layers are ordered.
127
- cache-from: type=gha
119
+ # creates a fresh builder on an ephemeral runner. The scope is per-architecture so
120
+ # the two legs cannot evict each other's entries.
121
+ cache-from: type=gha,scope=${{ matrix.arch }}
128
122
 
129
123
  - name: Smoke test the CLI inside the image
130
124
  run: bash .github/docker-smoke-test.sh emailengine:smoke-test
131
125
 
132
- - name: Build and push
126
+ # Pushed by digest and left untagged: a tag can only be attached once both architectures
127
+ # exist, which is what the manifest job below does. Both registries are written here so
128
+ # the blobs are already in place and the manifest job never has to copy them between
129
+ # registries.
130
+ - name: Build and push by digest
133
131
  id: build
134
132
  uses: docker/build-push-action@v7
135
133
  with:
136
134
  context: .
137
- platforms: ${{ steps.buildx.outputs.platforms }}
138
- push: true
139
- tags: ${{ steps.meta.outputs.tags }}
140
- labels: ${{ steps.meta.outputs.labels }}
141
- cache-from: type=gha
142
- cache-to: type=gha,mode=max
135
+ platforms: ${{ matrix.platform }}
136
+ outputs: type=image,"name=docker.io/${{ github.repository }},ghcr.io/${{ github.repository }}",push-by-digest=true,name-canonical=true,push=true
137
+ cache-from: type=gha,scope=${{ matrix.arch }}
138
+ cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
139
+
140
+ - name: Export digest
141
+ run: |
142
+ mkdir -p /tmp/digests
143
+ digest="${{ steps.build.outputs.digest }}"
144
+ touch "/tmp/digests/${digest#sha256:}"
145
+
146
+ - name: Upload digest
147
+ uses: actions/upload-artifact@v4
148
+ with:
149
+ name: digests-${{ matrix.arch }}
150
+ path: /tmp/digests/*
151
+ if-no-files-found: error
152
+ retention-days: 1
153
+
154
+ docker-manifest:
155
+ name: Publish Docker Manifest
156
+ runs-on: ubuntu-24.04
157
+ needs: docker
158
+ timeout-minutes: 15
159
+ permissions:
160
+ contents: read
161
+ packages: write
162
+
163
+ steps:
164
+ - name: Download digests
165
+ uses: actions/download-artifact@v4
166
+ with:
167
+ path: /tmp/digests
168
+ pattern: digests-*
169
+ merge-multiple: true
170
+
171
+ - name: Set up Docker Buildx
172
+ uses: docker/setup-buildx-action@v4
173
+
174
+ - name: Login to Docker Hub
175
+ uses: docker/login-action@v4
176
+ with:
177
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
178
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
179
+
180
+ - name: Login to GHCR
181
+ uses: docker/login-action@v4
182
+ with:
183
+ registry: ghcr.io
184
+ username: ${{ github.repository_owner }}
185
+ password: ${{ secrets.GITHUB_TOKEN }}
186
+
187
+ # :latest is owned by the release workflow (release.yaml) and always points at the
188
+ # newest release; per-push dev builds from master are published as :edge instead.
189
+ - name: Create and push the manifest list
190
+ working-directory: /tmp/digests
191
+ run: |
192
+ for image in "docker.io/${{ github.repository }}" "ghcr.io/${{ github.repository }}"; do
193
+ docker buildx imagetools create -t "${image}:edge" \
194
+ $(printf "${image}@sha256:%s " *)
195
+ done
@@ -64,29 +64,33 @@ jobs:
64
64
  - run: npm publish --provenance --access public
65
65
 
66
66
  publish_docker:
67
- name: Publish Tagged Docker Image
68
- runs-on: ubuntu-latest
67
+ name: Publish Tagged Docker Image (${{ matrix.arch }})
69
68
  needs: release_please
70
69
  if: needs.release_please.outputs.release_created
71
- # Multi-arch builds run the arm64 leg under QEMU emulation, which can
72
- # hang indefinitely on a misbehaving step. A normal build finishes in
73
- # ~4 minutes, so fail fast instead of burning the 6-hour default limit.
70
+ # One job per architecture, each on a runner of that architecture. The arm64 leg used to be
71
+ # emulated through QEMU on an x86 runner, where `npm ci` hit an illegal instruction and then
72
+ # hung until this timeout - and a release commit is the worst case for it, because the
73
+ # version bump busts the cached layer and forces the install to run in full. A native runner
74
+ # takes the emulator out of the picture.
75
+ runs-on: ${{ matrix.runner }}
74
76
  timeout-minutes: 30
77
+ strategy:
78
+ fail-fast: false
79
+ matrix:
80
+ include:
81
+ - arch: amd64
82
+ platform: linux/amd64
83
+ runner: ubuntu-24.04
84
+ - arch: arm64
85
+ platform: linux/arm64
86
+ runner: ubuntu-24.04-arm
75
87
  steps:
76
88
  - run: echo version v${{needs.release_please.outputs.major}}.${{needs.release_please.outputs.minor}}.${{needs.release_please.outputs.patch}}
77
89
 
78
90
  - uses: actions/checkout@v6
79
91
 
80
- - name: Set up QEMU
81
- uses: docker/setup-qemu-action@v4
82
- with:
83
- platforms: "arm64,arm"
84
-
85
92
  - name: Set up Docker Buildx
86
- id: buildx
87
93
  uses: docker/setup-buildx-action@v4
88
- with:
89
- platforms: linux/amd64,linux/arm64/v8
90
94
 
91
95
  - name: Login to DockerHub
92
96
  uses: docker/login-action@v4
@@ -101,37 +105,93 @@ jobs:
101
105
  username: ${{ github.repository_owner }}
102
106
  password: ${{ secrets.GITHUB_TOKEN }}
103
107
 
104
- # Build the amd64 image locally (no push) and smoke test the CLI BEFORE publishing, so a
105
- # broken image is never pushed to the tags users pull - the previous version smoke tested
106
- # the already-pushed image and could only detect the regression, not prevent shipping it.
107
- # This build replays from the same gha cache the multi-arch push below reuses.
108
- - name: Build for smoke test (amd64, local)
108
+ # Build locally and exercise the CLI BEFORE anything is published, so a broken image is
109
+ # never pushed to the tags users pull. The push below replays from this build's local
110
+ # layer cache, so paying for the build twice costs almost nothing.
111
+ - name: Build for smoke test (local)
109
112
  uses: docker/build-push-action@v7
110
113
  with:
111
114
  context: .
112
- platforms: linux/amd64
115
+ platforms: ${{ matrix.platform }}
113
116
  load: true
114
117
  tags: emailengine:smoke-test
115
- cache-from: type=gha
118
+ cache-from: type=gha,scope=${{ matrix.arch }}
116
119
 
117
120
  - name: Smoke test the CLI inside the image
118
121
  run: bash .github/docker-smoke-test.sh emailengine:smoke-test
119
122
 
120
- - name: Build and push
123
+ # Pushed by digest and left untagged: the release tags can only be attached once both
124
+ # architectures exist, which is what the manifest job below does. Both registries are
125
+ # written here so the blobs are already in place and the manifest job never has to copy
126
+ # them between registries.
127
+ - name: Build and push by digest
121
128
  id: build
122
129
  uses: docker/build-push-action@v7
123
130
  with:
124
131
  context: .
125
- platforms: ${{ steps.buildx.outputs.platforms }}
126
- push: true
127
- cache-from: type=gha
128
- cache-to: type=gha,mode=max
129
- tags: |
130
- ${{ github.repository }}:latest
131
- ${{ github.repository }}:v${{needs.release_please.outputs.major}}.${{needs.release_please.outputs.minor}}.${{needs.release_please.outputs.patch}}
132
- ${{ github.repository }}:v${{needs.release_please.outputs.major}}.${{needs.release_please.outputs.minor}}
133
- ${{ github.repository }}:v${{needs.release_please.outputs.major}}
134
- ghcr.io/${{ github.repository }}:latest
135
- ghcr.io/${{ github.repository }}:v${{needs.release_please.outputs.major}}.${{needs.release_please.outputs.minor}}.${{needs.release_please.outputs.patch}}
136
- ghcr.io/${{ github.repository }}:v${{needs.release_please.outputs.major}}.${{needs.release_please.outputs.minor}}
137
- ghcr.io/${{ github.repository }}:v${{needs.release_please.outputs.major}}
132
+ platforms: ${{ matrix.platform }}
133
+ outputs: type=image,"name=docker.io/${{ github.repository }},ghcr.io/${{ github.repository }}",push-by-digest=true,name-canonical=true,push=true
134
+ cache-from: type=gha,scope=${{ matrix.arch }}
135
+ cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
136
+
137
+ - name: Export digest
138
+ run: |
139
+ mkdir -p /tmp/digests
140
+ digest="${{ steps.build.outputs.digest }}"
141
+ touch "/tmp/digests/${digest#sha256:}"
142
+
143
+ - name: Upload digest
144
+ uses: actions/upload-artifact@v4
145
+ with:
146
+ name: digests-${{ matrix.arch }}
147
+ path: /tmp/digests/*
148
+ if-no-files-found: error
149
+ retention-days: 1
150
+
151
+ publish_docker_manifest:
152
+ name: Publish Tagged Docker Manifest
153
+ runs-on: ubuntu-24.04
154
+ needs: [release_please, publish_docker]
155
+ # A dependent job is skipped when its needs are, so this is belt and braces - but it keeps
156
+ # the gate visible in the job itself rather than only in the job it depends on.
157
+ if: needs.release_please.outputs.release_created
158
+ timeout-minutes: 15
159
+ steps:
160
+ - name: Download digests
161
+ uses: actions/download-artifact@v4
162
+ with:
163
+ path: /tmp/digests
164
+ pattern: digests-*
165
+ merge-multiple: true
166
+
167
+ - name: Set up Docker Buildx
168
+ uses: docker/setup-buildx-action@v4
169
+
170
+ - name: Login to DockerHub
171
+ uses: docker/login-action@v4
172
+ with:
173
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
174
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
175
+
176
+ - name: Login to GHCR
177
+ uses: docker/login-action@v4
178
+ with:
179
+ registry: ghcr.io
180
+ username: ${{ github.repository_owner }}
181
+ password: ${{ secrets.GITHUB_TOKEN }}
182
+
183
+ - name: Create and push the manifest list
184
+ working-directory: /tmp/digests
185
+ env:
186
+ MAJOR: ${{ needs.release_please.outputs.major }}
187
+ MINOR: ${{ needs.release_please.outputs.minor }}
188
+ PATCH: ${{ needs.release_please.outputs.patch }}
189
+ run: |
190
+ for image in "docker.io/${{ github.repository }}" "ghcr.io/${{ github.repository }}"; do
191
+ docker buildx imagetools create \
192
+ -t "${image}:latest" \
193
+ -t "${image}:v${MAJOR}.${MINOR}.${PATCH}" \
194
+ -t "${image}:v${MAJOR}.${MINOR}" \
195
+ -t "${image}:v${MAJOR}" \
196
+ $(printf "${image}@sha256:%s " *)
197
+ done
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "2.79.2"
2
+ ".": "2.79.3"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.79.3](https://github.com/postalsys/emailengine/compare/v2.79.2...v2.79.3) (2026-08-24)
4
+
5
+
6
+ ### Upgrade note
7
+
8
+ The authentication-failure safety net now applies to OAuth2 accounts. It is
9
+ supposed to stop an account retrying after `EENGINE_MAX_IMAP_AUTH_FAILURE_TIME`
10
+ of continuous authentication failures (3 days by default), but it was gated on
11
+ an IMAP configuration block that OAuth2 accounts do not have, so for Gmail and
12
+ Microsoft accounts it never fired and a revoked refresh token was retried
13
+ indefinitely.
14
+
15
+ On an instance that has accumulated such accounts, every one already past the
16
+ threshold is disabled on its next failed refresh, so expect a burst of
17
+ `authenticationError` webhooks shortly after the restart and a matching drop in
18
+ token-endpoint traffic. A disabled account stops connecting and shows in the
19
+ admin UI as "Connection failed"; re-authorizing it lifts the flag and reconnects
20
+ it, with no manual cleanup. If you would rather stage that, raise
21
+ `EENGINE_MAX_IMAP_AUTH_FAILURE_TIME` before upgrading.
22
+
23
+ ### Bug Fixes
24
+
25
+ * **accounts:** make the auth-failure auto-disable work for OAuth2 accounts ([ad52d95](https://github.com/postalsys/emailengine/commit/ad52d9526142d9c84c024dd1e78926c2055e3ded))
26
+ * **imap:** keep a connection-scoped rejection from silently killing an IMAP worker ([481c181](https://github.com/postalsys/emailengine/commit/481c181b7ab6d59e87d2c2a5b653dedb229340d7))
27
+ * **logger:** keep the late-handler diagnostic when error tracking is on ([8c5def2](https://github.com/postalsys/emailengine/commit/8c5def28cf53238bd43ae413e809ab64ce89fee6))
28
+
29
+
30
+ ### Dependencies
31
+
32
+ Bundled library updates carrying fixes of their own, which the commit prefixes
33
+ above do not surface:
34
+
35
+ * **imapflow 1.7.2 -> 1.7.6.** Connection errors now name the connection and the
36
+ site that rejected them, the guard against an unobserved teardown rejection is
37
+ structural rather than per-site, and an IDLE-break waiter is no longer reported
38
+ under the command's marker. Also normalizes search dates so an invalid value
39
+ cannot throw or emit NaN.
40
+ * **mailparser 3.9.15 -> 3.9.16.** Bounds linkify-it scanning of untrusted text
41
+ bodies, and handles stream-flush errors.
42
+ * **ioredfour 1.4.2 -> 1.4.3.** Moves to ioredis 6, which removes a second copy
43
+ of ioredis from the dependency tree.
44
+ * **@postalsys/certs 1.0.18, @postalsys/email-ai-tools 1.13.19,
45
+ @postalsys/email-text-tools 2.4.14, @bull-board 9.4.0**, plus html-to-text and
46
+ joi deduplication across the tree.
47
+
3
48
  ## [2.79.2](https://github.com/postalsys/emailengine/compare/v2.79.1...v2.79.2) (2026-08-22)
4
49
 
5
50
 
@@ -33,11 +33,32 @@ cp node_modules/flyonui/flyonui.js static/js/flyonui.js
33
33
  # Rebuild the compiled admin UI stylesheet (Tailwind v4 + FlyonUI)
34
34
  npm run build:css
35
35
 
36
- wget https://developers.google.com/static/crawling/ipranges/special-crawlers.json -O data/google-crawlers.json
36
+ # Both JSON artifacts below are refreshed from the network and are committed, so a failed fetch
37
+ # must not be allowed to damage the copy already in the tree. A plain `> file` redirect truncates
38
+ # before the command runs, which is how a GitHub 500 once left a zero-byte sbom.json behind - and
39
+ # under `set -e` it also aborts the rest of this script, silently skipping the licence and gettext
40
+ # regeneration that npm run update chains after it. Each fetch therefore lands in a sibling temp
41
+ # file, is checked for being valid JSON, and only then replaces the committed one. The temp file
42
+ # is created next to its target rather than in $TMPDIR so the move is a rename within the same
43
+ # filesystem, never a copy that could be interrupted half-written.
44
+ fetch_json() {
45
+ local target="$1"
46
+ shift
47
+ local tmp
48
+ tmp=$(mktemp "${target}.XXXXXX")
49
+ if "$@" > "$tmp" && node -e 'JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"))' "$tmp"; then
50
+ mv "$tmp" "$target"
51
+ else
52
+ rm -f "$tmp"
53
+ echo "WARNING: failed to refresh ${target}, keeping the previous copy" >&2
54
+ fi
55
+ }
56
+
57
+ fetch_json data/google-crawlers.json wget -q -O - https://developers.google.com/static/crawling/ipranges/special-crawlers.json
37
58
  node -e 'console.log("Google crawlers updated: "+require("./data/google-crawlers.json").creationTime);'
38
59
 
39
60
  # brew install gh
40
61
  # gh auth login
41
62
  # gh ext install advanced-security/gh-sbom
42
63
  # gh sbom -c -l > sbom.json
43
- gh sbom > sbom.json
64
+ fetch_json sbom.json gh sbom
package/lib/account.js CHANGED
@@ -1047,6 +1047,14 @@ class Account {
1047
1047
  account: this.account,
1048
1048
  state: oldAccountData.state
1049
1049
  });
1050
+
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
+
1050
1058
  if (typeof this.call === 'function') {
1051
1059
  try {
1052
1060
  await this.call({
@@ -1089,6 +1097,41 @@ class Account {
1089
1097
  return id;
1090
1098
  }
1091
1099
 
1100
+ /**
1101
+ * 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.
1103
+ *
1104
+ * Reads the stored value rather than trusting the copy loaded before the update, because the
1105
+ * same update may have rewritten the `imap` field.
1106
+ *
1107
+ * @returns {Promise<Boolean>} True when a disable flag was actually lifted
1108
+ */
1109
+ async clearAuthFailureDisable() {
1110
+ let imapInfo = await this.redis.hget(this.getAccountKey(), 'imap');
1111
+ if (!imapInfo) {
1112
+ return false;
1113
+ }
1114
+
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 });
1120
+ return false;
1121
+ }
1122
+
1123
+ if (!imapData || !imapData.disabled) {
1124
+ return false;
1125
+ }
1126
+
1127
+ imapData.disabled = false;
1128
+ await this.redis.hset(this.getAccountKey(), 'imap', JSON.stringify(imapData));
1129
+
1130
+ this.logger.info({ msg: 'Re-enabled IMAP for account after re-authorization', account: this.account });
1131
+
1132
+ return true;
1133
+ }
1134
+
1092
1135
  async create(accountData) {
1093
1136
  this.account = accountData.account;
1094
1137
  if (this.account === null) {