diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d768329..5d1cca8 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 @@ -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 42a9bb9..e81c15f 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 @@ -11,4 +13,4 @@ env: jobs: publish: uses: haraka/.github/.github/workflows/publish.yml@master - secrets: inherit \ No newline at end of file + secrets: inherit 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..fd5867b 100644 --- a/Changes.md +++ b/Changes.md @@ -2,16 +2,17 @@ ### Unreleased -### [1.0.3] - 2022-06-05 +### [1.0.4] - 2023-12-12 + +- ci: publish updates, shared test actions +- doc(README): formatting + -#### Added +### [1.0.3] - 2022-06-05 - 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 @@ -30,3 +31,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/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 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": {