AWS Builder Center
Masking vs blocking in guardrails: what I got wrong

Masking vs blocking in guardrails: what I got wrong

I read Roland's six-prompt bank chatbot test, and the masking vs blocking question stayed with me.

Software Engineer
When a user asks a bank chatbot for something sensitive, do you mask it or block it? That is the question Roland's test left me with.
Roland built a Bedrock guardrail in an AWS training lab, with a financial firm as the pretend customer. He worked through four decisions and said to run a six-prompt test before trusting it. In his setup, names, phone numbers and emails were masked, while card numbers, expiry dates and security codes were blocked. He also set the content filters to Block at High and used denied topics, including personal investment advice. His warning stayed with me too: guardrails lower the odds of a bad answer, they do not remove the risk, and detection is probabilistic, so some things can still slip past.
Masking keeps the conversation going, because the message still reaches the model with a placeholder in place of the private detail. But the sensitive data still travels through the conversation, which is the part that worries me. Blocking stops it cold, which is safer, but it kills the flow and leaves the user with nothing to work with. Then there is the rephrasing problem. A refused user does not always stop. They ask the same thing in different words. That is the question I asked Roland in the thread: did his six-prompt test cover a user rephrasing a request after a refusal, and did the guardrail hold up then?
The one rule I would use now is this. If the data must never reach the model, block it. Mask it only when the model needs the shape of the answer but not the value. Take a card number. Block it, because that number should never travel to the model at all. Masking a name is different. The chatbot can still help with the rest of the request without knowing exactly who is asking.
I have not run my own Bedrock guardrail test on masking versus blocking yet. This is what I took from Roland's test and the thread, and I will test it myself next.
When do you mask, and when do you block?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article