@aws-sdk/credential-provider-http 3.972.36 → 3.972.38
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/fromHttp/checkUrl.js +2 -2
- package/dist-cjs/fromHttp/fromHttp.browser.js +2 -2
- package/dist-cjs/fromHttp/fromHttp.js +3 -3
- package/dist-cjs/fromHttp/requestHelpers.js +10 -10
- package/dist-cjs/index.js +7 -5
- package/dist-es/fromHttp/checkUrl.js +1 -1
- package/dist-es/fromHttp/fromHttp.browser.js +1 -1
- package/dist-es/fromHttp/fromHttp.js +1 -1
- package/dist-es/fromHttp/requestHelpers.js +4 -4
- package/dist-types/fromHttp/requestHelpers.d.ts +1 -1
- package/dist-types/ts3.4/fromHttp/requestHelpers.d.ts +1 -1
- package/package.json +15 -10
- package/dist-cjs/fromHttp/fromHttpTypes.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkUrl = void 0;
|
|
4
|
-
const
|
|
4
|
+
const config_1 = require("@smithy/core/config");
|
|
5
5
|
const LOOPBACK_CIDR_IPv4 = "127.0.0.0/8";
|
|
6
6
|
const LOOPBACK_CIDR_IPv6 = "::1/128";
|
|
7
7
|
const ECS_CONTAINER_HOST = "169.254.170.2";
|
|
@@ -38,7 +38,7 @@ const checkUrl = (url, logger) => {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
throw new
|
|
41
|
+
throw new config_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
42
42
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
43
43
|
- ECS container host 169.254.170.2
|
|
44
44
|
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromHttp = void 0;
|
|
4
|
+
const config_1 = require("@smithy/core/config");
|
|
4
5
|
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
|
|
5
|
-
const property_provider_1 = require("@smithy/property-provider");
|
|
6
6
|
const checkUrl_1 = require("./checkUrl");
|
|
7
7
|
const requestHelpers_1 = require("./requestHelpers");
|
|
8
8
|
const retry_wrapper_1 = require("./retry-wrapper");
|
|
@@ -14,7 +14,7 @@ const fromHttp = (options = {}) => {
|
|
|
14
14
|
host = full;
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
throw new
|
|
17
|
+
throw new config_1.CredentialsProviderError("No HTTP credential provider host provided.", { logger: options.logger });
|
|
18
18
|
}
|
|
19
19
|
const url = new URL(host);
|
|
20
20
|
(0, checkUrl_1.checkUrl)(url, options.logger);
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fromHttp = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const client_1 = require("@aws-sdk/core/client");
|
|
6
|
+
const config_1 = require("@smithy/core/config");
|
|
6
7
|
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
7
|
-
const property_provider_1 = require("@smithy/property-provider");
|
|
8
8
|
const promises_1 = tslib_1.__importDefault(require("node:fs/promises"));
|
|
9
9
|
const checkUrl_1 = require("./checkUrl");
|
|
10
10
|
const requestHelpers_1 = require("./requestHelpers");
|
|
@@ -41,7 +41,7 @@ const fromHttp = (options = {}) => {
|
|
|
41
41
|
host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
throw new
|
|
44
|
+
throw new config_1.CredentialsProviderError(`No HTTP credential provider host provided.
|
|
45
45
|
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
|
46
46
|
}
|
|
47
47
|
const url = new URL(host);
|
|
@@ -63,7 +63,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
63
63
|
return (0, requestHelpers_1.getCredentials)(result.response).then((creds) => (0, client_1.setCredentialFeature)(creds, "CREDENTIALS_HTTP", "z"));
|
|
64
64
|
}
|
|
65
65
|
catch (e) {
|
|
66
|
-
throw new
|
|
66
|
+
throw new config_1.CredentialsProviderError(String(e), { logger: options.logger });
|
|
67
67
|
}
|
|
68
68
|
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
|
69
69
|
};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGetRequest = createGetRequest;
|
|
4
4
|
exports.getCredentials = getCredentials;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
5
|
+
const config_1 = require("@smithy/core/config");
|
|
6
|
+
const protocols_1 = require("@smithy/core/protocols");
|
|
7
|
+
const serde_1 = require("@smithy/core/serde");
|
|
8
|
+
const serde_2 = require("@smithy/core/serde");
|
|
9
9
|
function createGetRequest(url) {
|
|
10
|
-
return new
|
|
10
|
+
return new protocols_1.HttpRequest({
|
|
11
11
|
protocol: url.protocol,
|
|
12
12
|
hostname: url.hostname,
|
|
13
13
|
port: Number(url.port),
|
|
@@ -20,7 +20,7 @@ function createGetRequest(url) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
async function getCredentials(response, logger) {
|
|
23
|
-
const stream = (0,
|
|
23
|
+
const stream = (0, serde_2.sdkStreamMixin)(response.body);
|
|
24
24
|
const str = await stream.transformToString();
|
|
25
25
|
if (response.statusCode === 200) {
|
|
26
26
|
const parsed = JSON.parse(str);
|
|
@@ -28,14 +28,14 @@ async function getCredentials(response, logger) {
|
|
|
28
28
|
typeof parsed.SecretAccessKey !== "string" ||
|
|
29
29
|
typeof parsed.Token !== "string" ||
|
|
30
30
|
typeof parsed.Expiration !== "string") {
|
|
31
|
-
throw new
|
|
31
|
+
throw new config_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " +
|
|
32
32
|
"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
accessKeyId: parsed.AccessKeyId,
|
|
36
36
|
secretAccessKey: parsed.SecretAccessKey,
|
|
37
37
|
sessionToken: parsed.Token,
|
|
38
|
-
expiration: (0,
|
|
38
|
+
expiration: (0, serde_1.parseRfc3339DateTime)(parsed.Expiration),
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
if (response.statusCode >= 400 && response.statusCode < 500) {
|
|
@@ -44,10 +44,10 @@ async function getCredentials(response, logger) {
|
|
|
44
44
|
parsedBody = JSON.parse(str);
|
|
45
45
|
}
|
|
46
46
|
catch (e) { }
|
|
47
|
-
throw Object.assign(new
|
|
47
|
+
throw Object.assign(new config_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
|
48
48
|
Code: parsedBody.Code,
|
|
49
49
|
Message: parsedBody.Message,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
throw new
|
|
52
|
+
throw new config_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
|
53
53
|
}
|
package/dist-cjs/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fromHttp = require('./fromHttp/fromHttp');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.fromHttp = fromHttp.fromHttp;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { CredentialsProviderError } from "@smithy/core/config";
|
|
1
2
|
import { FetchHttpHandler } from "@smithy/fetch-http-handler";
|
|
2
|
-
import { CredentialsProviderError } from "@smithy/property-provider";
|
|
3
3
|
import { checkUrl } from "./checkUrl";
|
|
4
4
|
import { createGetRequest, getCredentials } from "./requestHelpers";
|
|
5
5
|
import { retryWrapper } from "./retry-wrapper";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setCredentialFeature } from "@aws-sdk/core/client";
|
|
2
|
+
import { CredentialsProviderError } from "@smithy/core/config";
|
|
2
3
|
import { NodeHttpHandler } from "@smithy/node-http-handler";
|
|
3
|
-
import { CredentialsProviderError } from "@smithy/property-provider";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { checkUrl } from "./checkUrl";
|
|
6
6
|
import { createGetRequest, getCredentials } from "./requestHelpers";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CredentialsProviderError } from "@smithy/
|
|
2
|
-
import { HttpRequest } from "@smithy/
|
|
3
|
-
import { parseRfc3339DateTime } from "@smithy/
|
|
4
|
-
import { sdkStreamMixin } from "@smithy/
|
|
1
|
+
import { CredentialsProviderError } from "@smithy/core/config";
|
|
2
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
|
+
import { parseRfc3339DateTime } from "@smithy/core/serde";
|
|
4
|
+
import { sdkStreamMixin } from "@smithy/core/serde";
|
|
5
5
|
export function createGetRequest(url) {
|
|
6
6
|
return new HttpRequest({
|
|
7
7
|
protocol: url.protocol,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AwsCredentialIdentity } from "@aws-sdk/types";
|
|
2
|
-
import { HttpRequest } from "@smithy/
|
|
2
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
3
|
import { HttpResponse, Logger } from "@smithy/types";
|
|
4
4
|
export declare function createGetRequest(url: URL): HttpRequest;
|
|
5
5
|
export declare function getCredentials(
|
package/package.json
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-http",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.38",
|
|
4
4
|
"description": "AWS credential provider for containers and HTTP sources",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
7
|
-
"browser":
|
|
8
|
-
|
|
7
|
+
"browser": {
|
|
8
|
+
"./dist-es/fromHttp/fromHttp": "./dist-es/fromHttp/fromHttp.browser",
|
|
9
|
+
"./dist-es/index": "./dist-es/index.browser"
|
|
10
|
+
},
|
|
11
|
+
"react-native": {
|
|
12
|
+
"./dist-es/index": "./dist-es/index.browser",
|
|
13
|
+
"./dist-cjs/index": "./dist-cjs/index.browser",
|
|
14
|
+
"./dist-es/fromHttp/fromHttp": "./dist-es/fromHttp/fromHttp.browser",
|
|
15
|
+
"./dist-cjs/fromHttp/fromHttp": "./dist-cjs/fromHttp/fromHttp.browser"
|
|
16
|
+
},
|
|
9
17
|
"scripts": {
|
|
10
18
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
11
19
|
"build:cjs": "node ../../scripts/compilation/inline credential-provider-http",
|
|
@@ -28,15 +36,12 @@
|
|
|
28
36
|
},
|
|
29
37
|
"license": "Apache-2.0",
|
|
30
38
|
"dependencies": {
|
|
31
|
-
"@aws-sdk/core": "^3.974.
|
|
39
|
+
"@aws-sdk/core": "^3.974.10",
|
|
32
40
|
"@aws-sdk/types": "^3.973.8",
|
|
33
|
-
"@smithy/
|
|
34
|
-
"@smithy/
|
|
35
|
-
"@smithy/
|
|
36
|
-
"@smithy/protocol-http": "^5.3.14",
|
|
37
|
-
"@smithy/smithy-client": "^4.12.13",
|
|
41
|
+
"@smithy/core": "^3.24.1",
|
|
42
|
+
"@smithy/fetch-http-handler": "^5.4.1",
|
|
43
|
+
"@smithy/node-http-handler": "^4.7.1",
|
|
38
44
|
"@smithy/types": "^4.14.1",
|
|
39
|
-
"@smithy/util-stream": "^4.5.25",
|
|
40
45
|
"tslib": "^2.6.2"
|
|
41
46
|
},
|
|
42
47
|
"devDependencies": {
|