Skip to content

Conversation

leandrodamascena
Copy link
Contributor

Issue number: closes #7288

Summary

Changes

This PR add supports for IPV6 address with port (e.g., 10.1.15.242:39870) in APIGateway models.

User experience

from aws_lambda_powertools.utilities.parser import event_parser
from aws_lambda_powertools.utilities.parser.models import APIGatewayProxyEventV2Model
from aws_lambda_powertools.utilities.typing import LambdaContext


@event_parser
def lambda_handler(event: APIGatewayProxyEventV2Model, context: LambdaContext):
    # Access sourceIp - now works with both formats:
    # - Standard IP: "fe80::1ff:fe23:4567:890a" 
    # - IP with port: "[fe80::1ff:fe23:4567:890a]:12345"
    source_ip = event.requestContext.http.sourceIp
    
    print(f"Request from: {source_ip}")
    
    return {
        'statusCode': 200,
        'body': f'Hello from {source_ip}!'
    }

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@leandrodamascena leandrodamascena requested a review from a team as a code owner September 9, 2025 08:38
@boring-cyborg boring-cyborg bot added the tests label Sep 9, 2025
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 9, 2025
@github-actions github-actions bot added the feature New feature or functionality label Sep 9, 2025
@leandrodamascena leandrodamascena self-assigned this Sep 9, 2025
@leandrodamascena leandrodamascena removed the request for review from hjgraca September 9, 2025 08:39
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.36%. Comparing base (0eb5cb8) to head (6938708).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7351   +/-   ##
========================================
  Coverage    96.36%   96.36%           
========================================
  Files          275      275           
  Lines        13003    13007    +4     
  Branches       966      968    +2     
========================================
+ Hits         12530    12534    +4     
  Misses         366      366           
  Partials       107      107           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

sonarqubecloud bot commented Sep 9, 2025

@leandrodamascena leandrodamascena merged commit 118a3e8 into develop Sep 9, 2025
12 checks passed
@leandrodamascena leandrodamascena deleted the fix/sourceip-ipv6 branch September 9, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: support IP address with port in requestContext.http.sourceIp when parsing requests via TLS
2 participants