Skip to content

Commit 92546cd

Browse files
committed
Improve README
Signed-off-by: Max Lambrecht <[email protected]>
1 parent da77129 commit 92546cd

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

README.md

+22-12
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,32 @@ go run examples/logical_operators/logical_operators.go
3939
go run examples/precedence/precedence.go
4040
```
4141

42-
## 🔒 Security: Injection Protection
42+
## **🔒 Security: SQL Injection Protection**
4343

44-
**ODataSQL** enforces strict validation to prevent SQL injection risks:
44+
**ODataSQL** enforces strict validation to prevent SQL injection attacks and ensure safe query generation.
4545

46-
- **Rejects Always-True Expressions**
47-
-`"age gt 30 or true eq true"` (_Rejected_)
48-
-`"name eq 'Alice' or 1 eq 1"` (_Rejected_)
46+
- **SQL Injection via Malicious Values**
47+
-`"id eq '1; DROP TABLE users --'"`
48+
-`"DROP TABLE users"`
4949

50-
- **Ensures Valid Field Names**
51-
-`"true eq false"` (_Rejected_)
52-
-`"null eq null"` (_Rejected_)
53-
-`"SELECT eq 'Alice'"` (_Rejected_)
50+
- **Always-True / Always-False Attacks**
51+
-`"username eq 'admin' or true eq true"`
52+
-`"age gt 30 or 1 eq 1"`
53+
-`"status eq 'active' and false eq false"`
5454

55-
-**Preserves SQL Safety**
56-
- Only **valid identifiers** can be used as field names.
57-
- Strings, numbers, and booleans **cannot be misused** as field names.
55+
- **Logical Operator & Parentheses Exploits**
56+
-`"()"`, `"not"`, `"name eq 'Alice' or"`
57+
58+
- **Dangerous SQL Syntax**
59+
-`"name eq 'Alice' --"` (SQL comment injection)
60+
-`"color in ()"` (Empty `IN` list)
61+
-`"SELECT eq 'Alice'"` (Reserved SQL keyword as a field)
62+
63+
#### **✅ How ODataSQL Ensures Safety:**
64+
65+
- **Strict field validation** – Only valid identifiers allowed.
66+
- **Safe value handling** – Prevents misuse of SQL syntax.
67+
- **Input sanitization** – Blocks `;`, `--`, and comment injection.
5868

5969
💡 **Note:** While ODataSQL ensures safe query generation, always apply **standard SQL security measures** in your
6070
database layer.

0 commit comments

Comments
 (0)