Skip to content

Commit ba5bbe5

Browse files
Merge pull request #2 from megamattzilla/main
class5 standalone update- add openweb access and help text
2 parents 9912677 + bb36ed5 commit ba5bbe5

File tree

1 file changed

+67
-18
lines changed

1 file changed

+67
-18
lines changed

docs/class5/class5.rst

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ For details, please refer to official documentation. Here a brief description.
156156
apiKey: GPUAAS_API_KEY
157157
158158
Recap when starting at Class 5. If you just performed Class 4, skip to 2 - Deploy F5 AI Gateway.
159-
-----
159+
------------------------------------------------------------------------------------------------
160160
Before you continue with this lab, here is a recap on what has been done/completed and what the pending/to-do task. This lab is to learn how to deploy F5 AI Gateway and configure AIGW policy.
161161

162162
.. image:: ./_static/class5-1-0-0.png
@@ -210,6 +210,10 @@ Try to interact with GenAI RAG Chatbot.
210210

211211
.. image:: ../class4/_static/class4-9.png
212212

213+
.. NOTE::
214+
215+
You may need to make multiple repeated queries, to provide more data to the smaller CPU inferencing AI model.
216+
213217

214218
.. attention::
215219
You may occasionally see document identifiers, such as *"<doc id='2'>,"* appear in the response output. This issue can arise for several reasons, such as inadequate post-processing where metadata is not properly cleaned or removed, or during pre-processing when data is tagged with metadata that the model interprets as legitimate text. In this particular lab, the issue is likely due to a combination of factors, including the inference and embedding model's behavior and the use of a CPU for processing. **For the purposes of this class, please ignore if any imperfection of the AI responses.**
@@ -222,7 +226,7 @@ The GenAI RAG chatbot after asking both questions. Sometimes you may need to ask
222226
.. image:: ../class4/_static/class4-10.png
223227

224228
.. attention::
225-
As shown above, GenAI RAG Chatbot exposed sensitive information (PII) - **OWASP Top 10 - LLM01:2025 Sensitive Information Disclosure**. We need to leverage F5's AI Gateway to redact PII data
229+
As shown above, GenAI RAG Chatbot exposed sensitive information (PII) - **OWASP Top 10 - LLM01:2025 Sensitive Information Disclosure**. We need to leverage F5's AI Gateway to redact PII data
226230

227231
Apart from exposing sensitive information (PII), the chatbot also reveal sensitive data via system prompt leakage - **OWASP Top 10 - LLM07:2025 System Prompt Leakage**.
228232

@@ -471,7 +475,7 @@ Update AIGW policy by upgrading the helm chart with the AIGW configuration file.
471475
cd ~/ai-gateway/aigw-core/
472476
473477
.. code-block:: bash
474-
:caption: Update the aigw-core value file with the embeded policy.
478+
:caption: Update the aigw-core value file with the embedded policy.
475479
476480
helm -n ai-gateway upgrade aigw -f values-aigw-core.yaml .
477481
@@ -494,7 +498,7 @@ Monitor AIGW Core logs from a another terminal.
494498

495499
5 - Update LLM Orchestrator to point to AI Gateway
496500
--------------------------------------------------
497-
Confirm that you can login and access LLM orchestrator (flowise)
501+
Confirm that you can login and access LLM orchestrator (Flowise)
498502

499503
From the windows 10 Jumphost, open Google Chrome and select the bookmark for "LLM Orch - Flowise".
500504

@@ -576,7 +580,7 @@ You may need to make multiple queries, as hallucinations can occur or LLM may re
576580
You may use the following command (terminal CLI) to monitor AIGW logs if you hasn't got a terminal to monitor AIGW logs.
577581

578582
.. code-block:: bash
579-
:caption: Change directory to ai-gatway directory on AIGW core cluster.
583+
:caption: Change directory to ai-gateway directory on AIGW core cluster.
580584
581585
cd ~/ai-gateway
582586
@@ -1110,10 +1114,29 @@ Here is the AIGW data-security policy that is applied to Arcadia RAG Chatbot. It
11101114
value: "(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[0-2])/[0-9]{4}"
11111115
11121116
1113-
Sensitive Information Prevention - via unintentially by Employee
1114-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1117+
Sensitive Information Prevention - via unintentionally by Employee
1118+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1119+
1120+
In a previous step, we installed and setup Open-WebUI portal. It is a simple chat frontend that allows users to interact with the LLM model. In this section, we will implement a governance layer to the interaction with LLM model by enforcing traffic through AIGW. This will allow us to apply respective AI security policy.
1121+
1122+
From the Windows 10 Jumphost, open the Chrome browser, and confirm you can access the Open-Webui service.
1123+
1124+
.. image:: ../class3/_static/class3-6.png
1125+
1126+
Login to Open-WebUI
1127+
1128+
1129+
+----------------+---------------+
1130+
| **Email** | [email protected] |
1131+
+----------------+---------------+
1132+
| **Password** | F5Passw0rd |
1133+
+----------------+---------------+
1134+
1135+
.. image:: ../class3/_static/class3-8.png
1136+
1137+
.. Note::
1138+
You do not need to update Open-WebUI to the latest version when prompted. This lab has been tested with the currently installed version, so you can safely ignore the update recommendation.
11151139

1116-
In our previous steps, we had install and setup Open-WebUI portal. It is a simple chat frontend that allows users to interact with the LLM model. In this section, we will implement a governance layer to the interaction with LLM model by enforcing traffic through AIGW. This will allow us to apply respective AI security policy.
11171140

11181141
Simulate sending out sensitive information by employee.
11191142

@@ -1125,19 +1148,40 @@ Simulate sending out sensitive information by employee.
11251148
.. image:: ./_static/class5-37-a.png
11261149

11271150

1128-
Update Open-WebUI to use AIGW as the inference endpoint.
1151+
Open-WebUI configuration is using the LLM model endpoint directly.
1152+
1153+
Now, lets update Open-WebUI to use AIGW as the inference endpoint.
1154+
1155+
.. NOTE::
11291156

1130-
Existing Open-WebUI configuration is using the LLM model endpoint directly. We will update it to use AIGW as the inference endpoint.
1157+
You may need to click the Hamburger button on the left to reveal the Admin Panel option (pictured).
1158+
1159+
Then navigate to Settings -> Connections.
11311160

1132-
For API key, can be any value (e.g. f5123), as AIGW will not validate the API key.
11331161

11341162
.. image:: ./_static/class5-37-b.png
11351163

1136-
Update
1164+
Update the following settings:
1165+
1166+
1167+
+------------------------+------------------------------+
1168+
| **OpenAI API URL** | https://aigw.ai.local/rag/v1 |
1169+
+------------------------+------------------------------+
1170+
| **Open AI API Key** | 42 |
1171+
+------------------------+------------------------------+
1172+
| **Ollama API** | Toggle slider OFF |
1173+
+------------------------+------------------------------+
1174+
| **Direct Connections** | Toggle slider OFF |
1175+
+------------------------+------------------------------+
1176+
1177+
1178+
API key, can be any value (e.g. 42), as AIGW will not validate the API key.
1179+
1180+
Click **Save**
11371181

11381182
.. image:: ./_static/class5-37-c.png
11391183

1140-
Validate the outcome by sending out sensitive information.
1184+
Start a new chat and validate the outcome by sending out sensitive information.
11411185

11421186
.. code-block:: bash
11431187
@@ -1147,12 +1191,13 @@ Validate the outcome by sending out sensitive information.
11471191

11481192
.. NOTE::
11491193

1150-
You may need to make multiple repeated queries, as LLM occasinally may not response when it sees sensitive data. This also cloud be attributed because our environment is running on CPU.
1194+
You may need to make multiple repeated queries, as LLM occasionally may not response when it sees sensitive data. This also cloud be attributed because our environment is running on CPU.
1195+
You can also try asking: "echo this text please: S0000004C"
11511196

11521197
Direct Prompt Injection
11531198
~~~~~~~~~~~~~~~~~~~~~~~~
11541199

1155-
A Prompt Injection Vulnerability occurs when user prompts alter the LLM’s behaviour or output in unintended ways. These inputs can affect the model even if they are imperceptible to humans, therefore prompt injections do not need to be human-visible/readable, as long as the content is parsed by the model.
1200+
A Prompt Injection Vulnerability occurs when user prompts alter the LLM’s behavior or output in unintended ways. These inputs can affect the model even if they are imperceptible to humans, therefore prompt injections do not need to be human-visible/readable, as long as the content is parsed by the model.
11561201

11571202
Type of Prompt Injection
11581203

@@ -1164,7 +1209,7 @@ In this use case, we will test a direct prompt injection.
11641209
From a separate terminal, monitor AIGW Core logs.
11651210

11661211
.. code-block:: bash
1167-
:caption: Change directory to ai-gatway to switch to AIGW core cluster.
1212+
:caption: Change directory to ai-gateway to switch to AIGW core cluster.
11681213
11691214
cd ~/ai-gateway
11701215
@@ -1178,7 +1223,7 @@ From a separate terminal, monitor AIGW Core logs.
11781223
11791224
Test prompt-injection from Arcadia RAG Chatbot
11801225

1181-
In end of Class 4 (before implment AI security protection), we experience that Arcadia RAG Chatbot vulnerable to OWASP Top 10 - LLM07:2025 - System Prompt Leakage via a direct prompt injection. In this section, we will test the prompt-injection attack vector against Arcadia RAG Chatbot but this time, we will leverage the AIGW prompt-injection processor to detect and prevent the prompt-injection attack.
1226+
In end of Class 4 (before implementation of AI security protection), we experienced that Arcadia RAG Chatbot was vulnerable to OWASP Top 10 - LLM07:2025 - System Prompt Leakage via a direct prompt injection. In this section, we will test the prompt-injection attack vector against Arcadia RAG Chatbot but this time, we will leverage the AIGW prompt-injection processor to detect and prevent prompt-injection attacks.
11821227

11831228

11841229
.. code-block:: bash
@@ -1188,10 +1233,14 @@ In end of Class 4 (before implment AI security protection), we experience that A
11881233
11891234
.. image:: ./_static/class5-37-e.png
11901235

1236+
.. NOTE::
1237+
1238+
The chatbot response will be delayed. AI Gateway is blocking the request as expected, but our LLM Orchestrator Flowise is retrying the request. After some time, a timeout message will be provided to the user. A custom error message can be configured in Flowise in a future lab to handle this use-case.
1239+
11911240
Example logs shown **AIGW_POLICY_VIOLATION**. **Possible Injection detected**. This is the expected outcome, as we have successfully prevented the prompt-injection attack.
11921241

11931242

1194-
Alternatively, you can also use similar prompt-injection attack vector on Open-WebUI.
1243+
Alternatively, for a quicker response, you can attempt similar prompt-injection attacks on Open-WebUI.
11951244

11961245
.. image:: ./_static/class5-37-j.png
11971246

0 commit comments

Comments
 (0)