emailengine-app 2.81.2 → 2.82.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/.ncurc.js +33 -10
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +71 -0
- package/DOCKER_DEPLOYMENT.md +13 -12
- package/Dockerfile +2 -0
- package/bin/emailengine.js +105 -25
- package/config/default.toml +0 -5
- package/config/test.toml +0 -5
- package/data/google-crawlers.json +1 -1
- package/encrypt.js +70 -42
- package/getswagger.sh +0 -4
- package/lib/account/account-state.js +2 -110
- package/lib/account/expected-identity.js +1 -1
- package/lib/account-assignment.js +138 -1
- package/lib/account.js +289 -869
- package/lib/api-reference/index.js +2 -3
- package/lib/api-reference/schema-tree.js +53 -3
- package/lib/api-routes/account-binding.js +58 -0
- package/lib/api-routes/account-routes.js +65 -37
- package/lib/api-routes/behavior-notes.js +4 -0
- package/lib/api-routes/blocklist-routes.js +2 -2
- package/lib/api-routes/bull-board-routes.js +1 -6
- package/lib/api-routes/export-routes.js +2 -22
- package/lib/api-routes/gateway-routes.js +15 -16
- package/lib/api-routes/index.js +1 -13
- package/lib/api-routes/mailbox-routes.js +2 -7
- package/lib/api-routes/mcp-oauth-routes.js +2 -1
- package/lib/api-routes/mcp-routes.js +7 -7
- package/lib/api-routes/message-routes.js +50 -238
- package/lib/api-routes/mint-bounds.js +110 -0
- package/lib/api-routes/oauth2-app-routes.js +23 -32
- package/lib/api-routes/operation-impact.js +1 -1
- package/lib/api-routes/outbox-routes.js +3 -3
- package/lib/api-routes/permission-map.js +1 -7
- package/lib/api-routes/route-helpers.js +11 -5
- package/lib/api-routes/settings-routes.js +20 -21
- package/lib/api-routes/stats-routes.js +1 -1
- package/lib/api-routes/submit-routes.js +17 -18
- package/lib/api-routes/template-routes.js +4 -9
- package/lib/api-routes/token-routes.js +28 -6
- package/lib/api-token-scheme.js +71 -0
- package/lib/arf-detect.js +33 -6
- package/lib/auth-token.js +44 -24
- package/lib/autodetect-imap-settings.js +305 -123
- package/lib/bounce-detect.js +25 -16
- package/lib/calendar-event.js +78 -0
- package/lib/consts.js +54 -5
- package/lib/create-imap-client.js +24 -0
- package/lib/db.js +77 -30
- package/lib/delivery-error.js +70 -2
- package/lib/egress-fetch.js +54 -3
- package/lib/egress-filter.js +11 -0
- package/lib/email-client/api-retry.js +147 -0
- package/lib/email-client/base-client.js +383 -536
- package/lib/email-client/credential-errors.js +21 -5
- package/lib/email-client/gmail/gmail-api.js +38 -125
- package/lib/email-client/gmail/send-request.js +1 -1
- package/lib/email-client/gmail-client.js +77 -51
- package/lib/email-client/imap/mailbox.js +158 -324
- package/lib/email-client/imap/stale-view.js +109 -0
- package/lib/email-client/imap/subconnection.js +46 -9
- package/lib/email-client/imap/sync-operations.js +5 -37
- package/lib/email-client/imap-client.js +190 -65
- package/lib/email-client/message-builder.js +50 -25
- package/lib/email-client/notification-handler.js +5 -219
- package/lib/email-client/outlook/graph-api.js +147 -126
- package/lib/email-client/outlook/send-request.js +10 -4
- package/lib/email-client/outlook-client.js +389 -463
- package/lib/email-client/smtp-pool-manager.js +3 -2
- package/lib/encrypt.js +184 -19
- package/lib/enum-descriptions.js +6 -3
- package/lib/export.js +141 -41
- package/lib/gateway.js +25 -6
- package/lib/get-raw-email.js +26 -44
- package/lib/get-secret.js +1 -21
- package/lib/handlebars-helpers.js +31 -10
- package/lib/imap-proxy-auth.js +13 -29
- package/lib/imapproxy/imap-core/README.md +1 -0
- package/lib/imapproxy/imap-core/lib/handler/imap-parser.js +12 -0
- package/lib/imapproxy/imap-core/lib/imap-command.js +74 -10
- package/lib/imapproxy/imap-core/lib/imap-connection.js +9 -1
- package/lib/imapproxy/imap-core/lib/imap-server.js +112 -26
- package/lib/imapproxy/imap-core/lib/imap-stream.js +41 -1
- package/lib/imapproxy/imap-core/lib/imap-tools.js +10 -2
- package/lib/imapproxy/imap-core/lib/indexer/indexer.js +4 -2
- package/lib/imapproxy/imap-server.js +17 -177
- package/lib/imapproxy/proxy-handoff.js +235 -0
- package/lib/imapproxy/response-error.js +33 -0
- package/lib/imapproxy/upstream-client.js +2 -2
- package/lib/license-beacon.js +3 -9
- package/lib/llm-pre-process.js +182 -43
- package/lib/logger.js +1 -1
- package/lib/lua/ee-export-queue-add.lua +39 -0
- package/lib/lua/ee-get-idempotency.lua +15 -3
- package/lib/lua/ee-release-attempts.lua +23 -0
- package/lib/lua/ee-reserve-attempts.lua +42 -0
- package/lib/lua/h-set-bigger.lua +12 -2
- package/lib/lua/s-list-accounts.lua +6 -3
- package/lib/mcp/index.js +1 -2
- package/lib/mcp/listen.js +221 -18
- package/lib/mcp/oauth.js +44 -5
- package/lib/mcp/resources.js +8 -2
- package/lib/mcp/tools.js +108 -36
- package/lib/message-port-stream.js +64 -6
- package/lib/oauth/external-account-signer.js +16 -13
- package/lib/oauth/gmail.js +64 -32
- package/lib/oauth/mail-ru.js +24 -17
- package/lib/oauth/outlook.js +53 -40
- package/lib/oauth/pubsub/google.js +38 -2
- package/lib/oauth/scope-checker.js +39 -8
- package/lib/oauth/scope-list.js +55 -0
- package/lib/oauth/token-fetch.js +47 -0
- package/lib/oauth/verify-app.js +2 -2
- package/lib/oauth2-apps.js +154 -90
- package/lib/openapi/build-document.js +1 -1
- package/lib/openapi/joi-schema.js +78 -9
- package/lib/outbox.js +2 -7
- package/lib/parse-message.js +21 -0
- package/lib/payload-examples-webhooks.json +4 -7
- package/lib/pbkdf2-phc.js +101 -0
- package/lib/privileged-settings.js +0 -14
- package/lib/queue-retention.js +4 -2
- package/lib/rate-limit.js +54 -15
- package/lib/read-env-value.js +33 -2
- package/lib/redis-scan-delete.js +56 -29
- package/lib/redis-url.js +3 -1
- package/lib/respawn-backoff.js +5 -4
- package/lib/response-stream.js +25 -4
- package/lib/rewrite-text-nodes.js +27 -40
- package/lib/routes-ui.js +0 -5
- package/lib/schemas.js +180 -253
- package/lib/sentry.js +21 -5
- package/lib/settings.js +58 -59
- package/lib/smtp-auth.js +6 -2
- package/lib/smtp-message-processor.js +28 -7
- package/lib/sso.js +7 -3
- package/lib/stream-encrypt.js +14 -13
- package/lib/swagger-options.js +3 -1
- package/lib/tls/provision.js +69 -3
- package/lib/tls/store.js +14 -1
- package/lib/token-audit-log.js +3 -2
- package/lib/tools.js +114 -53
- package/lib/totp.js +16 -1
- package/lib/ui-routes/account-routes.js +67 -70
- package/lib/ui-routes/admin-config-routes.js +111 -134
- package/lib/ui-routes/admin-entities-routes.js +101 -191
- package/lib/ui-routes/ai-options.js +104 -0
- package/lib/ui-routes/auth-routes.js +98 -18
- package/lib/ui-routes/export-routes.js +3 -23
- package/lib/ui-routes/internals-routes.js +12 -9
- package/lib/ui-routes/network-config-routes.js +8 -18
- package/lib/ui-routes/oauth-config-routes.js +83 -228
- package/lib/ui-routes/route-helpers.js +63 -67
- package/lib/ui-routes/special-use-paths.js +33 -0
- package/lib/ui-routes/unsubscribe-routes.js +2 -2
- package/lib/utils/decode-headers.js +32 -5
- package/lib/utils/header-map.js +62 -1
- package/lib/utils/network.js +11 -17
- package/lib/web-safe-html.js +77 -4
- package/lib/webhook-request.js +9 -1
- package/lib/webhook-routing.js +27 -1
- package/lib/webhooks.js +120 -43
- package/lib/worker-rpc-error.js +43 -2
- package/list-generate.js +13 -2
- package/package.json +38 -46
- package/sbom.json +1 -1
- package/scripts/refresh-test-tokens.js +42 -14
- package/server.js +338 -292
- package/setup-production.sh +16 -7
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +7 -8
- package/static/js/ee-client.js +145 -70
- package/static/js/ui.js +350 -154
- package/static/licenses.html +349 -1740
- package/translations/messages.pot +129 -111
- package/views/account-workspace-error.hbs +30 -0
- package/views/accounts/account.hbs +9 -4
- package/views/accounts/browse.hbs +10 -4
- package/views/accounts/edit.hbs +11 -2
- package/views/config/ai.hbs +49 -41
- package/views/config/oauth/app.hbs +2 -1
- package/views/dashboard.hbs +18 -16
- package/views/internals/index.hbs +1 -1
- package/views/layout/app.hbs +0 -22
- package/views/layout/login.hbs +2 -1
- package/views/partials/filter_editor_js.hbs +4 -3
- package/views/partials/gmail_api_scopes.hbs +16 -0
- package/views/partials/oauth_form.hbs +67 -94
- package/views/partials/oauth_pubsub_app_select.hbs +43 -0
- package/views/partials/scope_info.hbs +14 -23
- package/views/partials/side_menu.hbs +0 -4
- package/views/partials/ui/account-picker.hbs +6 -32
- package/views/partials/ui/model-picker.hbs +31 -0
- package/views/partials/ui/pagination.hbs +6 -1
- package/views/partials/ui/picker.hbs +47 -0
- package/views/unsubscribe.hbs +1 -1
- package/workers/api.js +82 -47
- package/workers/export.js +55 -60
- package/workers/imap.js +132 -49
- package/workers/submit.js +5 -6
- package/workers/webhooks.js +46 -27
- package/.githooks/pre-commit +0 -80
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/contributing.md +0 -17
- package/.github/dependabot.yml +0 -22
- package/.github/docker-smoke-test.sh +0 -61
- package/.github/workflows/deploy.yml +0 -215
- package/.github/workflows/e2e.yml +0 -55
- package/.github/workflows/release.yaml +0 -217
- package/.github/workflows/test.yml +0 -307
- package/lib/api-routes/chat-routes.js +0 -535
- package/lib/document-store.js +0 -75
- package/lib/es.js +0 -757
- package/lib/generate-text-preview.js +0 -61
- package/lib/imapproxy/imap-core/memory-notifier.js +0 -129
- package/lib/pre-process.js +0 -196
- package/lib/threads.js +0 -155
- package/lib/ui-routes/document-store-routes.js +0 -806
- package/playwright.config.js +0 -47
- package/views/config/document-store/chat.hbs +0 -286
- package/views/config/document-store/index.hbs +0 -146
- package/views/config/document-store/mappings/index.hbs +0 -108
- package/views/config/document-store/mappings/new.hbs +0 -68
- package/views/config/document-store/pre-processing/index.hbs +0 -103
- package/views/partials/document_store_header.hbs +0 -30
- package/workers/documents.js +0 -1128
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
on:
|
|
2
|
-
push:
|
|
3
|
-
branches:
|
|
4
|
-
- master
|
|
5
|
-
|
|
6
|
-
permissions:
|
|
7
|
-
contents: write
|
|
8
|
-
pull-requests: write
|
|
9
|
-
packages: write
|
|
10
|
-
attestations: write
|
|
11
|
-
id-token: write
|
|
12
|
-
|
|
13
|
-
name: Manage Release
|
|
14
|
-
jobs:
|
|
15
|
-
release_please:
|
|
16
|
-
name: Create or prepare release
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
outputs:
|
|
19
|
-
major: ${{ steps.release.outputs.major }}
|
|
20
|
-
minor: ${{ steps.release.outputs.minor }}
|
|
21
|
-
patch: ${{ steps.release.outputs.patch }}
|
|
22
|
-
release_created: ${{ steps.release.outputs.release_created }}
|
|
23
|
-
steps:
|
|
24
|
-
# Configured through release-please-config.json (manifest mode) rather than a
|
|
25
|
-
# `release-type` input here - the two are mutually exclusive, and only the config
|
|
26
|
-
# file can set `draft`, which the action exposes no input for. The release is drafted
|
|
27
|
-
# so users never see a version whose binaries do not exist yet, and `force-tag-creation`
|
|
28
|
-
# makes the tag anyway: GitHub withholds the tag for a draft, and upload.sh builds
|
|
29
|
-
# from the tag (falling back to HEAD behind an interactive prompt without it).
|
|
30
|
-
- uses: googleapis/release-please-action@v4
|
|
31
|
-
id: release
|
|
32
|
-
|
|
33
|
-
publish:
|
|
34
|
-
name: Publish NPM package
|
|
35
|
-
runs-on: ubuntu-latest
|
|
36
|
-
needs: release_please
|
|
37
|
-
# Fires as soon as release-please creates the release, which it does even though the
|
|
38
|
-
# release is a draft - `release_created` reports the release object, not its visibility.
|
|
39
|
-
#
|
|
40
|
-
# Deliberately NOT deferred until the draft is published. Doing that would mean waiting
|
|
41
|
-
# on a `release` event, and that event only exists because upload.sh publishes with a
|
|
42
|
-
# real user's credentials: draft releases raise no event, and one raised inside Actions
|
|
43
|
-
# by GITHUB_TOKEN never triggers a workflow. Several conditions all having to hold for a
|
|
44
|
-
# publish to happen makes the failure mode a silent non-publication, discovered late.
|
|
45
|
-
# Publishing here is one workflow run with nothing to choreograph.
|
|
46
|
-
#
|
|
47
|
-
# Publishing before the binaries exist is not shipping something broken: the npm package
|
|
48
|
-
# is the Node source and works on its own - it does not carry the pkg binaries, so it
|
|
49
|
-
# does not depend on the part of a release that can fail late.
|
|
50
|
-
#
|
|
51
|
-
# This job also has to stay in this file: npm trusted publishing (OIDC, which is why
|
|
52
|
-
# there is no token secret) is bound to the repository AND the workflow filename.
|
|
53
|
-
if: needs.release_please.outputs.release_created
|
|
54
|
-
permissions:
|
|
55
|
-
contents: read
|
|
56
|
-
id-token: write
|
|
57
|
-
steps:
|
|
58
|
-
- uses: actions/checkout@v6
|
|
59
|
-
- uses: actions/setup-node@v6
|
|
60
|
-
with:
|
|
61
|
-
node-version: 24
|
|
62
|
-
registry-url: "https://registry.npmjs.org"
|
|
63
|
-
- run: npm ci
|
|
64
|
-
- run: npm publish --provenance --access public
|
|
65
|
-
|
|
66
|
-
publish_docker:
|
|
67
|
-
name: Publish Tagged Docker Image (${{ matrix.arch }})
|
|
68
|
-
needs: release_please
|
|
69
|
-
if: needs.release_please.outputs.release_created
|
|
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 }}
|
|
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
|
|
87
|
-
steps:
|
|
88
|
-
- run: echo version v${{needs.release_please.outputs.major}}.${{needs.release_please.outputs.minor}}.${{needs.release_please.outputs.patch}}
|
|
89
|
-
|
|
90
|
-
- uses: actions/checkout@v6
|
|
91
|
-
|
|
92
|
-
- name: Set up Docker Buildx
|
|
93
|
-
uses: docker/setup-buildx-action@v4
|
|
94
|
-
|
|
95
|
-
- name: Login to DockerHub
|
|
96
|
-
uses: docker/login-action@v4
|
|
97
|
-
with:
|
|
98
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
99
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
100
|
-
|
|
101
|
-
- name: Login to GHCR
|
|
102
|
-
uses: docker/login-action@v4
|
|
103
|
-
with:
|
|
104
|
-
registry: ghcr.io
|
|
105
|
-
username: ${{ github.repository_owner }}
|
|
106
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
|
107
|
-
|
|
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)
|
|
112
|
-
uses: docker/build-push-action@v7
|
|
113
|
-
with:
|
|
114
|
-
context: .
|
|
115
|
-
platforms: ${{ matrix.platform }}
|
|
116
|
-
load: true
|
|
117
|
-
tags: emailengine:smoke-test
|
|
118
|
-
cache-from: type=gha,scope=${{ matrix.arch }}
|
|
119
|
-
build-args: |
|
|
120
|
-
EE_COMMIT_HASH=${{ github.sha }}
|
|
121
|
-
|
|
122
|
-
- name: Smoke test the CLI inside the image
|
|
123
|
-
run: bash .github/docker-smoke-test.sh emailengine:smoke-test
|
|
124
|
-
|
|
125
|
-
# Pushed by digest and left untagged: the release tags can only be attached once both
|
|
126
|
-
# architectures exist, which is what the manifest job below does. Both registries are
|
|
127
|
-
# written here so the blobs are already in place and the manifest job never has to copy
|
|
128
|
-
# them between registries.
|
|
129
|
-
- name: Build and push by digest
|
|
130
|
-
id: build
|
|
131
|
-
uses: docker/build-push-action@v7
|
|
132
|
-
with:
|
|
133
|
-
context: .
|
|
134
|
-
platforms: ${{ matrix.platform }}
|
|
135
|
-
outputs: type=image,"name=docker.io/${{ github.repository }},ghcr.io/${{ github.repository }}",push-by-digest=true,name-canonical=true,push=true
|
|
136
|
-
cache-from: type=gha,scope=${{ matrix.arch }}
|
|
137
|
-
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
|
|
138
|
-
build-args: |
|
|
139
|
-
EE_COMMIT_HASH=${{ github.sha }}
|
|
140
|
-
|
|
141
|
-
- name: Export digest
|
|
142
|
-
run: |
|
|
143
|
-
mkdir -p /tmp/digests
|
|
144
|
-
digest="${{ steps.build.outputs.digest }}"
|
|
145
|
-
touch "/tmp/digests/${digest#sha256:}"
|
|
146
|
-
|
|
147
|
-
- name: Upload digest
|
|
148
|
-
uses: actions/upload-artifact@v4
|
|
149
|
-
with:
|
|
150
|
-
name: digests-${{ matrix.arch }}
|
|
151
|
-
path: /tmp/digests/*
|
|
152
|
-
if-no-files-found: error
|
|
153
|
-
# Long enough for "Re-run failed jobs" on a later working day to still find the
|
|
154
|
-
# digest of the leg that passed; the check below refuses to publish without it
|
|
155
|
-
retention-days: 7
|
|
156
|
-
|
|
157
|
-
publish_docker_manifest:
|
|
158
|
-
name: Publish Tagged Docker Manifest
|
|
159
|
-
runs-on: ubuntu-24.04
|
|
160
|
-
needs: [release_please, publish_docker]
|
|
161
|
-
# A dependent job is skipped when its needs are, so this is belt and braces - but it keeps
|
|
162
|
-
# the gate visible in the job itself rather than only in the job it depends on.
|
|
163
|
-
if: needs.release_please.outputs.release_created
|
|
164
|
-
timeout-minutes: 15
|
|
165
|
-
steps:
|
|
166
|
-
- name: Download digests
|
|
167
|
-
uses: actions/download-artifact@v4
|
|
168
|
-
with:
|
|
169
|
-
path: /tmp/digests
|
|
170
|
-
pattern: digests-*
|
|
171
|
-
merge-multiple: true
|
|
172
|
-
|
|
173
|
-
# One digest file per platform in the build matrix. With fail-fast off, one leg can
|
|
174
|
-
# push its digest while the other fails, and a re-run that finds only the surviving
|
|
175
|
-
# artifact (or none, once they expire) would otherwise publish a single-platform
|
|
176
|
-
# manifest list under every tag as if it were complete.
|
|
177
|
-
- name: Check that every platform produced a digest
|
|
178
|
-
working-directory: /tmp/digests
|
|
179
|
-
run: |
|
|
180
|
-
count=$(ls -1 | wc -l)
|
|
181
|
-
if [ "$count" -ne 2 ]; then
|
|
182
|
-
echo "Expected 2 digests (linux/amd64, linux/arm64), found $count:"
|
|
183
|
-
ls -1
|
|
184
|
-
exit 1
|
|
185
|
-
fi
|
|
186
|
-
|
|
187
|
-
- name: Set up Docker Buildx
|
|
188
|
-
uses: docker/setup-buildx-action@v4
|
|
189
|
-
|
|
190
|
-
- name: Login to DockerHub
|
|
191
|
-
uses: docker/login-action@v4
|
|
192
|
-
with:
|
|
193
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
194
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
195
|
-
|
|
196
|
-
- name: Login to GHCR
|
|
197
|
-
uses: docker/login-action@v4
|
|
198
|
-
with:
|
|
199
|
-
registry: ghcr.io
|
|
200
|
-
username: ${{ github.repository_owner }}
|
|
201
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
|
202
|
-
|
|
203
|
-
- name: Create and push the manifest list
|
|
204
|
-
working-directory: /tmp/digests
|
|
205
|
-
env:
|
|
206
|
-
MAJOR: ${{ needs.release_please.outputs.major }}
|
|
207
|
-
MINOR: ${{ needs.release_please.outputs.minor }}
|
|
208
|
-
PATCH: ${{ needs.release_please.outputs.patch }}
|
|
209
|
-
run: |
|
|
210
|
-
for image in "docker.io/${{ github.repository }}" "ghcr.io/${{ github.repository }}"; do
|
|
211
|
-
docker buildx imagetools create \
|
|
212
|
-
-t "${image}:latest" \
|
|
213
|
-
-t "${image}:v${MAJOR}.${MINOR}.${PATCH}" \
|
|
214
|
-
-t "${image}:v${MAJOR}.${MINOR}" \
|
|
215
|
-
-t "${image}:v${MAJOR}" \
|
|
216
|
-
$(printf "${image}@sha256:%s " *)
|
|
217
|
-
done
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
name: Run Tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
pull_request:
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
contents: read
|
|
9
|
-
|
|
10
|
-
concurrency:
|
|
11
|
-
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
-
cancel-in-progress: true
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
# Skip CI for release-please's auto-generated release PR / branch: it only bumps the
|
|
16
|
-
# version + CHANGELOG (no code change), so re-running the suite is wasted work. This is
|
|
17
|
-
# gated per job rather than with [skip ci] in the release commit, because that text would
|
|
18
|
-
# ride the squash-merge into master and skip the Manage Release run, breaking releases.
|
|
19
|
-
license_check:
|
|
20
|
-
name: License Compliance Check
|
|
21
|
-
if: ${{ !startsWith(github.ref_name, 'release-please--') && !startsWith(github.head_ref, 'release-please--') }}
|
|
22
|
-
runs-on: ubuntu-24.04
|
|
23
|
-
# Service containers to run with `container-job`
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v6
|
|
26
|
-
|
|
27
|
-
- name: Use Node.js 24
|
|
28
|
-
uses: actions/setup-node@v6
|
|
29
|
-
with:
|
|
30
|
-
node-version: 24
|
|
31
|
-
cache: npm
|
|
32
|
-
- run: npm install
|
|
33
|
-
|
|
34
|
-
- name: Run License Checks
|
|
35
|
-
run: |
|
|
36
|
-
npm run licenses
|
|
37
|
-
|
|
38
|
-
lint:
|
|
39
|
-
name: Lint
|
|
40
|
-
if: ${{ !startsWith(github.ref_name, 'release-please--') && !startsWith(github.head_ref, 'release-please--') }}
|
|
41
|
-
runs-on: ubuntu-24.04
|
|
42
|
-
timeout-minutes: 10
|
|
43
|
-
steps:
|
|
44
|
-
- uses: actions/checkout@v6
|
|
45
|
-
- name: Use Node.js 24
|
|
46
|
-
uses: actions/setup-node@v6
|
|
47
|
-
with:
|
|
48
|
-
node-version: 24
|
|
49
|
-
cache: npm
|
|
50
|
-
- run: npm install
|
|
51
|
-
- name: Run ESLint
|
|
52
|
-
run: |
|
|
53
|
-
npm run lint
|
|
54
|
-
|
|
55
|
-
unit:
|
|
56
|
-
name: Unit Tests
|
|
57
|
-
if: ${{ !startsWith(github.ref_name, 'release-please--') && !startsWith(github.head_ref, 'release-please--') }}
|
|
58
|
-
timeout-minutes: 10
|
|
59
|
-
runs-on: ubuntu-24.04
|
|
60
|
-
# Service containers to run with `container-job`
|
|
61
|
-
services:
|
|
62
|
-
# Label used to access the service container
|
|
63
|
-
redis:
|
|
64
|
-
# Docker Hub image
|
|
65
|
-
image: redis
|
|
66
|
-
# Set health checks to wait until redis has started
|
|
67
|
-
options: >-
|
|
68
|
-
--health-cmd "redis-cli ping"
|
|
69
|
-
--health-interval 10s
|
|
70
|
-
--health-timeout 5s
|
|
71
|
-
--health-retries 5
|
|
72
|
-
ports:
|
|
73
|
-
- 6379:6379
|
|
74
|
-
steps:
|
|
75
|
-
- uses: actions/checkout@v6
|
|
76
|
-
- name: Use Node.js 24
|
|
77
|
-
uses: actions/setup-node@v6
|
|
78
|
-
with:
|
|
79
|
-
node-version: 24
|
|
80
|
-
cache: npm
|
|
81
|
-
- run: npm install
|
|
82
|
-
- name: Run unit tests
|
|
83
|
-
run: |
|
|
84
|
-
npm run test:unit
|
|
85
|
-
env:
|
|
86
|
-
NODE_ENV: test
|
|
87
|
-
# account-revoke-on-delete-test.js runs against live Gmail when
|
|
88
|
-
# these are present and skips itself when they are not
|
|
89
|
-
GMAIL_API_PROJECT_ID: ${{ secrets.TEST_GMAIL_API_PROJECT_ID }}
|
|
90
|
-
GMAIL_API_CLIENT_ID: ${{ secrets.TEST_GMAIL_API_CLIENT_ID }}
|
|
91
|
-
GMAIL_API_CLIENT_SECRET: ${{ secrets.TEST_GMAIL_API_CLIENT_SECRET }}
|
|
92
|
-
GMAIL_API_SERVICE_EMAIL: ${{ secrets.TEST_GMAIL_API_SERVICE_EMAIL }}
|
|
93
|
-
GMAIL_API_SERVICE_CLIENT: ${{ secrets.TEST_GMAIL_API_SERVICE_CLIENT }}
|
|
94
|
-
GMAIL_API_SERVICE_KEY: ${{ secrets.TEST_GMAIL_API_SERVICE_KEY }}
|
|
95
|
-
GMAIL_API_ACCOUNT_EMAIL_1: ${{ secrets.TEST_GMAIL_API_ACCOUNT_EMAIL_1 }}
|
|
96
|
-
GMAIL_API_ACCOUNT_REFRESH_1: ${{ secrets.TEST_GMAIL_API_ACCOUNT_REFRESH_1 }}
|
|
97
|
-
|
|
98
|
-
dovecot:
|
|
99
|
-
# Live IMAP tier against a real IMAP4rev2 server (Dovecot 2.4 in Docker);
|
|
100
|
-
# fully hermetic - needs no external mail accounts. See test/dovecot/README.md
|
|
101
|
-
name: Live Dovecot Tests (IMAP4rev2)
|
|
102
|
-
if: ${{ !startsWith(github.ref_name, 'release-please--') && !startsWith(github.head_ref, 'release-please--') }}
|
|
103
|
-
timeout-minutes: 15
|
|
104
|
-
runs-on: ubuntu-24.04
|
|
105
|
-
services:
|
|
106
|
-
redis:
|
|
107
|
-
image: redis
|
|
108
|
-
options: >-
|
|
109
|
-
--health-cmd "redis-cli ping"
|
|
110
|
-
--health-interval 10s
|
|
111
|
-
--health-timeout 5s
|
|
112
|
-
--health-retries 5
|
|
113
|
-
ports:
|
|
114
|
-
- 6379:6379
|
|
115
|
-
steps:
|
|
116
|
-
- uses: actions/checkout@v6
|
|
117
|
-
- name: Use Node.js 24
|
|
118
|
-
uses: actions/setup-node@v6
|
|
119
|
-
with:
|
|
120
|
-
node-version: 24
|
|
121
|
-
cache: npm
|
|
122
|
-
- run: npm install
|
|
123
|
-
- name: Run live Dovecot tests
|
|
124
|
-
run: |
|
|
125
|
-
npm run test:dovecot
|
|
126
|
-
env:
|
|
127
|
-
EENGINE_DOVECOT_PLATFORM: linux/amd64
|
|
128
|
-
|
|
129
|
-
# Nothing else in CI bundles a binary, so pkg failures used to surface only when a release
|
|
130
|
-
# was cut by hand on a Mac - the one place they are most expensive and least expected. Two
|
|
131
|
-
# landed in a single day: a local helper named `require` in lib/openapi/ that pkg's module
|
|
132
|
-
# walker choked on (undetectable by any test, since it runs correctly under Node), and a
|
|
133
|
-
# dependency shipping a 0-byte ESM entry point that esbuild transformed to nothing. The
|
|
134
|
-
# first sat undetected for four days and would have broken the next release outright.
|
|
135
|
-
#
|
|
136
|
-
# One target, unsigned, uncompressed. Signing and notarization need Apple credentials and
|
|
137
|
-
# stay on the release machine; neither has any bearing on whether the bundle can be built.
|
|
138
|
-
# The image ships an OS and a Node runtime we do not build, so its vulnerabilities arrive on
|
|
139
|
-
# someone else's schedule rather than in a diff. Nothing watched that before, and the base pin
|
|
140
|
-
# sat unmoved for 19 months while 21 Alpine CVEs accumulated behind it.
|
|
141
|
-
#
|
|
142
|
-
# Scoped to fixed HIGH/CRITICAL on purpose. An unfixed upstream CVE is not actionable here and
|
|
143
|
-
# would block unrelated work at random; once a fix exists, a rebuild picks it up through
|
|
144
|
-
# `apk upgrade`, or the base pin needs moving - both of which are on us.
|
|
145
|
-
docker_scan:
|
|
146
|
-
name: Docker Image Scan
|
|
147
|
-
if: ${{ !startsWith(github.ref_name, 'release-please--') && !startsWith(github.head_ref, 'release-please--') }}
|
|
148
|
-
runs-on: ubuntu-24.04
|
|
149
|
-
timeout-minutes: 20
|
|
150
|
-
steps:
|
|
151
|
-
- uses: actions/checkout@v6
|
|
152
|
-
|
|
153
|
-
# Single arch: the findings are properties of the base image and the lockfile, neither of
|
|
154
|
-
# which differs per architecture, so scanning both legs would only double the runtime.
|
|
155
|
-
- name: Build the image
|
|
156
|
-
uses: docker/build-push-action@v7
|
|
157
|
-
with:
|
|
158
|
-
context: .
|
|
159
|
-
platforms: linux/amd64
|
|
160
|
-
load: true
|
|
161
|
-
tags: emailengine:scan
|
|
162
|
-
build-args: |
|
|
163
|
-
EE_COMMIT_HASH=${{ github.sha }}
|
|
164
|
-
|
|
165
|
-
- name: Scan for known vulnerabilities
|
|
166
|
-
uses: aquasecurity/trivy-action@v0.36.0
|
|
167
|
-
with:
|
|
168
|
-
image-ref: emailengine:scan
|
|
169
|
-
scanners: vuln
|
|
170
|
-
severity: HIGH,CRITICAL
|
|
171
|
-
ignore-unfixed: true
|
|
172
|
-
exit-code: '1'
|
|
173
|
-
format: table
|
|
174
|
-
env:
|
|
175
|
-
# Trivy pulls its database from ghcr.io and is rate limited unauthenticated
|
|
176
|
-
TRIVY_USERNAME: ${{ github.actor }}
|
|
177
|
-
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
|
178
|
-
|
|
179
|
-
pkg_build:
|
|
180
|
-
name: Binary Build (linux-x64, unsigned)
|
|
181
|
-
if: ${{ !startsWith(github.ref_name, 'release-please--') && !startsWith(github.head_ref, 'release-please--') }}
|
|
182
|
-
timeout-minutes: 20
|
|
183
|
-
runs-on: ubuntu-24.04
|
|
184
|
-
services:
|
|
185
|
-
redis:
|
|
186
|
-
image: redis
|
|
187
|
-
options: >-
|
|
188
|
-
--health-cmd "redis-cli ping"
|
|
189
|
-
--health-interval 10s
|
|
190
|
-
--health-timeout 5s
|
|
191
|
-
--health-retries 5
|
|
192
|
-
ports:
|
|
193
|
-
- 6379:6379
|
|
194
|
-
steps:
|
|
195
|
-
- uses: actions/checkout@v6
|
|
196
|
-
- name: Use Node.js 24
|
|
197
|
-
uses: actions/setup-node@v6
|
|
198
|
-
with:
|
|
199
|
-
node-version: 24
|
|
200
|
-
cache: npm
|
|
201
|
-
|
|
202
|
-
# Unpinned on purpose, matching upload.sh: releases are built with whatever pkg is
|
|
203
|
-
# current, so a pkg regression should fail here rather than mid-release.
|
|
204
|
-
- name: Install pkg
|
|
205
|
-
run: npm install -g @yao-pkg/pkg
|
|
206
|
-
|
|
207
|
-
# The real production tree rather than a dev install. That distinction matters: the
|
|
208
|
-
# empty-ESM-file failure only exists under `npm ci --omit=dev`, and
|
|
209
|
-
# prepare-bundle-deps.sh, which works around it, only runs from this script.
|
|
210
|
-
- name: Build the production source tree
|
|
211
|
-
run: npm run build-source
|
|
212
|
-
|
|
213
|
-
# Uncompressed - Brotli is minutes of CPU that changes nothing about the module
|
|
214
|
-
# resolution this job exists to exercise. `--output` ignores the `outputPath` in
|
|
215
|
-
# package.json, so it names the directory itself; ee-dist is already gitignored,
|
|
216
|
-
# which keeps a stray 260 MB binary out of the way when running this locally.
|
|
217
|
-
- name: Bundle a binary
|
|
218
|
-
run: |
|
|
219
|
-
mkdir -p ee-dist
|
|
220
|
-
pkg --target node24-linux-x64 --output ee-dist/emailengine-ci package.json
|
|
221
|
-
|
|
222
|
-
- name: Smoke test the CLI
|
|
223
|
-
run: |
|
|
224
|
-
./ee-dist/emailengine-ci --version
|
|
225
|
-
./ee-dist/emailengine-ci help > /dev/null
|
|
226
|
-
|
|
227
|
-
# Booting reaches past what the CLI touches: workers, and the views, static files and
|
|
228
|
-
# lua scripts that are bundled as pkg assets rather than resolved as modules, so a
|
|
229
|
-
# missing asset shows up here instead of in a released binary.
|
|
230
|
-
- name: Boot the binary and check it serves
|
|
231
|
-
env:
|
|
232
|
-
EENGINE_REDIS: redis://127.0.0.1:6379/12
|
|
233
|
-
EENGINE_PORT: 7311
|
|
234
|
-
EENGINE_HOST: 127.0.0.1
|
|
235
|
-
EENGINE_LOG_LEVEL: error
|
|
236
|
-
run: |
|
|
237
|
-
./ee-dist/emailengine-ci &
|
|
238
|
-
for i in $(seq 1 60); do
|
|
239
|
-
if curl -fsS http://127.0.0.1:7311/health >/dev/null 2>&1; then
|
|
240
|
-
echo "binary booted and served /health"
|
|
241
|
-
curl -fsS -o /dev/null http://127.0.0.1:7311/swagger.json
|
|
242
|
-
echo "generated document served"
|
|
243
|
-
exit 0
|
|
244
|
-
fi
|
|
245
|
-
sleep 2
|
|
246
|
-
done
|
|
247
|
-
echo "binary never became healthy" >&2
|
|
248
|
-
exit 1
|
|
249
|
-
|
|
250
|
-
integration:
|
|
251
|
-
name: Integration Tests
|
|
252
|
-
if: ${{ !startsWith(github.ref_name, 'release-please--') && !startsWith(github.head_ref, 'release-please--') }}
|
|
253
|
-
timeout-minutes: 15 # Increased timeout for Gmail API tests
|
|
254
|
-
runs-on: ubuntu-24.04
|
|
255
|
-
# Service containers to run with `container-job`
|
|
256
|
-
services:
|
|
257
|
-
# Label used to access the service container
|
|
258
|
-
redis:
|
|
259
|
-
# Docker Hub image
|
|
260
|
-
image: redis
|
|
261
|
-
# Set health checks to wait until redis has started
|
|
262
|
-
options: >-
|
|
263
|
-
--health-cmd "redis-cli ping"
|
|
264
|
-
--health-interval 10s
|
|
265
|
-
--health-timeout 5s
|
|
266
|
-
--health-retries 5
|
|
267
|
-
ports:
|
|
268
|
-
- 6379:6379
|
|
269
|
-
steps:
|
|
270
|
-
- uses: actions/checkout@v6
|
|
271
|
-
- name: Use Node.js 24
|
|
272
|
-
uses: actions/setup-node@v6
|
|
273
|
-
with:
|
|
274
|
-
node-version: 24
|
|
275
|
-
cache: npm
|
|
276
|
-
- run: npm install
|
|
277
|
-
- name: Run integration tests
|
|
278
|
-
run: |
|
|
279
|
-
npm run test:integration
|
|
280
|
-
env:
|
|
281
|
-
NODE_ENV: test
|
|
282
|
-
GMAIL_API_PROJECT_ID: ${{ secrets.TEST_GMAIL_API_PROJECT_ID }}
|
|
283
|
-
GMAIL_API_CLIENT_ID: ${{ secrets.TEST_GMAIL_API_CLIENT_ID }}
|
|
284
|
-
GMAIL_API_CLIENT_SECRET: ${{ secrets.TEST_GMAIL_API_CLIENT_SECRET }}
|
|
285
|
-
GMAIL_API_SERVICE_EMAIL: ${{ secrets.TEST_GMAIL_API_SERVICE_EMAIL }}
|
|
286
|
-
GMAIL_API_SERVICE_CLIENT: ${{ secrets.TEST_GMAIL_API_SERVICE_CLIENT }}
|
|
287
|
-
GMAIL_API_SERVICE_KEY: ${{ secrets.TEST_GMAIL_API_SERVICE_KEY }}
|
|
288
|
-
GMAIL_API_ACCOUNT_EMAIL_1: ${{ secrets.TEST_GMAIL_API_ACCOUNT_EMAIL_1 }}
|
|
289
|
-
GMAIL_API_ACCOUNT_REFRESH_1: ${{ secrets.TEST_GMAIL_API_ACCOUNT_REFRESH_1 }}
|
|
290
|
-
GMAIL_API_ACCOUNT_EMAIL_2: ${{ secrets.TEST_GMAIL_API_ACCOUNT_EMAIL_2 }}
|
|
291
|
-
GMAIL_API_ACCOUNT_REFRESH_2: ${{ secrets.TEST_GMAIL_API_ACCOUNT_REFRESH_2 }}
|
|
292
|
-
GMAIL_SENDONLY_PROJECT_ID: ${{ secrets.GMAIL_SENDONLY_PROJECT_ID }}
|
|
293
|
-
GMAIL_SENDONLY_CLIENT_ID: ${{ secrets.GMAIL_SENDONLY_CLIENT_ID }}
|
|
294
|
-
GMAIL_SENDONLY_CLIENT_SECRET: ${{ secrets.GMAIL_SENDONLY_CLIENT_SECRET }}
|
|
295
|
-
GMAIL_SENDONLY_ACCOUNT_EMAIL: ${{ secrets.GMAIL_SENDONLY_ACCOUNT_EMAIL }}
|
|
296
|
-
GMAIL_SENDONLY_ACCOUNT_REFRESH: ${{ secrets.GMAIL_SENDONLY_ACCOUNT_REFRESH }}
|
|
297
|
-
OUTLOOK_SERVICE_CLIENT_ID: ${{ secrets.OUTLOOK_SERVICE_CLIENT_ID }}
|
|
298
|
-
OUTLOOK_SERVICE_TENANT_ID: ${{ secrets.OUTLOOK_SERVICE_TENANT_ID }}
|
|
299
|
-
OUTLOOK_SERVICE_CLIENT_SECRET: ${{ secrets.OUTLOOK_SERVICE_CLIENT_SECRET }}
|
|
300
|
-
OUTLOOK_SERVICE_ACCOUNT_EMAIL: ${{ secrets.OUTLOOK_SERVICE_ACCOUNT_EMAIL }}
|
|
301
|
-
GMAIL_SERVICE_POSTALSYS_CLIENT: ${{ secrets.GMAIL_SERVICE_POSTALSYS_CLIENT }}
|
|
302
|
-
GMAIL_SERVICE_POSTALSYS_SERVICE_EMAIL: ${{ secrets.GMAIL_SERVICE_POSTALSYS_SERVICE_EMAIL }}
|
|
303
|
-
GMAIL_SERVICE_POSTALSYS_KEY: ${{ secrets.GMAIL_SERVICE_POSTALSYS_KEY }}
|
|
304
|
-
GMAIL_SERVICE_POSTALSYS_ACCOUNT_EMAIL: ${{ secrets.GMAIL_SERVICE_POSTALSYS_ACCOUNT_EMAIL }}
|
|
305
|
-
GMAIL_WIF_SA_KEY: ${{ secrets.GMAIL_WIF_SA_KEY }}
|
|
306
|
-
GMAIL_WIF_AUDIENCE: ${{ secrets.GMAIL_WIF_AUDIENCE }}
|
|
307
|
-
GMAIL_WIF_ACCOUNT_EMAIL: ${{ secrets.GMAIL_WIF_ACCOUNT_EMAIL }}
|