Red Teaming
Red teaming means trying hard to break your integration before someone else does: content written to get past your policy sets, and gaps in the code around the checks.
Agree the scope first
Decide what's in scope and who may run the tests. Test against a copy of your app rather than production, and decide whether a test stops at the verdict or goes on to whatever the verdict triggers (a message sent, a record written).
What to try
Your policy wording
- Content that claims an exception applies without meeting it.
- Cases at the edge of a rule: does "customers" cover former customers, or a named third party?
- Other languages, formats, and indirect or "hypothetical" phrasing.
The code around the check
- Is every path checked? Edits, retries, attachments, imports and admin tools are common gaps.
- Is the content you check the content you use, after any trimming or templating?
- What happens when a check fails (timeout, rate limit, out of credit)? If that's treated as a pass, the check can be bypassed by overloading it.
- Is
unknowntreated as safe anywhere? UseisSafe(). - Is a
blockactually enforced, or only logged? - Who can save or delete policy sets? Changing a set changes every check that uses it.
Run it as a loop
- Decide what counts as a failure, for example "content breaking rule 2 got
pass". - Write test cases: by hand for the subtle ones, and variations (paraphrased, translated, obfuscated) for volume.
- Run them, and record each policy set's text with the results (
policies.get(name)), so you can tell later whether a change came from your rules or from the content. - Fix the wording or the code, whichever was wrong.
- Keep every case that failed, and rerun them after each change.
Afterwards, write down what you tested and what you didn't.