Socket
Socket
Sign inDemoInstall

@aws-sdk/middleware-sdk-s3

Package Overview
Dependencies
Maintainers
5
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/middleware-sdk-s3 - npm Package Compare versions

Comparing version 3.622.0 to 3.624.0

dist-es/s3-express/functions/s3ExpressHttpSigningMiddleware.js

102

dist-cjs/index.js

@@ -34,2 +34,3 @@ "use strict";

getS3ExpiresMiddlewarePlugin: () => getS3ExpiresMiddlewarePlugin,
getS3ExpressHttpSigningPlugin: () => getS3ExpressHttpSigningPlugin,
getS3ExpressPlugin: () => getS3ExpressPlugin,

@@ -45,2 +46,4 @@ getThrow200ExceptionsPlugin: () => getThrow200ExceptionsPlugin,

s3ExpiresMiddlewareOptions: () => s3ExpiresMiddlewareOptions,
s3ExpressHttpSigningMiddleware: () => s3ExpressHttpSigningMiddleware,
s3ExpressHttpSigningMiddlewareOptions: () => s3ExpressHttpSigningMiddlewareOptions,
s3ExpressMiddleware: () => s3ExpressMiddleware,

@@ -94,16 +97,30 @@ s3ExpressMiddlewareOptions: () => s3ExpressMiddlewareOptions,

const regionProviderRef = config.region;
let unlock = /* @__PURE__ */ __name(() => {
}, "unlock");
if (context.__s3RegionRedirect) {
config.region = async () => {
config.region = regionProviderRef;
return context.__s3RegionRedirect;
};
Object.defineProperty(config, "region", {
writable: false,
value: async () => {
return context.__s3RegionRedirect;
}
});
unlock = /* @__PURE__ */ __name(() => Object.defineProperty(config, "region", {
writable: true,
value: regionProviderRef
}), "unlock");
}
const result = await next(args);
if (context.__s3RegionRedirect) {
const region = await config.region();
if (originalRegion !== region) {
throw new Error("Region was not restored following S3 region redirect.");
try {
const result = await next(args);
if (context.__s3RegionRedirect) {
unlock();
const region = await config.region();
if (originalRegion !== region) {
throw new Error("Region was not restored following S3 region redirect.");
}
}
return result;
} catch (e) {
unlock();
throw e;
}
return result;
};

@@ -422,2 +439,64 @@ }, "regionRedirectEndpointMiddleware");

// src/s3-express/functions/s3ExpressHttpSigningMiddleware.ts
var import_core = require("@smithy/core");
var import_util_middleware = require("@smithy/util-middleware");
// src/s3-express/functions/signS3Express.ts
var signS3Express = /* @__PURE__ */ __name(async (s3ExpressIdentity, signingOptions, request, sigV4MultiRegionSigner) => {
const signedRequest = await sigV4MultiRegionSigner.signWithCredentials(request, s3ExpressIdentity, {});
if (signedRequest.headers["X-Amz-Security-Token"] || signedRequest.headers["x-amz-security-token"]) {
throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");
}
return signedRequest;
}, "signS3Express");
// src/s3-express/functions/s3ExpressHttpSigningMiddleware.ts
var defaultErrorHandler = /* @__PURE__ */ __name((signingProperties) => (error) => {
throw error;
}, "defaultErrorHandler");
var defaultSuccessHandler = /* @__PURE__ */ __name((httpResponse, signingProperties) => {
}, "defaultSuccessHandler");
var s3ExpressHttpSigningMiddlewareOptions = import_core.httpSigningMiddlewareOptions;
var s3ExpressHttpSigningMiddleware = /* @__PURE__ */ __name((config) => (next, context) => async (args) => {
if (!import_protocol_http.HttpRequest.isInstance(args.request)) {
return next(args);
}
const smithyContext = (0, import_util_middleware.getSmithyContext)(context);
const scheme = smithyContext.selectedHttpAuthScheme;
if (!scheme) {
throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
}
const {
httpAuthOption: { signingProperties = {} },
identity,
signer
} = scheme;
let request;
if (context.s3ExpressIdentity) {
request = await signS3Express(
context.s3ExpressIdentity,
signingProperties,
args.request,
await config.signer()
);
} else {
request = await signer.sign(args.request, identity, signingProperties);
}
const output = await next({
...args,
request
}).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
(signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
return output;
}, "s3ExpressHttpSigningMiddleware");
var getS3ExpressHttpSigningPlugin = /* @__PURE__ */ __name((config) => ({
applyToStack: (clientStack) => {
clientStack.addRelativeTo(
s3ExpressHttpSigningMiddleware(config),
import_core.httpSigningMiddlewareOptions
);
}
}), "getS3ExpressHttpSigningPlugin");
// src/s3Configuration.ts

@@ -596,2 +675,5 @@ var resolveS3Config = /* @__PURE__ */ __name((input, {

s3ExpressMiddlewareOptions,
getS3ExpressHttpSigningPlugin,
s3ExpressHttpSigningMiddleware,
s3ExpressHttpSigningMiddlewareOptions,
resolveS3Config,

@@ -598,0 +680,0 @@ throw200ExceptionsMiddleware,

34

dist-es/region-redirect-endpoint-middleware.js

@@ -5,16 +5,30 @@ export const regionRedirectEndpointMiddleware = (config) => {

const regionProviderRef = config.region;
let unlock = () => { };
if (context.__s3RegionRedirect) {
config.region = async () => {
config.region = regionProviderRef;
return context.__s3RegionRedirect;
};
Object.defineProperty(config, "region", {
writable: false,
value: async () => {
return context.__s3RegionRedirect;
},
});
unlock = () => Object.defineProperty(config, "region", {
writable: true,
value: regionProviderRef,
});
}
const result = await next(args);
if (context.__s3RegionRedirect) {
const region = await config.region();
if (originalRegion !== region) {
throw new Error("Region was not restored following S3 region redirect.");
try {
const result = await next(args);
if (context.__s3RegionRedirect) {
unlock();
const region = await config.region();
if (originalRegion !== region) {
throw new Error("Region was not restored following S3 region redirect.");
}
}
return result;
}
return result;
catch (e) {
unlock();
throw e;
}
};

@@ -21,0 +35,0 @@ };

@@ -7,1 +7,2 @@ export { S3ExpressIdentityCache } from "./classes/S3ExpressIdentityCache";

export { getS3ExpressPlugin, s3ExpressMiddleware, s3ExpressMiddlewareOptions } from "./functions/s3ExpressMiddleware";
export { getS3ExpressHttpSigningPlugin, s3ExpressHttpSigningMiddleware, s3ExpressHttpSigningMiddlewareOptions, } from "./functions/s3ExpressHttpSigningMiddleware";

@@ -7,3 +7,4 @@ export { S3ExpressIdentityCache } from "./classes/S3ExpressIdentityCache";

export { getS3ExpressPlugin, s3ExpressMiddleware, s3ExpressMiddlewareOptions } from "./functions/s3ExpressMiddleware";
export { getS3ExpressHttpSigningPlugin, s3ExpressHttpSigningMiddleware, s3ExpressHttpSigningMiddlewareOptions, } from "./functions/s3ExpressHttpSigningMiddleware";
export { S3ExpressIdentity } from "./interfaces/S3ExpressIdentity";
export { S3ExpressIdentityProvider } from "./interfaces/S3ExpressIdentityProvider";

@@ -11,3 +11,8 @@ export { S3ExpressIdentityCache } from "./classes/S3ExpressIdentityCache";

} from "./functions/s3ExpressMiddleware";
export {
getS3ExpressHttpSigningPlugin,
s3ExpressHttpSigningMiddleware,
s3ExpressHttpSigningMiddlewareOptions,
} from "./functions/s3ExpressHttpSigningMiddleware";
export { S3ExpressIdentity } from "./interfaces/S3ExpressIdentity";
export { S3ExpressIdentityProvider } from "./interfaces/S3ExpressIdentityProvider";
{
"name": "@aws-sdk/middleware-sdk-s3",
"version": "3.622.0",
"version": "3.624.0",
"scripts": {

@@ -26,4 +26,6 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

"dependencies": {
"@aws-sdk/core": "3.624.0",
"@aws-sdk/types": "3.609.0",
"@aws-sdk/util-arn-parser": "3.568.0",
"@smithy/core": "^2.3.2",
"@smithy/node-config-provider": "^3.1.4",

@@ -35,2 +37,3 @@ "@smithy/protocol-http": "^4.1.0",

"@smithy/util-config-provider": "^3.0.0",
"@smithy/util-middleware": "^3.0.3",
"@smithy/util-stream": "^3.1.3",

@@ -37,0 +40,0 @@ "@smithy/util-utf8": "^3.0.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