aws-samples / aws-samples/bedrock-chat

[BUG]WAF IP restriction not working

Open
#776 8 comments 0 reactions 0 assignees View on GitHub
bug needs investigation planned
Dominant language
TypeScript
Stars
1.3k
Forks
535
Avg merge
1d 12h
Merged PRs (30d)
10

Description

## 🚨 **Please Note** 🚨

To ensure efficient investigation of the issue, please fill out the fields below with as much detail as possible. **Reports that do not follow this template may be closed without notification.** We appreciate your cooperation.

## 🐞Describe the bug

Although IP restrictions are applied using the company's global IP address, once access has been gained, access from outside the company is also possible.
I am very concerned that this could be a security hole.

## 🔄 To Reproduce

Steps to reproduce the behavior:
1. Accessing BCC without a VPN connection: The browser freezes and the screen remains white.
Another service via Cloudfront returns 403 normally.
2. Connect to VPN and access: The login screen appears normally.
3. Disconnect the VPN again and access: BCC displays the login screen normally. Other services return 403.

interim measures:
By adding the API WAF to Cognito as shown below, IP restrictions for sign-in were implemented. I hope this helps.
This seems to be a different issue than browser cache.
Could you please review this so that WAF can be set up on Cognito and APIGateway?

![Image](https://github.com/user-attachments/assets/e320a73e-4c60-4ee5-9b71-77ff96817b1c)
![423981944-8f15e33b-57b0-4a29-8a3e-de3134ef6677~2.png](https://github.com/user-attachments/assets/c67f289a-521a-41af-ae4d-d194eaf274cb)

## 📷 Screenshots

WAF is configured on Cloudfront.
![Image](https://github.com/user-attachments/assets/bafb4c28-98b4-4cd2-8356-95fdf30da6c7)
![Image](https://github.com/user-attachments/assets/7277f072-457d-4453-882a-0966644f0d44)

## 🔎 Logs for Chat Issues

If the issue occurs during a chat interaction, please check the following logs on Amazon Cloudwatch Logs and include the relevant entries in your issue:

- `/aws/lambda/BedrockChatStack-BackendApiHandlerXXXX`
- `/aws/lambda/BedrockChatStack-WebSocketHandlerXXXX`

## 🔎 Logs for Bot Creation/Update Issues

If the issue occurs during bot creation or updating, please check the execution records of the AWS Step Functions state machine named `EmbeddingStateMachineXXX` and include the details in your issue.

## 📝 Additional context

Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the VPN connect/disconnect sequence described in the issue and review the AWS WAF configuration on CloudFront. Then inspect the related Cognito and API Gateway entry points, including the proposed WAF setup, to determine where restrictions stop applying. Done means access from outside the permitted IP range remains blocked after VPN access is established.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, infrastructure, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.