Socket
Socket
Sign inDemoInstall

aws4-axios

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws4-axios - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

.all-contributorsrc

42

dist/__tests__/apiGateway.it.js

@@ -57,2 +57,3 @@ "use strict";

var clientRoleArn = process.env.CLIENT_ROLE_ARN;
var assumedClientRoleArn = process.env.ASSUMED_CLIENT_ROLE_ARN;
var service = "execute-api";

@@ -109,3 +110,3 @@ var clientCredentials;

});
describe("API Gateway integration", function () {
describe("with credentials from environment variables", function () {
var client;

@@ -118,2 +119,5 @@ var data = {

});
afterAll(function () {
cleanEnvCredentials();
});
beforeEach(function () {

@@ -306,1 +310,37 @@ client = axios_1.default.create();

});
describe("with role to assume", function () {
var client;
var assumedRoleName = assumedClientRoleArn === null || assumedClientRoleArn === void 0 ? void 0 : assumedClientRoleArn.substr(assumedClientRoleArn.indexOf("/") + 1);
beforeAll(function () {
setEnvCredentials();
});
afterAll(function () {
cleanEnvCredentials();
});
beforeEach(function () {
client = axios_1.default.create();
client.interceptors.request.use(__1.aws4Interceptor({ region: region, service: service, assumeRoleArn: assumedClientRoleArn }));
});
it.each(__spreadArrays(methods, dataMethods))("signs HTTP %s request with assumed role credentials", function (method) { return __awaiter(void 0, void 0, void 0, function () {
var error, result, err_8;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, client.request({ url: apiGateway, method: method })];
case 1:
result = _a.sent();
return [3 /*break*/, 3];
case 2:
err_8 = _a.sent();
error = __1.getAuthErrorMessage(err_8);
return [3 /*break*/, 3];
case 3:
expect(error).toBe(undefined);
expect(result && result.status).toEqual(200);
expect(result && result.data.requestContext.authorizer.iam.userArn).toContain("/" + assumedRoleName + "/");
return [2 /*return*/];
}
});
}); });
});

9

dist/__tests__/setup.js

@@ -44,5 +44,5 @@ "use strict";

var stackName, cf, stacks, stack;
var _a, _b, _c, _d, _e;
return __generator(this, function (_f) {
switch (_f.label) {
var _a, _b, _c, _d, _e, _f, _g;
return __generator(this, function (_h) {
switch (_h.label) {
case 0:

@@ -55,3 +55,3 @@ stackName = "aws4AxiosIT-" + stage;

case 1:
stacks = _f.sent();
stacks = _h.sent();
stack = (_a = stacks.Stacks) === null || _a === void 0 ? void 0 : _a[0];

@@ -63,2 +63,3 @@ if (stack === undefined) {

process.env.CLIENT_ROLE_ARN = (_e = (_d = stack.Outputs) === null || _d === void 0 ? void 0 : _d.find(function (o) { return o.OutputKey === "ClientRoleArn"; })) === null || _e === void 0 ? void 0 : _e.OutputValue;
process.env.ASSUMED_CLIENT_ROLE_ARN = (_g = (_f = stack.Outputs) === null || _f === void 0 ? void 0 : _f.find(function (o) { return o.OutputKey === "AssumedClientRoleArn"; })) === null || _g === void 0 ? void 0 : _g.OutputValue;
process.env.AWS_REGION = region;

@@ -65,0 +66,0 @@ process.env.STAGE = stage;

@@ -170,3 +170,3 @@ "use strict";

}); });
exports.mockSend = function (client) {
var mockSend = function (client) {
var mock = jest.fn();

@@ -178,1 +178,2 @@ client.mockImplementation(function () { return ({

};
exports.mockSend = mockSend;

@@ -9,3 +9,3 @@ "use strict";

*/
exports.getAuthErrorMessage = function (error) {
var getAuthErrorMessage = function (error) {
var data = error.response && error.response.data;

@@ -16,1 +16,2 @@ if (data) {

};
exports.getAuthErrorMessage = getAuthErrorMessage;

@@ -72,3 +72,3 @@ "use strict";

*/
exports.aws4Interceptor = function (options, credentials) {
var aws4Interceptor = function (options, credentials) {
var credentialsProvider = (options === null || options === void 0 ? void 0 : options.assumeRoleArn) && !credentials

@@ -122,2 +122,3 @@ ? new assumeRoleCredentialsProvider_1.AssumeRoleCredentialsProvider({

};
exports.aws4Interceptor = aws4Interceptor;
var getTransformer = function (config) {

@@ -124,0 +125,0 @@ var transformRequest = config.transformRequest;

{
"name": "aws4-axios",
"version": "2.3.0",
"version": "2.3.1",
"description": "Axios request interceptor for signing requests with AWSv4",

@@ -38,3 +38,3 @@ "author": "James Bourne",

"lint:eslint": "eslint . --cache --ext .ts,.tsx",
"lint:prettier": "prettier --check .",
"lint:prettier": "prettier --check src/**/*.ts",
"lint": "run-s lint:*"

@@ -62,3 +62,3 @@ },

"serverless": "^2.22.0",
"typescript": "^3.8.3"
"typescript": "^4.1.3"
},

@@ -65,0 +65,0 @@ "dependencies": {

# aws4-axios
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

@@ -94,1 +97,24 @@ [![npm version](https://img.shields.io/npm/v/aws4-axios.svg?style=flat-square)](https://www.npmjs.org/package/aws4-axios)

This allows setting a safety margin. Default to 5 seconds.
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/florianbepunkt"><img src="https://avatars.githubusercontent.com/u/8314202?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Florian Bischoff</b></sub></a><br /><a href="https://github.com/jamesmbourne/aws4-axios/commits?author=florianbepunkt" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/rubenvanrooij"><img src="https://avatars.githubusercontent.com/u/875349?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ruben van Rooij</b></sub></a><br /><a href="https://github.com/jamesmbourne/aws4-axios/commits?author=rubenvanrooij" title="Code">💻</a></td>
<td align="center"><a href="https://www.ScaleLeap.com"><img src="https://avatars.githubusercontent.com/u/491247?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roman</b></sub></a><br /><a href="https://github.com/jamesmbourne/aws4-axios/pulls?q=is%3Apr+reviewed-by%3Amoltar" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="http://betterdev.blog"><img src="https://avatars.githubusercontent.com/u/4042673?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Maciej Radzikowski</b></sub></a><br /><a href="https://github.com/jamesmbourne/aws4-axios/commits?author=m-radzikowski" title="Tests">⚠️</a> <a href="https://github.com/jamesmbourne/aws4-axios/commits?author=m-radzikowski" title="Code">💻</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
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