Merge pull request #9470 from backstage/dependabot/npm_and_yarn/types/aws4-1.11.1
chore(deps-dev): bump @types/aws4 from 1.5.2 to 1.11.1
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes-backend': patch
|
||||
---
|
||||
|
||||
Fixed a potential issue in AWS token encoding, where they might not always be properly converted to URL-safe base64.
|
||||
+8
-21
@@ -18,19 +18,6 @@ import { sign } from 'aws4';
|
||||
import { AWSClusterDetails } from '../types/types';
|
||||
import { KubernetesAuthTranslator } from './types';
|
||||
|
||||
const base64 = (str: string) =>
|
||||
Buffer.from(str.toString(), 'binary').toString('base64');
|
||||
const prepend = (prep: string) => (str: string) => prep + str;
|
||||
const replace =
|
||||
(search: string | RegExp, substitution: string) => (str: string) =>
|
||||
str.replace(search, substitution);
|
||||
const pipe =
|
||||
(fns: ReadonlyArray<any>) =>
|
||||
(thing: string): string =>
|
||||
fns.reduce((val, fn) => fn(val), thing);
|
||||
const removePadding = replace(/=+$/, '');
|
||||
const makeUrlSafe = pipe([replace('+', '-'), replace('/', '_')]);
|
||||
|
||||
type SigningCreds = {
|
||||
accessKeyId: string | undefined;
|
||||
secretAccessKey: string | undefined;
|
||||
@@ -117,15 +104,15 @@ export class AwsIamKubernetesAuthTranslator
|
||||
signQuery: true,
|
||||
};
|
||||
|
||||
const signedRequest = sign(request, credentials);
|
||||
const signed = sign(request, credentials);
|
||||
const url = `https://${signed.host}${signed.path}`;
|
||||
const base64Url = Buffer.from(url, 'binary').toString('base64');
|
||||
const urlSafeBase64Url = base64Url
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=+$/, '');
|
||||
|
||||
return pipe([
|
||||
(signed: any) => `https://${signed.host}${signed.path}`,
|
||||
base64,
|
||||
removePadding,
|
||||
makeUrlSafe,
|
||||
prepend('k8s-aws-v1.'),
|
||||
])(signedRequest);
|
||||
return `k8s-aws-v1.${urlSafeBase64Url}`;
|
||||
}
|
||||
|
||||
async decorateClusterDetailsWithAuth(
|
||||
|
||||
@@ -5040,9 +5040,11 @@
|
||||
integrity sha512-dB14TltT1SNq73z3MaZfKyyBZ37NAgAFl8jze59bisR4fJ6pB6AYGxItHFkooZbN7UcVJX/cFudM4p8wp1W4rA==
|
||||
|
||||
"@types/aws4@^1.5.1":
|
||||
version "1.5.2"
|
||||
resolved "https://registry.npmjs.org/@types/aws4/-/aws4-1.5.2.tgz#34e35b4405a619b9205be3e7678963bc7c8a47db"
|
||||
integrity sha512-r8+XOv0BKw3Br0oU6w9cfu21PaQq/5ZeXvMOivNQYJLc9WcPCpEFDaQu72QNEQjYv5Otu48VhjjnbtwrSmk/rg==
|
||||
version "1.11.1"
|
||||
resolved "https://registry.npmjs.org/@types/aws4/-/aws4-1.11.1.tgz#1783c88bd2a2fd0ad5ed497668a6d0df8d5f3c43"
|
||||
integrity sha512-yUnPMlHP5JMZJiiNZElJG5qj1ShezlaET6Bug9SBhYsxKVamh7aOwl7Q/XR1Y//cZ5PoeRb9j4hi9svb2+FLlg==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7":
|
||||
version "7.1.9"
|
||||
|
||||
Reference in New Issue
Block a user