diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0449e4a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + allow: + - dependency-type: production diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d768329 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: [ push ] + +env: + CI: true + +jobs: + + lint: + uses: haraka/.github/.github/workflows/lint.yml@master + + # coverage: + # 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 + + 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 }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..383aca2 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,13 @@ +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '18 7 * * 4' + +jobs: + codeql: + uses: haraka/.github/.github/workflows/codeql.yml@master diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..42a9bb9 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,14 @@ +name: publish + +on: + push: + branches: + - master + +env: + CI: true + +jobs: + publish: + uses: haraka/.github/.github/workflows/publish.yml@master + secrets: inherit \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5148e52..f8faa6b 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ jspm_packages # Optional REPL history .node_repl_history + +package-lock.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a8e94cb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".release"] + path = .release + url = git@github.com:msimerson/.release.git diff --git a/.release b/.release new file mode 160000 index 0000000..20e8e5d --- /dev/null +++ b/.release @@ -0,0 +1 @@ +Subproject commit 20e8e5dbcf634c2f568d973966be42c4504db480 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6d15570..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: node_js -node_js: - - "8" - - "10" - - "12" - -services: -# https://docs.travis-ci.com/user/database-setup/ -# - mongodb -# - elasticsearch -# - redis-server - -before_script: - -script: - - npm run lint - - npm test - -after_success: -# -# enable codecov, which doesn't currently work for plugins because -# plugins are run in vm.runInNewContext() -# -# - npm install istanbul codecov -# - npm run cover -# - ./node_modules/.bin/codecov - -sudo: false diff --git a/Changes.md b/Changes.md index ef4d70c..76d4677 100644 --- a/Changes.md +++ b/Changes.md @@ -1,4 +1,12 @@ +### Unreleased + +### [1.0.3] - 2022-06-05 + +- ci: replace travis & appveyor with github actions +- ci: add submodule .release + + # 1.0.1 - 2018-10-23 - Added support for custom root CAs @@ -7,3 +15,6 @@ # 1.0.0 - 2018-10-21 - initial release + + +[1.0.3]: https://github.com/haraka/haraka-plugin-auth-imap/releases/tag/1.0.3 diff --git a/README.md b/README.md index 1a7aafb..775c9ca 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ [![Build Status][ci-img]][ci-url] [![Code Climate][clim-img]][clim-url] -[![Greenkeeper badge][gk-img]][gk-url] [![NPM][npm-img]][npm-url] - - # haraka-plugin-auth-imap @@ -64,15 +61,9 @@ to be declared. Example: -[ci-img]: https://travis-ci.org/haraka/haraka-plugin-auth-imap.svg -[ci-url]: https://travis-ci.org/haraka/haraka-plugin-auth-imap -[ci-win-img]: https://ci.appveyor.com/api/projects/status/CHANGETHIS?svg=true -[ci-win-url]: https://ci.appveyor.com/project/haraka/haraka-CHANGETHIS -[cov-img]: https://codecov.io/github/haraka/haraka-plugin-auth-imap/coverage.svg -[cov-url]: https://codecov.io/github/haraka/haraka-plugin-auth-imap +[ci-img]: https://github.com/haraka/haraka-plugin-auth-imap/actions/workflows/ci.yml/badge.svg +[ci-url]: https://github.com/haraka/haraka-plugin-auth-imap/actions/workflows/ci.yml [clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-auth-imap/badges/gpa.svg [clim-url]: https://codeclimate.com/github/haraka/haraka-plugin-auth-imap -[gk-img]: https://badges.greenkeeper.io/haraka/haraka-plugin-auth-imap.svg -[gk-url]: https://greenkeeper.io/ [npm-img]: https://nodei.co/npm/haraka-plugin-auth-imap.png [npm-url]: https://www.npmjs.com/package/haraka-plugin-auth-imap diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 873f67c..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -environment: - nodejs_version: "8" - -install: - - npm install - -before_build: -build: off -after_build: - -before_test: - - node --version - - npm --version - -test_script: - - npm test - -after_test: diff --git a/index.js b/index.js index b6375cf..d2fb38a 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ exports.hook_capabilities = function (next, connection) { // Don't offer AUTH capabilities by default unless session is encrypted if (connection.tls.enabled) { const methods = ['PLAIN', 'LOGIN']; - connection.capabilities.push('AUTH ' + methods.join(' ')); + connection.capabilities.push(`AUTH ${ methods.join(' ')}`); connection.notes.allowed_auth_methods = methods; } next(); @@ -53,7 +53,7 @@ exports.check_plain_passwd = function (connection, user, passwd, cb) { } const config = { - user: user, + user, password: passwd, host: 'localhost', port: 143, @@ -90,8 +90,8 @@ exports.check_plain_passwd = function (connection, user, passwd, cb) { if (sect.users) { if (sect.users.split(/\s*,\s*/).indexOf((user.split('@'))[0]) < 0) { - connection.loginfo(plugin, 'AUTH user="' + user + - '" is not allowed to authenticate by imap' + connection.loginfo(plugin, `AUTH user="${ user + }" is not allowed to authenticate by imap` ); return cb(false); } @@ -99,24 +99,24 @@ exports.check_plain_passwd = function (connection, user, passwd, cb) { const client = new plugin.imap(config); - let message = 'section="' + section_name + '" host="' + - config.host + '" port="' + config.port + '" tls=' + config.tls; + let message = `section="${ section_name }" host="${ + config.host }" port="${ config.port }" tls=${ config.tls}`; if (config.tlsOptions) { - message += ' rejectUnauthorized=' + config.tlsOptions - .rejectUnauthorized; + message += ` rejectUnauthorized=${ config.tlsOptions + .rejectUnauthorized}`; } if (config.connTimeout) { - message += ' connTimeout=' + config.connTimeout; + message += ` connTimeout=${ config.connTimeout}`; } if (config.authTimeout) { - message += ' authTimeout=' + config.authTimeout; + message += ` authTimeout=${ config.authTimeout}`; } connection.logdebug(plugin, message); client.once('ready', function () { - connection.loginfo(plugin, 'AUTH user="' + user + - '" success=true'); + connection.loginfo(plugin, `AUTH user="${ user + }" success=true`); if (trace_imap) { connection.logdebug(plugin, client); } @@ -125,8 +125,8 @@ exports.check_plain_passwd = function (connection, user, passwd, cb) { }); client.once('error', function (err) { - connection.loginfo(plugin, 'AUTH user="' + user + - '" success=false error="' + err.message + '"'); + connection.loginfo(plugin, `AUTH user="${ user + }" success=false error="${ err.message }"`); if (trace_imap) { connection.logdebug(plugin, client); } diff --git a/package.json b/package.json index 5f305f7..96b433f 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "haraka-plugin-auth-imap", - "version": "1.0.1", - "description": "Haraka plugin that frobnicates email connections", + "version": "1.0.3", + "description": "Haraka plugin that authenticates against an IMAP server", "main": "index.js", "scripts": { - "lint": "./node_modules/.bin/eslint *.js test/**/*.js", - "lintfix": "./node_modules/.bin/eslint --fix *.js test/**/*.js", - "test": "./node_modules/.bin/mocha" + "lint": "npx eslint *.js test", + "lintfix": "npx eslint --fix *.js test", + "test": "npx mocha" }, "repository": { "type": "git", @@ -17,16 +17,16 @@ "plugin", "auth-imap" ], - "author": "Welcome Member ", + "author": "Haraka ", "license": "MIT", "bugs": { "url": "https://github.com/haraka/haraka-plugin-auth-imap/issues" }, "homepage": "https://github.com/haraka/haraka-plugin-auth-imap#readme", "devDependencies": { - "eslint": ">=3", + "eslint": ">=8", "eslint-plugin-haraka": "*", "haraka-test-fixtures": "*", - "mocha": "*" + "mocha": ">=9" } }