Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fifty-oranges-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/core": patch
---

set explicit enumerability on error.$response
5 changes: 5 additions & 0 deletions .changeset/fuzzy-goats-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/middleware-serde": patch
---

explicit non-enumerability for error.$response
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export class SmithyRpcV2CborProtocol extends RpcProtocol {

const errorMetadata = {
$metadata: metadata,
$response: response,
$fault: response.statusCode <= 500 ? ("client" as const) : ("server" as const),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export const schemaDeserializationMiddleware =
// For security reasons, the error response is not completely visible by default.
Object.defineProperty(error, "$response", {
value: response,
// we need to define these properties explicitly because
// the service exception class may have set the value to undefined, but populated the key.
enumerable: false,
writable: false,
configurable: false,
});

if (!("$metadata" in error)) {
Expand Down
5 changes: 5 additions & 0 deletions packages/middleware-serde/src/deserializerMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export const deserializerMiddleware =
// For security reasons, the error response is not completely visible by default.
Object.defineProperty(error, "$response", {
value: response,
// we need to define these properties explicitly because
// the service exception class may have set the value to undefined, but populated the key.
enumerable: false,
writable: false,
configurable: false,
});

if (!("$metadata" in error)) {
Expand Down
Loading