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

@aws-sdk/credential-provider-process

Package Overview
Dependencies
Maintainers
5
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/credential-provider-process - npm Package Compare versions

Comparing version 3.178.0 to 3.183.0

8

CHANGELOG.md

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

# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
**Note:** Version bump only for package @aws-sdk/credential-provider-process
# [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)

@@ -8,0 +16,0 @@

17

dist-es/fromProcess.js

@@ -1,17 +0,6 @@

import { __awaiter, __generator } from "tslib";
import { getProfileName, parseKnownFiles } from "@aws-sdk/shared-ini-file-loader";
import { resolveProcessCredentials } from "./resolveProcessCredentials";
export var fromProcess = function (init) {
if (init === void 0) { init = {}; }
return function () { return __awaiter(void 0, void 0, void 0, function () {
var profiles;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, parseKnownFiles(init)];
case 1:
profiles = _a.sent();
return [2, resolveProcessCredentials(getProfileName(init), profiles)];
}
});
}); };
export const fromProcess = (init = {}) => async () => {
const profiles = await parseKnownFiles(init);
return resolveProcessCredentials(getProfileName(init), profiles);
};

@@ -1,17 +0,21 @@

import { __assign } from "tslib";
export var getValidatedProcessCredentials = function (profileName, data) {
export const getValidatedProcessCredentials = (profileName, data) => {
if (data.Version !== 1) {
throw Error("Profile ".concat(profileName, " credential_process did not return Version 1."));
throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
}
if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {
throw Error("Profile ".concat(profileName, " credential_process returned invalid credentials."));
throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);
}
if (data.Expiration) {
var currentTime = new Date();
var expireTime = new Date(data.Expiration);
const currentTime = new Date();
const expireTime = new Date(data.Expiration);
if (expireTime < currentTime) {
throw Error("Profile ".concat(profileName, " credential_process returned expired credentials."));
throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
}
}
return __assign(__assign({ accessKeyId: data.AccessKeyId, secretAccessKey: data.SecretAccessKey }, (data.SessionToken && { sessionToken: data.SessionToken })), (data.Expiration && { expiration: new Date(data.Expiration) }));
return {
accessKeyId: data.AccessKeyId,
secretAccessKey: data.SecretAccessKey,
...(data.SessionToken && { sessionToken: data.SessionToken }),
...(data.Expiration && { expiration: new Date(data.Expiration) }),
};
};

@@ -1,2 +0,1 @@

import { __awaiter, __generator } from "tslib";
import { CredentialsProviderError } from "@aws-sdk/property-provider";

@@ -6,36 +5,30 @@ import { exec } from "child_process";

import { getValidatedProcessCredentials } from "./getValidatedProcessCredentials";
export var resolveProcessCredentials = function (profileName, profiles) { return __awaiter(void 0, void 0, void 0, function () {
var profile, credentialProcess, execPromise, stdout, data, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
profile = profiles[profileName];
if (!profiles[profileName]) return [3, 7];
credentialProcess = profile["credential_process"];
if (!(credentialProcess !== undefined)) return [3, 5];
execPromise = promisify(exec);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4, execPromise(credentialProcess)];
case 2:
stdout = (_a.sent()).stdout;
data = void 0;
export const resolveProcessCredentials = async (profileName, profiles) => {
const profile = profiles[profileName];
if (profiles[profileName]) {
const credentialProcess = profile["credential_process"];
if (credentialProcess !== undefined) {
const execPromise = promisify(exec);
try {
const { stdout } = await execPromise(credentialProcess);
let data;
try {
data = JSON.parse(stdout.trim());
}
catch (_b) {
throw Error("Profile ".concat(profileName, " credential_process returned invalid JSON."));
catch {
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
}
return [2, getValidatedProcessCredentials(profileName, data)];
case 3:
error_1 = _a.sent();
throw new CredentialsProviderError(error_1.message);
case 4: return [3, 6];
case 5: throw new CredentialsProviderError("Profile ".concat(profileName, " did not contain credential_process."));
case 6: return [3, 8];
case 7: throw new CredentialsProviderError("Profile ".concat(profileName, " could not be found in shared credentials file."));
case 8: return [2];
return getValidatedProcessCredentials(profileName, data);
}
catch (error) {
throw new CredentialsProviderError(error.message);
}
}
});
}); };
else {
throw new CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`);
}
}
else {
throw new CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`);
}
};
{
"name": "@aws-sdk/credential-provider-process",
"version": "3.178.0",
"version": "3.183.0",
"description": "AWS credential provider that sources credential_process from ~/.aws/credentials and ~/.aws/config",

@@ -27,5 +27,5 @@ "main": "./dist-cjs/index.js",

"dependencies": {
"@aws-sdk/property-provider": "3.178.0",
"@aws-sdk/shared-ini-file-loader": "3.178.0",
"@aws-sdk/types": "3.178.0",
"@aws-sdk/property-provider": "3.183.0",
"@aws-sdk/shared-ini-file-loader": "3.183.0",
"@aws-sdk/types": "3.183.0",
"tslib": "^2.3.1"

@@ -32,0 +32,0 @@ },

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