https://promptfoo.dev/ logo
Request Transform for Prompt Injection Strategy
# ❓|questions
b
I am attempting to run a Redteam test using Direct Prompt Injection strategy however it seems the prompts that get generated are causing issues when being passed in the JSON body for our chatbot's API set up. I am trying create a request transform so the prompt won't cause issues in the JSON body. I thought this simple Javascript would do the trick (prompt) => JSON.stringify(prompt) but it when I test the target I get an error invalid input.
i
hey @blue.yeen! what is the expected JSON format of the endpoint?
b
@ian the req body is set up as so: { "message": "{{prompt}}", "sessionId": "{{sessionId}}" }
i
hmm is there any chance you can share more of the config?
feel free to DM