Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-apex-api-security

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-apex-api-security - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

.eslintrc.js

3

CHANGELOG.md

@@ -6,2 +6,5 @@ # Change Log

### V1.0.2
+ Eslint config and linting for library
### V1.0.0

@@ -8,0 +11,0 @@ + Bump to version 1.0.0 major release candidate

44

lib/ApiSigningUtil.js

@@ -5,3 +5,3 @@ const _ = require('lodash');

const fs = require('fs');
const {URL} = require('url');
const { URL } = require('url');
const winston = require('./Logger');

@@ -34,8 +34,8 @@

if (baseProps.signatureMethod === undefined || baseProps.signatureMethod === ''){
if (baseProps.signatureMethod === undefined || baseProps.signatureMethod === '') {
if (baseProps.secret === undefined || baseProps.secret === '') {
baseProps.signatureMethod = 'SHA256withRSA';
} else {
baseProps.signatureMethod = 'HMACSHA256';
}
baseProps.signatureMethod = 'SHA256withRSA';
} else {
baseProps.signatureMethod = 'HMACSHA256';
}
}

@@ -55,7 +55,7 @@

defaultParams[prefixedAppId] = baseProps.appId;
defaultParams[prefixedNonce] = baseProps.nonce;
defaultParams[prefixedSignatureMethod] = baseProps.signatureMethod;
defaultParams[prefixedTimestamp] = baseProps.timestamp;
defaultParams[prefixedVersion] = baseProps.version;
_.set(defaultParams, prefixedAppId, baseProps.appId);
_.set(defaultParams, prefixedNonce, baseProps.nonce);
_.set(defaultParams, prefixedSignatureMethod, baseProps.signatureMethod);
_.set(defaultParams, prefixedTimestamp, baseProps.timestamp);
_.set(defaultParams, prefixedVersion, baseProps.version);

@@ -72,3 +72,3 @@ return defaultParams;

* @private
*/
*/
ApiSigningUtil.parseParams = (json) => {

@@ -81,4 +81,4 @@ // As JSON doe not support property with sub-object as shown below

let keys = Object.keys(safeQueryStringJson);
keys.forEach(function(key){
keys.forEach(function(key) {
if (Array.isArray(safeQueryStringJson[key])) {

@@ -110,3 +110,3 @@ // Convert array value to name=value,name=value

let compiled = _.template('<%= message %> and <%= secret %> must not be null or empty!');
let errorMessage = compiled({'message': 'message', 'secret': 'secret'});
let errorMessage = compiled({ 'message': 'message', 'secret': 'secret' });

@@ -154,3 +154,3 @@ winston.error(errorMessage);

let compiled = _.template('<%= message %> and <%= privateKey %> must not be null or empty!');
let errorMessage = compiled({'message': 'message', 'privateKey': 'privateKey'});
let errorMessage = compiled({ 'message': 'message', 'privateKey': 'privateKey' });

@@ -188,3 +188,3 @@ winston.error(errorMessage);

let compiled = _.template('<%= message %> and <%= publicKey %> must not be null or empty!');
let errorMessage = compiled({'message': 'message', 'publicKey': 'publicKey'});
let errorMessage = compiled({ 'message': 'message', 'publicKey': 'publicKey' });

@@ -289,3 +289,3 @@ winston.error(errorMessage);

let signatureToken = authPrefix.charAt(0).toUpperCase() + authPrefix.slice(1) + " realm=\"" + reqProps.realm + "\"";
let signatureToken = authPrefix.charAt(0).toUpperCase() + authPrefix.slice(1) + ' realm="' + reqProps.realm + '"';
let defaultParams = ApiSigningUtil.getDefaultParam(baseProps);

@@ -295,4 +295,4 @@ defaultParams[authPrefix + '_signature'] = baseProps.signature;

let keys = Object.keys(defaultParams);
keys.forEach(function(key){
signatureToken = signatureToken + ", " + key + "=\"" + defaultParams[key] + "\"";
keys.forEach(function(key) {
signatureToken = signatureToken + ', ' + key + '="' + defaultParams[key] + '"';
});

@@ -334,3 +334,3 @@

const signatureUrl = siteUrl.protocol + '//' + siteUrl.hostname + siteUrl.pathname;
let defaultParams = ApiSigningUtil.getDefaultParam(baseProps);

@@ -358,3 +358,3 @@

//Check if key value is present before appending with '='
if(element.length > 1 && element[1] === '') {
if (element.length > 1 && element[1] === '') {
return element[0];

@@ -361,0 +361,0 @@ } else {

{
"name": "node-apex-api-security",
"version": "1.0.0",
"version": "1.0.2",
"description": "APEX API security utiity. Includes helper operations to generate HMAC-SHA256 and RSA-SHA256 signatures",

@@ -23,2 +23,7 @@ "main": "index.js",

"coveralls": "^3.0.2",
"eslint": "^5.7.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-security": "^1.4.0",
"mocha": "^5.2.0",

@@ -25,0 +30,0 @@ "nyc": "^13.0.1"

@@ -159,3 +159,3 @@ # APEX API Node.js Security Utility

Object representation of form fata (x-www-form-urlencoded) passed during HTTP POST / HTTP PUT requests
Object representation of form data (x-www-form-urlencoded) passed during HTTP POST / HTTP PUT requests

@@ -162,0 +162,0 @@ ```javascript

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc