Commit d203843
committed
fix(security): enable Jinja2 autoescape to prevent XSS in gepa sample
CWE-79 (Cross-Site Scripting)
The gepa rater_lib.py instantiated jinja2.Environment() without autoescape=True,
allowing user_input and model_response to be rendered as raw HTML.
This fix:
- Enable autoescape=True in jinja2.Environment()
- Add explicit |e filters to {{user_input}} and {{model_response}} as defense-in-depth1 parent 3e282d2 commit d203843
2 files changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
0 commit comments