AWS Security ChangesHomeSearch

AWS powertools documentation change

Service: powertools · 2026-02-13 · Documentation high

File: powertools/typescript/latest/features/event-handler/http.md

Summary

Added documentation for using decorators with HTTP event handlers and introduced new Tracer middleware section covering response capture disabling and streaming limitations

Security assessment

The change adds documentation for disabling response capture in Tracer middleware to prevent sensitive data from being stored in AWS X-Ray traces. This is a security feature that helps avoid exposing confidential information in traces. The documentation explicitly shows how to set 'captureResponse: false' for routes handling sensitive data like payment cards.

Diff

diff --git a/powertools/typescript/latest/features/event-handler/http.md b/powertools/typescript/latest/features/event-handler/http.md
index f83d4c456..dcd74b3b3 100644
--- a//powertools/typescript/latest/features/event-handler/http.md
+++ b//powertools/typescript/latest/features/event-handler/http.md
@@ -55,0 +56 @@ Event Handler
+              * Using decorators 
@@ -77,0 +79,3 @@ Event Handler
+            * Tracer 
+              * Disabling response capture 
+              * Streaming limitation 
@@ -134,0 +139 @@ Table of contents
+      * Using decorators 
@@ -156,0 +162,3 @@ Table of contents
+    * Tracer 
+      * Disabling response capture 
+      * Streaming limitation 
@@ -934,0 +943,113 @@ We recommend defining separate route handlers for each HTTP method within your L
+#### Using decorators¶
+
+If you prefer to use the decorator syntax, you can use the same methods on a class method to register your route handlers. Learn more about how Powertools for TypeScript supports [decorators](../../../getting-started/usage-patterns/).
+
+Decorator syntax
+    
+    
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12
+    13
+    14
+    15
+    16
+    17
+    18
+    19
+    20
+    21
+    22
+    23
+    24
+    25
+    26
+    27
+    28
+    29
+    30
+    31
+    32
+    33
+    34
+    35
+    36
+    37
+    38
+    39
+    40
+    41
+    42
+    43
+    44
+    45
+    46
+    47
+
+| 
+    
+    
+    import type { LambdaInterface } from '@aws-lambda-powertools/commons/types';
+    import { Router } from '@aws-lambda-powertools/event-handler/http';
+    import { Logger } from '@aws-lambda-powertools/logger';
+    import type { Context } from 'aws-lambda';
+    
+    const logger = new Logger();
+    const app = new Router({ logger });
+    
+    class Lambda implements LambdaInterface {
+      @app.get('/todos/:todoId')
+      public async getTodo({ params }: { params: { todoId: string } }) {
+        logger.debug('Getting todo', { todoId: params.todoId });
+    
+        return {
+          id: params.todoId,
+          title: 'Todo Title',
+          completed: false,
+        };
+      }
+    
+      @app.post('/todos')
+      public async createTodo({ body }: { body: { title: string } }) {
+        logger.debug('Creating todo', { title: body.title });
+    
+        return {
+          id: 'new-todo-id',
+          title: body.title,
+          completed: false,
+        };
+      }
+    
+      @app.delete('/todos/:todoId')
+      public async deleteTodo({ params }: { params: { todoId: string } }) {
+        logger.debug('Deleting todo', { todoId: params.todoId });
+    
+        return {
+          message: `Todo ${params.todoId} deleted`,
+        };
+      }
+    
+      async handler(event: unknown, context: Context) {
+        return app.resolve(event, context, { scope: this });
+      }
+    }
+    
+    const lambda = new Lambda();
+    export const handler = lambda.handler.bind(lambda);
+      
+  
+---|---  
+  
+Tip
+
+We recommend passing a reference to `this` to ensure the correct class scope is propagated to the route handler functions.
+
@@ -957 +1078 @@ You can also pass a list of error classes to the `errorHandler()` method.
-index.ts
+index.tsUsing decorators
@@ -1017,0 +1139,95 @@ index.ts
+---|---  
+      
+    
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12
+    13
+    14
+    15
+    16
+    17
+    18
+    19
+    20
+    21
+    22
+    23
+    24
+    25
+    26
+    27
+    28
+    29
+    30
+    31
+    32
+    33
+    34
+    35
+    36
+    37
+    38
+    39
+    40
+    41
+    42
+    43
+
+| 
+    
+    
+    import type { LambdaInterface } from '@aws-lambda-powertools/commons/types';
+    import {
+      HttpStatusCodes,
+      Router,
+    } from '@aws-lambda-powertools/event-handler/http';
+    import { Logger } from '@aws-lambda-powertools/logger';
+    import type { Context } from 'aws-lambda';
+    
+    declare function getTodoById<T>(todoId: unknown): Promise<{ id: string } & T>;
+    declare class GetTodoError extends Error {}
+    
+    const logger = new Logger();
+    const app = new Router({ logger });
+    
+    class Lambda implements LambdaInterface {
+      @app.errorHandler(GetTodoError)