From e2aaabff688683abd8b9d4c4c58dbfea2a47ba0b Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 12 Dec 2023 21:54:28 -0800 Subject: [PATCH 1/4] ci: publish updates style: use es6 for...of --- .github/workflows/ci.yml | 2 +- .github/workflows/publish.yml | 2 ++ .release | 2 +- Changes.md | 17 +++++++++++++++++ index.js | 15 ++++++--------- package.json | 2 +- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d768329..5360933 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [ push ] +on: [ push, pull_request ] env: CI: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 42a9bb9..d489fbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,8 @@ on: push: branches: - master + paths: + - package.json env: CI: true diff --git a/.release b/.release index 9be2b27..0890e94 160000 --- a/.release +++ b/.release @@ -1 +1 @@ -Subproject commit 9be2b270ef836bcfefda085674bf62e2a91defe8 +Subproject commit 0890e945e4e061c96c7b2ab45017525904c17728 diff --git a/Changes.md b/Changes.md index 52723f9..d94957b 100644 --- a/Changes.md +++ b/Changes.md @@ -2,6 +2,22 @@ ### Unreleased +### [1.0.4] - 2023-12-12 + +#### Added + +- + +#### Fixed + +- + +#### Changed + +- + + + ### [1.0.3] - 2022-06-05 #### Added @@ -30,3 +46,4 @@ - added from_phish [1.0.3]: https://github.com/haraka/haraka-plugin-headers/releases/tag/1.0.3 +[1.0.4]: https://github.com/haraka/haraka-plugin-headers/releases/tag/1.0.4 diff --git a/index.js b/index.js index 7d7b6a1..1f6813d 100644 --- a/index.js +++ b/index.js @@ -73,12 +73,11 @@ exports.duplicate_singular = function (next, connection) { ]; const failures = []; - for (let i=0; i < singular.length; i++ ) { - if (connection.transaction.header.get_all(singular[i]).length <= 1) { + for (const name of singular) { + if (connection.transaction.header.get_all(name).length <= 1) { continue; } - const name = singular[i]; connection.transaction.results.add(plugin, {fail: `duplicate:${name}`}); failures.push(name); } @@ -222,8 +221,7 @@ exports.user_agent = function (next, connection) { 'x-ms-has-attach' ]; // for (const h in headers) {} - for (let i=0; i < headers.length; i++) { - const name = headers[i]; + for (const name of headers) { const header = connection.transaction.header.get(name); if (!header) continue; // header not present found_ua++; @@ -339,8 +337,8 @@ exports.delivered_to = function (next, connection) { if (!del_to) return next(); const rcpts = connection.transaction.rcpt_to; - for (let i=0; i { const header = connection.transaction.header.get(name); if (!header) { return; } // header not present - for (let i=0; i < mlms[name].length; i++) { - const j = mlms[name][i]; + for (const j of mlms[name]) { if (j.start) { if (header.substring(0,j.start.length) === j.start) { txr.add(plugin, {pass: `MLM(${j.mlm})`}); diff --git a/package.json b/package.json index 3c7e0bb..521c67b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haraka-plugin-headers", - "version": "1.0.3", + "version": "1.0.4", "description": "Haraka plugin that performs tests on email headers", "main": "index.js", "scripts": { From 37f160bd44bc15525fa9e03e838516bd6e31be17 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 12 Dec 2023 21:57:23 -0800 Subject: [PATCH 2/4] ci: more shared workflows --- .github/workflows/ci.yml | 30 ++++++------------------------ .github/workflows/publish.yml | 2 +- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5360933..5d1cca8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,28 +14,10 @@ jobs: # uses: haraka/.github/.github/workflows/coverage.yml@master # secrets: inherit - test: - needs: [ lint, get-lts ] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, windows-latest ] - node-version: ${{ fromJson(needs.get-lts.outputs.active) }} - fail-fast: false - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - name: Node ${{ matrix.node-version }} on ${{ matrix.os }} - with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm test + ubuntu: + needs: [ lint ] + uses: haraka/.github/.github/workflows/ubuntu.yml@master - get-lts: - runs-on: ubuntu-latest - steps: - - id: get - uses: msimerson/node-lts-versions@v1 - outputs: - active: ${{ steps.get.outputs.active }} - lts: ${{ steps.get.outputs.lts }} + windows: + needs: [ lint ] + uses: haraka/.github/.github/workflows/windows.yml@master diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d489fbd..e81c15f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,4 +13,4 @@ env: jobs: publish: uses: haraka/.github/.github/workflows/publish.yml@master - secrets: inherit \ No newline at end of file + secrets: inherit From afd5f317d573c0829166fe125019d824a039693f Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 12 Dec 2023 21:59:09 -0800 Subject: [PATCH 3/4] doc(README): formatting --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7b038d0..f586a81 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![CI Tests][ci-img]][ci-url] [![Code Climate][clim-img]][clim-url] + [![NPM][npm-img]][npm-url] # haraka-plugin-headers From 9438b8978235db10acad7790630998470792d35b Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 12 Dec 2023 22:01:09 -0800 Subject: [PATCH 4/4] update changes --- Changes.md | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/Changes.md b/Changes.md index d94957b..fd5867b 100644 --- a/Changes.md +++ b/Changes.md @@ -4,30 +4,15 @@ ### [1.0.4] - 2023-12-12 -#### Added - -- - -#### Fixed - -- - -#### Changed - -- - +- ci: publish updates, shared test actions +- doc(README): formatting ### [1.0.3] - 2022-06-05 -#### Added - - feat: instead of early exits, skip registering - feat: add phish test - feat(from_phish): check against SPF, DKIM, and ENV FROM - -#### Changed - - ci: depends on shared haraka GHA workflows - ci(codeclimate): relax some checks - doc: fixes for config name