-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
3,429 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
'extends': 'airbnb-base', | ||
'env': { | ||
'mocha': true, | ||
'node': true, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
coverage | ||
.idea | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- v5 | ||
- v6 | ||
- v7 | ||
script: npm run integration-test | ||
- v14 | ||
- v13 | ||
- v12 | ||
script: npm run integration-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## 1.3.1 (May 22, 2020) | ||
|
||
* Update sailor version to 2.6.7 | ||
|
||
## 1.3.0 (April 21, 2017) | ||
|
||
* Update sailor version to 2.1.0 | ||
|
||
## 1.2.0 (February 21, 2017) | ||
|
||
* Update sailor version to 2.0.0 | ||
|
||
## 1.1.0 (December 16, 2016) | ||
|
||
* Add Consume Trigger | ||
|
||
## 1.0.0 (December 15, 2016) | ||
|
||
* Initial release | ||
* Add Publish Action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,53 @@ | ||
var _ = require('lodash'); | ||
var crypto = require('crypto'); | ||
var debug = require('debug')('sailor:cipher'); | ||
/* eslint-disable new-cap */ | ||
|
||
var ALGORYTHM = 'aes-256-cbc'; | ||
var PASSWORD = process.env.ELASTICIO_MESSAGE_CRYPTO_PASSWORD; | ||
var VECTOR = process.env.ELASTICIO_MESSAGE_CRYPTO_IV; | ||
const _ = require('lodash'); | ||
const crypto = require('crypto'); | ||
|
||
exports.id = 1; | ||
exports.encrypt = encryptIV; | ||
exports.decrypt = decryptIV; | ||
const ALGORYTHM = 'aes-256-cbc'; | ||
const PASSWORD = process.env.ELASTICIO_MESSAGE_CRYPTO_PASSWORD; | ||
const VECTOR = process.env.ELASTICIO_MESSAGE_CRYPTO_IV; | ||
|
||
function encryptIV(rawData) { | ||
debug('About to encrypt:', rawData); | ||
function encryptIV(self, rawData) { | ||
self.logger.debug('About to encrypt:', rawData); | ||
|
||
if (!_.isString(rawData)) { | ||
throw new Error('RabbitMQ message cipher.encryptIV() accepts only string as parameter.'); | ||
} | ||
if (!_.isString(rawData)) { | ||
throw new Error('RabbitMQ message cipher.encryptIV() accepts only string as parameter.'); | ||
} | ||
|
||
if (!PASSWORD) { | ||
console.log('Encryption will be skipped as ELASTICIO_MESSAGE_CRYPTO_PASSWORD env is empty'); | ||
return new Buffer.from(rawData); | ||
} | ||
if (!PASSWORD) { | ||
self.logger.info('Encryption will be skipped as ELASTICIO_MESSAGE_CRYPTO_PASSWORD env is empty'); | ||
return new Buffer.from(rawData); | ||
} | ||
|
||
if (!VECTOR) { | ||
throw new Error('process.env.ELASTICIO_MESSAGE_CRYPTO_IV is not set'); | ||
} | ||
if (!VECTOR) { | ||
throw new Error('process.env.ELASTICIO_MESSAGE_CRYPTO_IV is not set'); | ||
} | ||
|
||
var encodeKey = crypto.createHash('sha256').update(PASSWORD, 'utf-8').digest(); | ||
var cipher = crypto.createCipheriv(ALGORYTHM, encodeKey, VECTOR); | ||
return Buffer.concat([cipher.update(new Buffer.from(rawData)),cipher.final()]); | ||
const encodeKey = crypto.createHash('sha256').update(PASSWORD, 'utf-8').digest(); | ||
const cipher = crypto.createCipheriv(ALGORYTHM, encodeKey, VECTOR); | ||
return Buffer.concat([cipher.update(new Buffer.from(rawData)), cipher.final()]); | ||
} | ||
|
||
function decryptIV(encData) { | ||
debug('About to decrypt:', encData); | ||
function decryptIV(self, encData) { | ||
self.logger.debug('About to decrypt:', encData); | ||
|
||
if (!PASSWORD) { | ||
console.log('Decryption will be skipped as ELASTICIO_MESSAGE_CRYPTO_PASSWORD env is empty'); | ||
return encData; | ||
} | ||
if (!PASSWORD) { | ||
self.logger.info('Decryption will be skipped as ELASTICIO_MESSAGE_CRYPTO_PASSWORD env is empty'); | ||
return encData; | ||
} | ||
|
||
if (!VECTOR) { | ||
throw new Error('process.env.ELASTICIO_MESSAGE_CRYPTO_IV is not set'); | ||
} | ||
if (!VECTOR) { | ||
throw new Error('process.env.ELASTICIO_MESSAGE_CRYPTO_IV is not set'); | ||
} | ||
|
||
var decodeKey = crypto.createHash('sha256').update(PASSWORD, 'utf-8').digest(); | ||
var cipher = crypto.createDecipheriv(ALGORYTHM, decodeKey, VECTOR); | ||
const decodeKey = crypto.createHash('sha256').update(PASSWORD, 'utf-8').digest(); | ||
const cipher = crypto.createDecipheriv(ALGORYTHM, decodeKey, VECTOR); | ||
|
||
var result = cipher.update(encData, 'base64', 'utf-8') + cipher.final('utf-8'); | ||
const result = cipher.update(encData, 'base64', 'utf-8') + cipher.final('utf-8'); | ||
|
||
return result; | ||
return result; | ||
} | ||
|
||
exports.id = 1; | ||
exports.encrypt = encryptIV; | ||
exports.decrypt = decryptIV; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
var cipher = require('./cipher.js'); | ||
const cipher = require('./cipher.js'); | ||
|
||
exports.encryptMessageContent = encryptMessageContent; | ||
exports.decryptMessageContent = decryptMessageContent; | ||
|
||
function encryptMessageContent(messagePayload) { | ||
return cipher.encrypt(JSON.stringify(messagePayload)); | ||
function encryptMessageContent(self, messagePayload) { | ||
return cipher.encrypt(self, JSON.stringify(messagePayload)); | ||
} | ||
|
||
function decryptMessageContent(messagePayload) { | ||
if (!messagePayload || ! Buffer.isBuffer(messagePayload)) { | ||
throw new Error("Message payload supplied for decryption is either empty or not a Buffer"); | ||
} | ||
try { | ||
return JSON.parse(cipher.decrypt(messagePayload)); | ||
} catch (err) { | ||
console.error(err.stack); | ||
throw Error('Failed to decrypt message: ' + err.message); | ||
} | ||
function decryptMessageContent(self, messagePayload) { | ||
if (!messagePayload || !Buffer.isBuffer(messagePayload)) { | ||
throw new Error('Message payload supplied for decryption is either empty or not a Buffer'); | ||
} | ||
try { | ||
return JSON.parse(cipher.decrypt(self, messagePayload)); | ||
} catch (err) { | ||
self.logger.error(err.stack); | ||
throw Error(`Failed to decrypt message: ${err.message}`); | ||
} | ||
} | ||
|
||
exports.encryptMessageContent = encryptMessageContent; | ||
exports.decryptMessageContent = decryptMessageContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.