@aws-sdk/credential-provider-process 3.614.0 → 3.649.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.js +9 -3
- package/dist-es/getValidatedProcessCredentials.js +6 -1
- package/dist-es/resolveProcessCredentials.js +1 -1
- package/dist-types/ProcessCredentials.d.ts +1 -0
- package/dist-types/getValidatedProcessCredentials.d.ts +2 -2
- package/dist-types/ts3.4/ProcessCredentials.d.ts +1 -0
- package/dist-types/ts3.4/getValidatedProcessCredentials.d.ts +3 -2
- package/package.json +5 -5
package/dist-cjs/index.js
CHANGED
|
@@ -34,7 +34,8 @@ var import_child_process = require("child_process");
|
|
|
34
34
|
var import_util = require("util");
|
|
35
35
|
|
|
36
36
|
// src/getValidatedProcessCredentials.ts
|
|
37
|
-
var getValidatedProcessCredentials = /* @__PURE__ */ __name((profileName, data) => {
|
|
37
|
+
var getValidatedProcessCredentials = /* @__PURE__ */ __name((profileName, data, profiles) => {
|
|
38
|
+
var _a;
|
|
38
39
|
if (data.Version !== 1) {
|
|
39
40
|
throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
|
|
40
41
|
}
|
|
@@ -48,12 +49,17 @@ var getValidatedProcessCredentials = /* @__PURE__ */ __name((profileName, data)
|
|
|
48
49
|
throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
let accountId = data.AccountId;
|
|
53
|
+
if (!accountId && ((_a = profiles == null ? void 0 : profiles[profileName]) == null ? void 0 : _a.aws_account_id)) {
|
|
54
|
+
accountId = profiles[profileName].aws_account_id;
|
|
55
|
+
}
|
|
51
56
|
return {
|
|
52
57
|
accessKeyId: data.AccessKeyId,
|
|
53
58
|
secretAccessKey: data.SecretAccessKey,
|
|
54
59
|
...data.SessionToken && { sessionToken: data.SessionToken },
|
|
55
60
|
...data.Expiration && { expiration: new Date(data.Expiration) },
|
|
56
|
-
...data.CredentialScope && { credentialScope: data.CredentialScope }
|
|
61
|
+
...data.CredentialScope && { credentialScope: data.CredentialScope },
|
|
62
|
+
...accountId && { accountId }
|
|
57
63
|
};
|
|
58
64
|
}, "getValidatedProcessCredentials");
|
|
59
65
|
|
|
@@ -72,7 +78,7 @@ var resolveProcessCredentials = /* @__PURE__ */ __name(async (profileName, profi
|
|
|
72
78
|
} catch {
|
|
73
79
|
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
|
|
74
80
|
}
|
|
75
|
-
return getValidatedProcessCredentials(profileName, data);
|
|
81
|
+
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
76
82
|
} catch (error) {
|
|
77
83
|
throw new import_property_provider.CredentialsProviderError(error.message, { logger });
|
|
78
84
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const getValidatedProcessCredentials = (profileName, data) => {
|
|
1
|
+
export const getValidatedProcessCredentials = (profileName, data, profiles) => {
|
|
2
2
|
if (data.Version !== 1) {
|
|
3
3
|
throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
|
|
4
4
|
}
|
|
@@ -12,11 +12,16 @@ export const getValidatedProcessCredentials = (profileName, data) => {
|
|
|
12
12
|
throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
let accountId = data.AccountId;
|
|
16
|
+
if (!accountId && profiles?.[profileName]?.aws_account_id) {
|
|
17
|
+
accountId = profiles[profileName].aws_account_id;
|
|
18
|
+
}
|
|
15
19
|
return {
|
|
16
20
|
accessKeyId: data.AccessKeyId,
|
|
17
21
|
secretAccessKey: data.SecretAccessKey,
|
|
18
22
|
...(data.SessionToken && { sessionToken: data.SessionToken }),
|
|
19
23
|
...(data.Expiration && { expiration: new Date(data.Expiration) }),
|
|
20
24
|
...(data.CredentialScope && { credentialScope: data.CredentialScope }),
|
|
25
|
+
...(accountId && { accountId }),
|
|
21
26
|
};
|
|
22
27
|
};
|
|
@@ -17,7 +17,7 @@ export const resolveProcessCredentials = async (profileName, profiles, logger) =
|
|
|
17
17
|
catch {
|
|
18
18
|
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
|
|
19
19
|
}
|
|
20
|
-
return getValidatedProcessCredentials(profileName, data);
|
|
20
|
+
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
21
21
|
}
|
|
22
22
|
catch (error) {
|
|
23
23
|
throw new CredentialsProviderError(error.message, { logger });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AwsCredentialIdentity } from "@smithy/types";
|
|
1
|
+
import { AwsCredentialIdentity, ParsedIniData } from "@smithy/types";
|
|
2
2
|
import { ProcessCredentials } from "./ProcessCredentials";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
export declare const getValidatedProcessCredentials: (profileName: string, data: ProcessCredentials) => AwsCredentialIdentity;
|
|
6
|
+
export declare const getValidatedProcessCredentials: (profileName: string, data: ProcessCredentials, profiles: ParsedIniData) => AwsCredentialIdentity;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AwsCredentialIdentity } from "@smithy/types";
|
|
1
|
+
import { AwsCredentialIdentity, ParsedIniData } from "@smithy/types";
|
|
2
2
|
import { ProcessCredentials } from "./ProcessCredentials";
|
|
3
3
|
export declare const getValidatedProcessCredentials: (
|
|
4
4
|
profileName: string,
|
|
5
|
-
data: ProcessCredentials
|
|
5
|
+
data: ProcessCredentials,
|
|
6
|
+
profiles: ParsedIniData
|
|
6
7
|
) => AwsCredentialIdentity;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-process",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.649.0",
|
|
4
4
|
"description": "AWS credential provider that sources credential_process from ~/.aws/credentials and ~/.aws/config",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/types": "3.
|
|
28
|
-
"@smithy/property-provider": "^3.1.
|
|
29
|
-
"@smithy/shared-ini-file-loader": "^3.1.
|
|
30
|
-
"@smithy/types": "^3.
|
|
27
|
+
"@aws-sdk/types": "3.649.0",
|
|
28
|
+
"@smithy/property-provider": "^3.1.4",
|
|
29
|
+
"@smithy/shared-ini-file-loader": "^3.1.5",
|
|
30
|
+
"@smithy/types": "^3.4.0",
|
|
31
31
|
"tslib": "^2.6.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|