Modify ↓
Opened 21 years ago
Closed 20 years ago
#1418 closed defect (duplicate)
Dynamic variables in reports should be escaped
| Reported by: | nil4 | Owned by: | daniel |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | report system | Version: | devel |
| Severity: | critical | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
The code in Report.py — sql_sub_vars only does a simple string substitution on the dynamic variables, with no escaping of dangerous characters (including backslash). I see two problems with this approach:
- It opens the door for SQL injection attacks on the sqlite database of trac repositories.
- It makes it impossible to write reports that use the $USER variable when users are authenticated in a domain, since the backslash is interpreted as a string escape modifier.
For example, the following code fails with an error, when the logged user is domain\username:
SELECT * FROM ticket WHERE owner = '$USER'
Attachments (0)
Change History (2)
comment:1 by , 21 years ago
| Summary: | Dinamic variables in reports should be escaped → Dynamic variables in reports should be escaped |
|---|
comment:2 by , 20 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
This was addressed in #2536
Note:
See TracTickets
for help on using tickets.



Actually, I just saw the values of dynamic variables are restricted by regexes, so I guess they're safe from SQL injection attacks.
Still, there's no way I can use to create reports for users authenticated in a Windows domain.