ScottLogic / prompt-injection

Application which investigates defensive measures against prompt injection attacks on an LLM, with a focus on the exposure of external tools.
MIT License
13 stars 9 forks source link

Streamline network calls for reset all progress🛠🛠🛠 #827

Closed pmarsh-scottlogic closed 4 months ago

pmarsh-scottlogic commented 5 months ago

Here's what happens when I reset all progress on Sandbox:

[
    {
        "level": "LEVEL_1",
        "chatHistory": [],
        "defences": [
            {
                "id": "CHARACTER_LIMIT",
                "config": [
                    {
                        "id": "MAX_MESSAGE_LENGTH",
                        "value": "280"
                    }
                ],
                "isActive": false,
                "isTriggered": false
            },
//...

with details of every defence type for every level. Which is large (442 lines, 26570 characters).

If resetting all progress on level 1, you get the above calls but without the calls to openai/model.

🔧 This should all be combined into one request without all the repetition.

AC:

GIVEN frontend in preview mode (so that react doesn't do its double render thing) npm run preview AND any level WHEN the user resets all progress THEN there should be only one api call made of type fetch

Here's how you quickly find out what api calls are being made that are fetch type. Note that the CombinedFonts call is of type xhr, therefore we ignore it.

image