Skip to content

Commit

Permalink
Merge pull request #3 from haraka/release-1.0.4
Browse files Browse the repository at this point in the history
- ci: publish updates, shared test actions
- doc(README): formatting
  • Loading branch information
msimerson authored Dec 13, 2023
2 parents c7ece8b + 9438b89 commit 26207a5
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 42 deletions.
32 changes: 7 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [ push ]
on: [ push, pull_request ]

env:
CI: true
Expand All @@ -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
4 changes: 3 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches:
- master
paths:
- package.json

env:
CI: true

jobs:
publish:
uses: haraka/.github/.github/workflows/publish.yml@master
secrets: inherit
secrets: inherit
2 changes: 1 addition & 1 deletion .release
Submodule .release updated 4 files
+6 −2 CHANGELOG.md
+8 −0 README.md
+4 −1 finish.sh
+2 −2 submit.sh
12 changes: 7 additions & 5 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![CI Tests][ci-img]][ci-url]
[![Code Climate][clim-img]][clim-url]

[![NPM][npm-img]][npm-url]

# haraka-plugin-headers
Expand Down
15 changes: 6 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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<rcpts.length; i++) {
const rcpt = rcpts[i].address();
for (const rcptElement of rcpts) {
const rcpt = rcptElement.address();
if (rcpt !== del_to) continue;
connection.transaction.results.add(plugin, {emit: true, fail: 'delivered_to'});
if (!plugin.cfg.reject.delivered_to) continue;
Expand Down Expand Up @@ -374,8 +372,7 @@ exports.mailing_list = function (next, connection) {
Object.keys(mlms).forEach(name => {
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})`});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 26207a5

Please sign in to comment.