Test security
test_sql_safety_guardrail_allows_select()
Verifies that benign SQL queries are permitted.
Scenario: User asks for a simple data extraction (SELECT).
Expectation:
The validator returns None (indicating no error/violation).
Source code in api/tests/unit/test_security.py
4 5 6 7 8 9 10 11 12 13 14 15 16 | |
test_sql_safety_guardrail_blocks_delete_injection()
Verifies detection of SQL Injection attempts using chained commands.
Scenario:
The input starts with a valid SELECT but appends a malicious DELETE command
after a semicolon (;).
Expectation:
The validator detects the hidden DELETE keyword and blocks the execution.
Source code in api/tests/unit/test_security.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
test_sql_safety_guardrail_blocks_drop()
Verifies that destructive DROP commands are blocked.
Scenario: User (or hallucinating LLM) attempts to delete the main table.
Expectation: The validator returns a string containing "Security Violation".
Source code in api/tests/unit/test_security.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |