@rushstack/rush-amazon-s3-build-cache-plugin 5.124.4 → 5.124.6
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.
|
@@ -29,14 +29,14 @@ export declare class AmazonS3Client {
|
|
|
29
29
|
_getSha256Hmac(key: string | Buffer, data: string, encoding: 'hex'): string;
|
|
30
30
|
private _getSha256;
|
|
31
31
|
private _getIsoDateString;
|
|
32
|
-
private
|
|
32
|
+
private _safeReadResponseTextAsync;
|
|
33
33
|
private _getS3ErrorAsync;
|
|
34
34
|
/**
|
|
35
35
|
* Validates a S3 endpoint which is http(s):// + hostname + port. Hostname validated according to RFC 1123
|
|
36
36
|
* {@link https://docs.aws.amazon.com/general/latest/gr/s3.html}
|
|
37
37
|
*/
|
|
38
38
|
private _validateEndpoint;
|
|
39
|
-
private
|
|
39
|
+
private _sendCacheRequestWithRetriesAsync;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
package/lib/AmazonS3Client.d.ts
CHANGED
|
@@ -26,13 +26,13 @@ export declare class AmazonS3Client {
|
|
|
26
26
|
_getSha256Hmac(key: string | Buffer, data: string, encoding: 'hex'): string;
|
|
27
27
|
private _getSha256;
|
|
28
28
|
private _getIsoDateString;
|
|
29
|
-
private
|
|
29
|
+
private _safeReadResponseTextAsync;
|
|
30
30
|
private _getS3ErrorAsync;
|
|
31
31
|
/**
|
|
32
32
|
* Validates a S3 endpoint which is http(s):// + hostname + port. Hostname validated according to RFC 1123
|
|
33
33
|
* {@link https://docs.aws.amazon.com/general/latest/gr/s3.html}
|
|
34
34
|
*/
|
|
35
35
|
private _validateEndpoint;
|
|
36
|
-
private
|
|
36
|
+
private _sendCacheRequestWithRetriesAsync;
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=AmazonS3Client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonS3Client.d.ts","sourceRoot":"","sources":["../src/AmazonS3Client.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EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM;IAWlF,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,iBAAiB;YAaX,0BAA0B;YAS1B,gBAAgB;IAS9B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;YAuDX,iCAAiC;CA2ChD"}
|
package/lib/AmazonS3Client.js
CHANGED
|
@@ -88,7 +88,7 @@ class AmazonS3Client {
|
|
|
88
88
|
}
|
|
89
89
|
async getObjectAsync(objectName) {
|
|
90
90
|
this._writeDebugLine('Reading object from S3');
|
|
91
|
-
return await this.
|
|
91
|
+
return await this._sendCacheRequestWithRetriesAsync(async () => {
|
|
92
92
|
const response = await this._makeRequestAsync('GET', objectName);
|
|
93
93
|
if (response.ok) {
|
|
94
94
|
return {
|
|
@@ -128,7 +128,7 @@ class AmazonS3Client {
|
|
|
128
128
|
if (!this._credentials) {
|
|
129
129
|
throw new Error('Credentials are required to upload objects to S3.');
|
|
130
130
|
}
|
|
131
|
-
await this.
|
|
131
|
+
await this._sendCacheRequestWithRetriesAsync(async () => {
|
|
132
132
|
const response = await this._makeRequestAsync('PUT', objectName, objectBuffer);
|
|
133
133
|
if (!response.ok) {
|
|
134
134
|
return {
|
|
@@ -294,7 +294,7 @@ class AmazonS3Client {
|
|
|
294
294
|
date: dateString.substring(0, 8)
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
|
-
async
|
|
297
|
+
async _safeReadResponseTextAsync(response) {
|
|
298
298
|
try {
|
|
299
299
|
return await response.text();
|
|
300
300
|
}
|
|
@@ -304,7 +304,7 @@ class AmazonS3Client {
|
|
|
304
304
|
return undefined;
|
|
305
305
|
}
|
|
306
306
|
async _getS3ErrorAsync(response) {
|
|
307
|
-
const text = await this.
|
|
307
|
+
const text = await this._safeReadResponseTextAsync(response);
|
|
308
308
|
return new Error(`Amazon S3 responded with status code ${response.status} (${response.statusText})${text ? `\n${text}` : ''}`);
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
@@ -349,7 +349,7 @@ class AmazonS3Client {
|
|
|
349
349
|
throw new Error('Invalid S3 endpoint. Some part of the hostname contains invalid characters or is too long');
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
async
|
|
352
|
+
async _sendCacheRequestWithRetriesAsync(sendRequest) {
|
|
353
353
|
const response = await sendRequest();
|
|
354
354
|
const log = this._writeDebugLine.bind(this);
|
|
355
355
|
if (response.hasNetworkError) {
|
|
@@ -363,7 +363,7 @@ class AmazonS3Client {
|
|
|
363
363
|
}
|
|
364
364
|
delay = Math.min(maxRetryDelayInMs, delay);
|
|
365
365
|
log(`Will retry request in ${delay}s...`);
|
|
366
|
-
await node_core_library_1.Async.
|
|
366
|
+
await node_core_library_1.Async.sleepAsync(delay);
|
|
367
367
|
const retryResponse = await sendRequest();
|
|
368
368
|
if (retryResponse.hasNetworkError) {
|
|
369
369
|
if (retryAttempt < maxTries - 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmazonS3Client.js","sourceRoot":"","sources":["../src/AmazonS3Client.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAAqD;AACrD,kDAA+D;AAC/D,+CAAiC;AACjC,kDAAoC;AAIpC,+DAA+E;AAE/E,MAAM,wBAAwB,GAA2B,sBAAsB,CAAC;AAChF,MAAM,gBAAgB,GAAiB,YAAY,CAAC;AACpD,MAAM,gBAAgB,GAAW,MAAM,CAAC;AACxC,MAAM,0BAA0B,GAA2B,sBAAsB,CAAC;AAiBlF,MAAM,aAAa,GAAW,cAAc,CAAC;AAC7C,MAAM,SAAS,GAAW,aAAa,CAAC;AAExC,+HAA+H;AAC/H,IAAK,sBAGJ;AAHD,WAAK,sBAAsB;IACzB,iFAAe,CAAA;IACf,qEAAS,CAAA;AACX,CAAC,EAHI,sBAAsB,KAAtB,sBAAsB,QAG1B;AAUD,MAAM,mBAAmB,GAAyB;IAChD,iBAAiB,EAAE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,YAAY,GAAG,CAAC,CAAC,CAAC;wBACjC,CAAC;6BAAM,CAAC;4BACN,GAAG,CAAC,+DAA+D,CAAC,CAAC;4BACrE,MAAM,aAAa,CAAC,KAAK,CAAC;wBAC5B,CAAC;oBACH,CAAC;oBAED,OAAO,aAAa,CAAC,QAAQ,CAAC;gBAChC,CAAC;gBACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,iEAAiE,CAAC,CAAC;gBACvE,MAAM,QAAQ,CAAC,KAAK,CAAC;YACvB,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;CACF;AA5ZD,wCA4ZC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Async } from '@rushstack/node-core-library';\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\nimport * as crypto from 'crypto';\nimport * as fetch from 'node-fetch';\n\nimport type { IAmazonS3BuildCacheProviderOptionsAdvanced } from './AmazonS3BuildCacheProvider';\nimport type { IGetFetchOptions, IPutFetchOptions, WebClient } from './WebClient';\nimport { type IAmazonS3Credentials, fromRushEnv } from './AmazonS3Credentials';\n\nconst CONTENT_HASH_HEADER_NAME: 'x-amz-content-sha256' = 'x-amz-content-sha256';\nconst DATE_HEADER_NAME: 'x-amz-date' = 'x-amz-date';\nconst HOST_HEADER_NAME: 'host' = 'host';\nconst SECURITY_TOKEN_HEADER_NAME: 'x-amz-security-token' = 'x-amz-security-token';\n\ninterface IIsoDateString {\n date: string;\n dateTime: string;\n}\n\ntype RetryableRequestResponse<T> =\n | {\n hasNetworkError: true;\n error: Error;\n }\n | {\n hasNetworkError: false;\n response: T;\n };\n\nconst protocolRegex: RegExp = /^https?:\\/\\//;\nconst portRegex: RegExp = /:(\\d{1,5})$/;\n\n// Similar to https://docs.microsoft.com/en-us/javascript/api/@azure/storage-blob/storageretrypolicytype?view=azure-node-latest\nenum StorageRetryPolicyType {\n EXPONENTIAL = 0,\n FIXED = 1\n}\n\n// Similar to https://docs.microsoft.com/en-us/javascript/api/@azure/storage-blob/storageretryoptions?view=azure-node-latest\ninterface IStorageRetryOptions {\n maxRetryDelayInMs: number;\n maxTries: number;\n retryDelayInMs: number;\n retryPolicyType: StorageRetryPolicyType;\n}\n\nconst storageRetryOptions: IStorageRetryOptions = {\n maxRetryDelayInMs: 120 * 1000,\n maxTries: 4,\n retryDelayInMs: 4 * 1000,\n retryPolicyType: StorageRetryPolicyType.EXPONENTIAL\n};\n\n/**\n * A helper for reading and updating objects on Amazon S3\n *\n * @public\n */\nexport class AmazonS3Client {\n private readonly _credentials: IAmazonS3Credentials | undefined;\n private readonly _s3Endpoint: string;\n private readonly _s3Region: string;\n\n private readonly _webClient: WebClient;\n\n private readonly _terminal: ITerminal;\n\n public constructor(\n credentials: IAmazonS3Credentials | undefined,\n options: IAmazonS3BuildCacheProviderOptionsAdvanced,\n webClient: WebClient,\n terminal: ITerminal\n ) {\n this._credentials = credentials;\n this._terminal = terminal;\n\n this._validateEndpoint(options.s3Endpoint);\n\n this._s3Endpoint = options.s3Endpoint;\n this._s3Region = options.s3Region;\n\n this._webClient = webClient;\n }\n\n // https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html#create-signature-presign-entire-payload\n // We want to keep all slashes non encoded\n public static UriEncode(input: string): string {\n let output: string = '';\n for (let i: number = 0; i < input.length; i += 1) {\n const ch: string = input[i];\n if (ch.match(/[A-Za-z0-9~._-]|\\//)) {\n output += ch;\n } else {\n if (ch === ' ') {\n output += '%20';\n } else {\n output += `%${ch.charCodeAt(0).toString(16).toUpperCase()}`;\n }\n }\n }\n return output;\n }\n\n public static tryDeserializeCredentials(\n credentialString: string | undefined\n ): IAmazonS3Credentials | undefined {\n return fromRushEnv(credentialString);\n }\n\n public async getObjectAsync(objectName: string): Promise<Buffer | undefined> {\n this._writeDebugLine('Reading object from S3');\n return await this._sendCacheRequestWithRetries(async () => {\n const response: fetch.Response = await this._makeRequestAsync('GET', objectName);\n if (response.ok) {\n return {\n hasNetworkError: false,\n response: await response.buffer()\n };\n } else if (response.status === 404) {\n return {\n hasNetworkError: false,\n response: undefined\n };\n } else if (\n (response.status === 400 || response.status === 401 || response.status === 403) &&\n !this._credentials\n ) {\n // unauthorized due to not providing credentials,\n // silence error for better DX when e.g. running locally without credentials\n this._writeWarningLine(\n `No credentials found and received a ${response.status}`,\n ' response code from the cloud storage.',\n ' Maybe run rush update-cloud-credentials',\n ' or set the RUSH_BUILD_CACHE_CREDENTIAL env'\n );\n return {\n hasNetworkError: false,\n response: undefined\n };\n } else if (response.status === 400 || response.status === 401 || response.status === 403) {\n throw await this._getS3ErrorAsync(response);\n } else {\n const error: Error = await this._getS3ErrorAsync(response);\n return {\n hasNetworkError: true,\n error\n };\n }\n });\n }\n\n public async uploadObjectAsync(objectName: string, objectBuffer: Buffer): Promise<void> {\n if (!this._credentials) {\n throw new Error('Credentials are required to upload objects to S3.');\n }\n\n await this._sendCacheRequestWithRetries(async () => {\n const response: fetch.Response = await this._makeRequestAsync('PUT', objectName, objectBuffer);\n if (!response.ok) {\n return {\n hasNetworkError: true,\n error: await this._getS3ErrorAsync(response)\n };\n }\n return {\n hasNetworkError: false,\n response: undefined\n };\n });\n }\n\n private _writeDebugLine(...messageParts: string[]): void {\n // if the terminal has been closed then don't bother sending a debug message\n try {\n this._terminal.writeDebugLine(...messageParts);\n } catch (err) {\n // ignore error\n }\n }\n\n private _writeWarningLine(...messageParts: string[]): void {\n // if the terminal has been closed then don't bother sending a warning message\n try {\n this._terminal.writeWarningLine(...messageParts);\n } catch (err) {\n // ignore error\n }\n }\n\n private async _makeRequestAsync(\n verb: 'GET' | 'PUT',\n objectName: string,\n body?: Buffer\n ): Promise<fetch.Response> {\n const isoDateString: IIsoDateString = this._getIsoDateString();\n const bodyHash: string = this._getSha256(body);\n const headers: fetch.Headers = new fetch.Headers();\n headers.set(DATE_HEADER_NAME, isoDateString.dateTime);\n headers.set(CONTENT_HASH_HEADER_NAME, bodyHash);\n\n // the host can be e.g. https://s3.aws.com or http://localhost:9000\n const host: string = this._s3Endpoint.replace(protocolRegex, '');\n const canonicalUri: string = AmazonS3Client.UriEncode(`/${objectName}`);\n this._writeDebugLine(Colorize.bold('Canonical URI: '), canonicalUri);\n\n if (this._credentials) {\n // Compute the authorization header. See https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html\n const canonicalHeaders: string[] = [\n `${HOST_HEADER_NAME}:${host}`,\n `${CONTENT_HASH_HEADER_NAME}:${bodyHash}`,\n `${DATE_HEADER_NAME}:${isoDateString.dateTime}`\n ];\n\n // Handle signing with temporary credentials (via sts:assume-role)\n if (this._credentials.sessionToken) {\n canonicalHeaders.push(`${SECURITY_TOKEN_HEADER_NAME}:${this._credentials.sessionToken}`);\n }\n\n // the canonical headers must be sorted by header name\n canonicalHeaders.sort((aHeader, bHeader) => {\n const aHeaderName: string = aHeader.split(':')[0];\n const bHeaderName: string = bHeader.split(':')[0];\n if (aHeaderName < bHeaderName) {\n return -1;\n }\n if (aHeaderName > bHeaderName) {\n return 1;\n }\n return 0;\n });\n\n // the singed header names are derived from the canonicalHeaders\n const signedHeaderNamesString: string = canonicalHeaders\n .map((header) => {\n const headerName: string = header.split(':')[0];\n return headerName;\n })\n .join(';');\n\n // The canonical request looks like this:\n // GET\n // /test.txt\n //\n // host:examplebucket.s3.amazonaws.com\n // range:bytes=0-9\n // x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\n // x-amz-date:20130524T000000Z\n //\n // host;range;x-amz-content-sha256;x-amz-date\n // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\n const canonicalRequest: string = [\n verb,\n canonicalUri,\n '', // we don't use query strings for these requests\n ...canonicalHeaders,\n '',\n signedHeaderNamesString,\n bodyHash\n ].join('\\n');\n const canonicalRequestHash: string = this._getSha256(canonicalRequest);\n\n const scope: string = `${isoDateString.date}/${this._s3Region}/s3/aws4_request`;\n // The string to sign looks like this:\n // AWS4-HMAC-SHA256\n // 20130524T423589Z\n // 20130524/us-east-1/s3/aws4_request\n // 7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972\n const stringToSign: string = [\n 'AWS4-HMAC-SHA256',\n isoDateString.dateTime,\n scope,\n canonicalRequestHash\n ].join('\\n');\n\n const dateKey: Buffer = this._getSha256Hmac(\n `AWS4${this._credentials.secretAccessKey}`,\n isoDateString.date\n );\n const dateRegionKey: Buffer = this._getSha256Hmac(dateKey, this._s3Region);\n const dateRegionServiceKey: Buffer = this._getSha256Hmac(dateRegionKey, 's3');\n const signingKey: Buffer = this._getSha256Hmac(dateRegionServiceKey, 'aws4_request');\n const signature: string = this._getSha256Hmac(signingKey, stringToSign, 'hex');\n\n const authorizationHeader: string = `AWS4-HMAC-SHA256 Credential=${this._credentials.accessKeyId}/${scope},SignedHeaders=${signedHeaderNamesString},Signature=${signature}`;\n\n headers.set('Authorization', authorizationHeader);\n if (this._credentials.sessionToken) {\n // Handle signing with temporary credentials (via sts:assume-role)\n headers.set('X-Amz-Security-Token', this._credentials.sessionToken);\n }\n }\n\n const webFetchOptions: IGetFetchOptions | IPutFetchOptions = {\n verb,\n headers\n };\n if (verb === 'PUT') {\n (webFetchOptions as IPutFetchOptions).body = body;\n }\n\n const url: string = `${this._s3Endpoint}${canonicalUri}`;\n\n this._writeDebugLine(Colorize.bold(Colorize.underline('Sending request to S3')));\n this._writeDebugLine(Colorize.bold('HOST: '), url);\n this._writeDebugLine(Colorize.bold('Headers: '));\n headers.forEach((value, name) => {\n this._writeDebugLine(Colorize.cyan(`\\t${name}: ${value}`));\n });\n\n const response: fetch.Response = await this._webClient.fetchAsync(url, webFetchOptions);\n\n return response;\n }\n\n public _getSha256Hmac(key: string | Buffer, data: string): Buffer;\n public _getSha256Hmac(key: string | Buffer, data: string, encoding: 'hex'): string;\n public _getSha256Hmac(key: string | Buffer, data: string, encoding?: 'hex'): Buffer | string {\n const hash: crypto.Hmac = crypto.createHmac('sha256', key);\n hash.update(data);\n if (encoding) {\n return hash.digest(encoding);\n } else {\n return hash.digest();\n }\n }\n\n private _getSha256(data?: string | Buffer): string {\n if (data) {\n const hash: crypto.Hash = crypto.createHash('sha256');\n hash.update(data);\n return hash.digest('hex');\n } else {\n // This is the null SHA256 hash\n return 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855';\n }\n }\n\n private _getIsoDateString(date: Date = new Date()): IIsoDateString {\n let dateString: string = date.toISOString();\n dateString = dateString.replace(/[-:]/g, ''); // Remove separator characters\n dateString = dateString.substring(0, 15); // Drop milliseconds\n\n // dateTime is an ISO8601 date. It looks like \"20130524T423589\"\n // date is an ISO date. It looks like \"20130524\"\n return {\n dateTime: `${dateString}Z`,\n date: dateString.substring(0, 8)\n };\n }\n\n private async _safeReadResponseText(response: fetch.Response): Promise<string | undefined> {\n try {\n return await response.text();\n } catch (err) {\n // ignore the error\n }\n return undefined;\n }\n\n private async _getS3ErrorAsync(response: fetch.Response): Promise<Error> {\n const text: string | undefined = await this._safeReadResponseText(response);\n return new Error(\n `Amazon S3 responded with status code ${response.status} (${response.statusText})${\n text ? `\\n${text}` : ''\n }`\n );\n }\n\n /**\n * Validates a S3 endpoint which is http(s):// + hostname + port. Hostname validated according to RFC 1123\n * {@link https://docs.aws.amazon.com/general/latest/gr/s3.html}\n */\n private _validateEndpoint(s3Endpoint: string): void {\n let host: string = s3Endpoint;\n\n if (!s3Endpoint) {\n throw new Error('A S3 endpoint must be provided');\n }\n\n if (!s3Endpoint.match(protocolRegex)) {\n throw new Error('The S3 endpoint must start with https:// or http://');\n }\n\n host = host.replace(protocolRegex, '');\n\n if (host.match(/\\//)) {\n throw new Error('The path should be omitted from the endpoint. Use s3Prefix to specify a path');\n }\n\n const portMatch: RegExpMatchArray | null = s3Endpoint.match(portRegex);\n if (portMatch) {\n const port: number = Number(portMatch[1]);\n if (Number.isNaN(port) || port > 65535) {\n throw new Error(`Port: ${port} is an invalid port number`);\n }\n host = host.replace(portRegex, '');\n }\n\n if (host.endsWith('.')) {\n host = host.slice(0, host.length - 1);\n }\n\n if (host.length > 253) {\n throw new Error(\n 'The S3 endpoint is too long. RFC 1123 specifies a hostname should be no longer than 253 characters.'\n );\n }\n\n const subDomains: string[] = host.split('.');\n\n const subDomainRegex: RegExp = /^[a-zA-Z0-9-]+$/;\n const isValid: boolean = subDomains.every((subDomain) => {\n return (\n subDomainRegex.test(subDomain) &&\n subDomain.length < 64 &&\n !subDomain.startsWith('-') &&\n !subDomain.endsWith('-')\n );\n });\n\n if (!isValid) {\n throw new Error(\n 'Invalid S3 endpoint. Some part of the hostname contains invalid characters or is too long'\n );\n }\n }\n\n private async _sendCacheRequestWithRetries<T>(\n sendRequest: () => Promise<RetryableRequestResponse<T>>\n ): Promise<T> {\n const response: RetryableRequestResponse<T> = await sendRequest();\n\n const log: (...messageParts: string[]) => void = this._writeDebugLine.bind(this);\n\n if (response.hasNetworkError) {\n if (storageRetryOptions && storageRetryOptions.maxTries > 1) {\n log('Network request failed. Will retry request as specified in storageRetryOptions');\n async function retry(retryAttempt: number): Promise<T> {\n const { retryDelayInMs, retryPolicyType, maxTries, maxRetryDelayInMs } = storageRetryOptions;\n let delay: number = retryDelayInMs;\n if (retryPolicyType === StorageRetryPolicyType.EXPONENTIAL) {\n delay = retryDelayInMs * Math.pow(2, retryAttempt - 1);\n }\n delay = Math.min(maxRetryDelayInMs, delay);\n\n log(`Will retry request in ${delay}s...`);\n await Async.sleep(delay);\n const retryResponse: RetryableRequestResponse<T> = await sendRequest();\n\n if (retryResponse.hasNetworkError) {\n if (retryAttempt < maxTries - 1) {\n log('The retried request failed, will try again');\n return retry(retryAttempt + 1);\n } else {\n log('The retried request failed and has reached the maxTries limit');\n throw retryResponse.error;\n }\n }\n\n return retryResponse.response;\n }\n return retry(1);\n } else {\n log('Network request failed and storageRetryOptions is not specified');\n throw response.error;\n }\n }\n\n return response.response;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AmazonS3Client.js","sourceRoot":"","sources":["../src/AmazonS3Client.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAAqD;AACrD,kDAA+D;AAC/D,+CAAiC;AACjC,kDAAoC;AAIpC,+DAA+E;AAE/E,MAAM,wBAAwB,GAA2B,sBAAsB,CAAC;AAChF,MAAM,gBAAgB,GAAiB,YAAY,CAAC;AACpD,MAAM,gBAAgB,GAAW,MAAM,CAAC;AACxC,MAAM,0BAA0B,GAA2B,sBAAsB,CAAC;AAiBlF,MAAM,aAAa,GAAW,cAAc,CAAC;AAC7C,MAAM,SAAS,GAAW,aAAa,CAAC;AAExC,+HAA+H;AAC/H,IAAK,sBAGJ;AAHD,WAAK,sBAAsB;IACzB,iFAAe,CAAA;IACf,qEAAS,CAAA;AACX,CAAC,EAHI,sBAAsB,KAAtB,sBAAsB,QAG1B;AAUD,MAAM,mBAAmB,GAAyB;IAChD,iBAAiB,EAAE,GAAG,GAAG,IAAI;IAC7B,QAAQ,EAAE,CAAC;IACX,cAAc,EAAE,CAAC,GAAG,IAAI;IACxB,eAAe,EAAE,sBAAsB,CAAC,WAAW;CACpD,CAAC;AAEF;;;;GAIG;AACH,MAAa,cAAc;IASzB,YACE,WAA6C,EAC7C,OAAmD,EACnD,SAAoB,EACpB,QAAmB;QAEnB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE3C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;QAElC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC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oB;oBACvC,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,mBAAmB,CAAC;oBAC7F,IAAI,KAAK,GAAW,cAAc,CAAC;oBACnC,IAAI,eAAe,KAAK,sBAAsB,CAAC,WAAW,EAAE,CAAC;wBAC3D,KAAK,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;oBACzD,CAAC;oBACD,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;oBAE3C,GAAG,CAAC,yBAAyB,KAAK,MAAM,CAAC,CAAC;oBAC1C,MAAM,yBAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;oBAC9B,MAAM,aAAa,GAAgC,MAAM,WAAW,EAAE,CAAC;oBAEvE,IAAI,aAAa,CAAC,eAAe,EAAE,CAAC;wBAClC,IAAI,YAAY,GAAG,QAAQ,GAAG,CAAC,EAAE,CAAC;4BAChC,GAAG,CAAC,4CAA4C,CAAC,CAAC;4BAClD,OAAO,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;wBACjC,CAAC;6BAAM,CAAC;4BACN,GAAG,CAAC,+DAA+D,CAAC,CAAC;4BACrE,MAAM,aAAa,CAAC,KAAK,CAAC;wBAC5B,CAAC;oBACH,CAAC;oBAED,OAAO,aAAa,CAAC,QAAQ,CAAC;gBAChC,CAAC;gBACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,iEAAiE,CAAC,CAAC;gBACvE,MAAM,QAAQ,CAAC,KAAK,CAAC;YACvB,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;CACF;AA5ZD,wCA4ZC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Async } from '@rushstack/node-core-library';\nimport { Colorize, type ITerminal } from '@rushstack/terminal';\nimport * as crypto from 'crypto';\nimport * as fetch from 'node-fetch';\n\nimport type { IAmazonS3BuildCacheProviderOptionsAdvanced } from './AmazonS3BuildCacheProvider';\nimport type { IGetFetchOptions, IPutFetchOptions, WebClient } from './WebClient';\nimport { type IAmazonS3Credentials, fromRushEnv } from './AmazonS3Credentials';\n\nconst CONTENT_HASH_HEADER_NAME: 'x-amz-content-sha256' = 'x-amz-content-sha256';\nconst DATE_HEADER_NAME: 'x-amz-date' = 'x-amz-date';\nconst HOST_HEADER_NAME: 'host' = 'host';\nconst SECURITY_TOKEN_HEADER_NAME: 'x-amz-security-token' = 'x-amz-security-token';\n\ninterface IIsoDateString {\n date: string;\n dateTime: string;\n}\n\ntype RetryableRequestResponse<T> =\n | {\n hasNetworkError: true;\n error: Error;\n }\n | {\n hasNetworkError: false;\n response: T;\n };\n\nconst protocolRegex: RegExp = /^https?:\\/\\//;\nconst portRegex: RegExp = /:(\\d{1,5})$/;\n\n// Similar to https://docs.microsoft.com/en-us/javascript/api/@azure/storage-blob/storageretrypolicytype?view=azure-node-latest\nenum StorageRetryPolicyType {\n EXPONENTIAL = 0,\n FIXED = 1\n}\n\n// Similar to https://docs.microsoft.com/en-us/javascript/api/@azure/storage-blob/storageretryoptions?view=azure-node-latest\ninterface IStorageRetryOptions {\n maxRetryDelayInMs: number;\n maxTries: number;\n retryDelayInMs: number;\n retryPolicyType: StorageRetryPolicyType;\n}\n\nconst storageRetryOptions: IStorageRetryOptions = {\n maxRetryDelayInMs: 120 * 1000,\n maxTries: 4,\n retryDelayInMs: 4 * 1000,\n retryPolicyType: StorageRetryPolicyType.EXPONENTIAL\n};\n\n/**\n * A helper for reading and updating objects on Amazon S3\n *\n * @public\n */\nexport class AmazonS3Client {\n private readonly _credentials: IAmazonS3Credentials | undefined;\n private readonly _s3Endpoint: string;\n private readonly _s3Region: string;\n\n private readonly _webClient: WebClient;\n\n private readonly _terminal: ITerminal;\n\n public constructor(\n credentials: IAmazonS3Credentials | undefined,\n options: IAmazonS3BuildCacheProviderOptionsAdvanced,\n webClient: WebClient,\n terminal: ITerminal\n ) {\n this._credentials = credentials;\n this._terminal = terminal;\n\n this._validateEndpoint(options.s3Endpoint);\n\n this._s3Endpoint = options.s3Endpoint;\n this._s3Region = options.s3Region;\n\n this._webClient = webClient;\n }\n\n // https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html#create-signature-presign-entire-payload\n // We want to keep all slashes non encoded\n public static UriEncode(input: string): string {\n let output: string = '';\n for (let i: number = 0; i < input.length; i += 1) {\n const ch: string = input[i];\n if (ch.match(/[A-Za-z0-9~._-]|\\//)) {\n output += ch;\n } else {\n if (ch === ' ') {\n output += '%20';\n } else {\n output += `%${ch.charCodeAt(0).toString(16).toUpperCase()}`;\n }\n }\n }\n return output;\n }\n\n public static tryDeserializeCredentials(\n credentialString: string | undefined\n ): IAmazonS3Credentials | undefined {\n return fromRushEnv(credentialString);\n }\n\n public async getObjectAsync(objectName: string): Promise<Buffer | undefined> {\n this._writeDebugLine('Reading object from S3');\n return await this._sendCacheRequestWithRetriesAsync(async () => {\n const response: fetch.Response = await this._makeRequestAsync('GET', objectName);\n if (response.ok) {\n return {\n hasNetworkError: false,\n response: await response.buffer()\n };\n } else if (response.status === 404) {\n return {\n hasNetworkError: false,\n response: undefined\n };\n } else if (\n (response.status === 400 || response.status === 401 || response.status === 403) &&\n !this._credentials\n ) {\n // unauthorized due to not providing credentials,\n // silence error for better DX when e.g. running locally without credentials\n this._writeWarningLine(\n `No credentials found and received a ${response.status}`,\n ' response code from the cloud storage.',\n ' Maybe run rush update-cloud-credentials',\n ' or set the RUSH_BUILD_CACHE_CREDENTIAL env'\n );\n return {\n hasNetworkError: false,\n response: undefined\n };\n } else if (response.status === 400 || response.status === 401 || response.status === 403) {\n throw await this._getS3ErrorAsync(response);\n } else {\n const error: Error = await this._getS3ErrorAsync(response);\n return {\n hasNetworkError: true,\n error\n };\n }\n });\n }\n\n public async uploadObjectAsync(objectName: string, objectBuffer: Buffer): Promise<void> {\n if (!this._credentials) {\n throw new Error('Credentials are required to upload objects to S3.');\n }\n\n await this._sendCacheRequestWithRetriesAsync(async () => {\n const response: fetch.Response = await this._makeRequestAsync('PUT', objectName, objectBuffer);\n if (!response.ok) {\n return {\n hasNetworkError: true,\n error: await this._getS3ErrorAsync(response)\n };\n }\n return {\n hasNetworkError: false,\n response: undefined\n };\n });\n }\n\n private _writeDebugLine(...messageParts: string[]): void {\n // if the terminal has been closed then don't bother sending a debug message\n try {\n this._terminal.writeDebugLine(...messageParts);\n } catch (err) {\n // ignore error\n }\n }\n\n private _writeWarningLine(...messageParts: string[]): void {\n // if the terminal has been closed then don't bother sending a warning message\n try {\n this._terminal.writeWarningLine(...messageParts);\n } catch (err) {\n // ignore error\n }\n }\n\n private async _makeRequestAsync(\n verb: 'GET' | 'PUT',\n objectName: string,\n body?: Buffer\n ): Promise<fetch.Response> {\n const isoDateString: IIsoDateString = this._getIsoDateString();\n const bodyHash: string = this._getSha256(body);\n const headers: fetch.Headers = new fetch.Headers();\n headers.set(DATE_HEADER_NAME, isoDateString.dateTime);\n headers.set(CONTENT_HASH_HEADER_NAME, bodyHash);\n\n // the host can be e.g. https://s3.aws.com or http://localhost:9000\n const host: string = this._s3Endpoint.replace(protocolRegex, '');\n const canonicalUri: string = AmazonS3Client.UriEncode(`/${objectName}`);\n this._writeDebugLine(Colorize.bold('Canonical URI: '), canonicalUri);\n\n if (this._credentials) {\n // Compute the authorization header. See https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html\n const canonicalHeaders: string[] = [\n `${HOST_HEADER_NAME}:${host}`,\n `${CONTENT_HASH_HEADER_NAME}:${bodyHash}`,\n `${DATE_HEADER_NAME}:${isoDateString.dateTime}`\n ];\n\n // Handle signing with temporary credentials (via sts:assume-role)\n if (this._credentials.sessionToken) {\n canonicalHeaders.push(`${SECURITY_TOKEN_HEADER_NAME}:${this._credentials.sessionToken}`);\n }\n\n // the canonical headers must be sorted by header name\n canonicalHeaders.sort((aHeader, bHeader) => {\n const aHeaderName: string = aHeader.split(':')[0];\n const bHeaderName: string = bHeader.split(':')[0];\n if (aHeaderName < bHeaderName) {\n return -1;\n }\n if (aHeaderName > bHeaderName) {\n return 1;\n }\n return 0;\n });\n\n // the singed header names are derived from the canonicalHeaders\n const signedHeaderNamesString: string = canonicalHeaders\n .map((header) => {\n const headerName: string = header.split(':')[0];\n return headerName;\n })\n .join(';');\n\n // The canonical request looks like this:\n // GET\n // /test.txt\n //\n // host:examplebucket.s3.amazonaws.com\n // range:bytes=0-9\n // x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\n // x-amz-date:20130524T000000Z\n //\n // host;range;x-amz-content-sha256;x-amz-date\n // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\n const canonicalRequest: string = [\n verb,\n canonicalUri,\n '', // we don't use query strings for these requests\n ...canonicalHeaders,\n '',\n signedHeaderNamesString,\n bodyHash\n ].join('\\n');\n const canonicalRequestHash: string = this._getSha256(canonicalRequest);\n\n const scope: string = `${isoDateString.date}/${this._s3Region}/s3/aws4_request`;\n // The string to sign looks like this:\n // AWS4-HMAC-SHA256\n // 20130524T423589Z\n // 20130524/us-east-1/s3/aws4_request\n // 7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972\n const stringToSign: string = [\n 'AWS4-HMAC-SHA256',\n isoDateString.dateTime,\n scope,\n canonicalRequestHash\n ].join('\\n');\n\n const dateKey: Buffer = this._getSha256Hmac(\n `AWS4${this._credentials.secretAccessKey}`,\n isoDateString.date\n );\n const dateRegionKey: Buffer = this._getSha256Hmac(dateKey, this._s3Region);\n const dateRegionServiceKey: Buffer = this._getSha256Hmac(dateRegionKey, 's3');\n const signingKey: Buffer = this._getSha256Hmac(dateRegionServiceKey, 'aws4_request');\n const signature: string = this._getSha256Hmac(signingKey, stringToSign, 'hex');\n\n const authorizationHeader: string = `AWS4-HMAC-SHA256 Credential=${this._credentials.accessKeyId}/${scope},SignedHeaders=${signedHeaderNamesString},Signature=${signature}`;\n\n headers.set('Authorization', authorizationHeader);\n if (this._credentials.sessionToken) {\n // Handle signing with temporary credentials (via sts:assume-role)\n headers.set('X-Amz-Security-Token', this._credentials.sessionToken);\n }\n }\n\n const webFetchOptions: IGetFetchOptions | IPutFetchOptions = {\n verb,\n headers\n };\n if (verb === 'PUT') {\n (webFetchOptions as IPutFetchOptions).body = body;\n }\n\n const url: string = `${this._s3Endpoint}${canonicalUri}`;\n\n this._writeDebugLine(Colorize.bold(Colorize.underline('Sending request to S3')));\n this._writeDebugLine(Colorize.bold('HOST: '), url);\n this._writeDebugLine(Colorize.bold('Headers: '));\n headers.forEach((value, name) => {\n this._writeDebugLine(Colorize.cyan(`\\t${name}: ${value}`));\n });\n\n const response: fetch.Response = await this._webClient.fetchAsync(url, webFetchOptions);\n\n return response;\n }\n\n public _getSha256Hmac(key: string | Buffer, data: string): Buffer;\n public _getSha256Hmac(key: string | Buffer, data: string, encoding: 'hex'): string;\n public _getSha256Hmac(key: string | Buffer, data: string, encoding?: 'hex'): Buffer | string {\n const hash: crypto.Hmac = crypto.createHmac('sha256', key);\n hash.update(data);\n if (encoding) {\n return hash.digest(encoding);\n } else {\n return hash.digest();\n }\n }\n\n private _getSha256(data?: string | Buffer): string {\n if (data) {\n const hash: crypto.Hash = crypto.createHash('sha256');\n hash.update(data);\n return hash.digest('hex');\n } else {\n // This is the null SHA256 hash\n return 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855';\n }\n }\n\n private _getIsoDateString(date: Date = new Date()): IIsoDateString {\n let dateString: string = date.toISOString();\n dateString = dateString.replace(/[-:]/g, ''); // Remove separator characters\n dateString = dateString.substring(0, 15); // Drop milliseconds\n\n // dateTime is an ISO8601 date. It looks like \"20130524T423589\"\n // date is an ISO date. It looks like \"20130524\"\n return {\n dateTime: `${dateString}Z`,\n date: dateString.substring(0, 8)\n };\n }\n\n private async _safeReadResponseTextAsync(response: fetch.Response): Promise<string | undefined> {\n try {\n return await response.text();\n } catch (err) {\n // ignore the error\n }\n return undefined;\n }\n\n private async _getS3ErrorAsync(response: fetch.Response): Promise<Error> {\n const text: string | undefined = await this._safeReadResponseTextAsync(response);\n return new Error(\n `Amazon S3 responded with status code ${response.status} (${response.statusText})${\n text ? `\\n${text}` : ''\n }`\n );\n }\n\n /**\n * Validates a S3 endpoint which is http(s):// + hostname + port. Hostname validated according to RFC 1123\n * {@link https://docs.aws.amazon.com/general/latest/gr/s3.html}\n */\n private _validateEndpoint(s3Endpoint: string): void {\n let host: string = s3Endpoint;\n\n if (!s3Endpoint) {\n throw new Error('A S3 endpoint must be provided');\n }\n\n if (!s3Endpoint.match(protocolRegex)) {\n throw new Error('The S3 endpoint must start with https:// or http://');\n }\n\n host = host.replace(protocolRegex, '');\n\n if (host.match(/\\//)) {\n throw new Error('The path should be omitted from the endpoint. Use s3Prefix to specify a path');\n }\n\n const portMatch: RegExpMatchArray | null = s3Endpoint.match(portRegex);\n if (portMatch) {\n const port: number = Number(portMatch[1]);\n if (Number.isNaN(port) || port > 65535) {\n throw new Error(`Port: ${port} is an invalid port number`);\n }\n host = host.replace(portRegex, '');\n }\n\n if (host.endsWith('.')) {\n host = host.slice(0, host.length - 1);\n }\n\n if (host.length > 253) {\n throw new Error(\n 'The S3 endpoint is too long. RFC 1123 specifies a hostname should be no longer than 253 characters.'\n );\n }\n\n const subDomains: string[] = host.split('.');\n\n const subDomainRegex: RegExp = /^[a-zA-Z0-9-]+$/;\n const isValid: boolean = subDomains.every((subDomain) => {\n return (\n subDomainRegex.test(subDomain) &&\n subDomain.length < 64 &&\n !subDomain.startsWith('-') &&\n !subDomain.endsWith('-')\n );\n });\n\n if (!isValid) {\n throw new Error(\n 'Invalid S3 endpoint. Some part of the hostname contains invalid characters or is too long'\n );\n }\n }\n\n private async _sendCacheRequestWithRetriesAsync<T>(\n sendRequest: () => Promise<RetryableRequestResponse<T>>\n ): Promise<T> {\n const response: RetryableRequestResponse<T> = await sendRequest();\n\n const log: (...messageParts: string[]) => void = this._writeDebugLine.bind(this);\n\n if (response.hasNetworkError) {\n if (storageRetryOptions && storageRetryOptions.maxTries > 1) {\n log('Network request failed. Will retry request as specified in storageRetryOptions');\n async function retry(retryAttempt: number): Promise<T> {\n const { retryDelayInMs, retryPolicyType, maxTries, maxRetryDelayInMs } = storageRetryOptions;\n let delay: number = retryDelayInMs;\n if (retryPolicyType === StorageRetryPolicyType.EXPONENTIAL) {\n delay = retryDelayInMs * Math.pow(2, retryAttempt - 1);\n }\n delay = Math.min(maxRetryDelayInMs, delay);\n\n log(`Will retry request in ${delay}s...`);\n await Async.sleepAsync(delay);\n const retryResponse: RetryableRequestResponse<T> = await sendRequest();\n\n if (retryResponse.hasNetworkError) {\n if (retryAttempt < maxTries - 1) {\n log('The retried request failed, will try again');\n return retry(retryAttempt + 1);\n } else {\n log('The retried request failed and has reached the maxTries limit');\n throw retryResponse.error;\n }\n }\n\n return retryResponse.response;\n }\n return retry(1);\n } else {\n log('Network request failed and storageRetryOptions is not specified');\n throw response.error;\n }\n }\n\n return response.response;\n }\n}\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/rush-amazon-s3-build-cache-plugin",
|
|
3
|
-
"version": "5.124.
|
|
3
|
+
"version": "5.124.6",
|
|
4
4
|
"description": "Rush plugin for Amazon S3 cloud build cache",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"https-proxy-agent": "~5.0.0",
|
|
16
16
|
"node-fetch": "2.6.7",
|
|
17
|
-
"@rushstack/rush-sdk": "5.124.
|
|
18
|
-
"@rushstack/node-core-library": "4.
|
|
19
|
-
"@rushstack/terminal": "0.
|
|
17
|
+
"@rushstack/rush-sdk": "5.124.6",
|
|
18
|
+
"@rushstack/node-core-library": "4.3.0",
|
|
19
|
+
"@rushstack/terminal": "0.11.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node-fetch": "2.6.2",
|
|
23
|
-
"@microsoft/rush-lib": "5.124.
|
|
24
|
-
"
|
|
25
|
-
"
|
|
23
|
+
"@microsoft/rush-lib": "5.124.6",
|
|
24
|
+
"@rushstack/heft": "0.66.8",
|
|
25
|
+
"local-node-rig": "1.0.0"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "heft build --clean",
|