#36152: Annotation with `%` in alias fails at db level on postgres
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):
* summary:
Postgres backend could quote `%` in column aliases instead of failing
at the db level
=> Annotation with `%` in alias fails at db level on postgres
Comment:
I'd be in favor of adjusting the regex. That's essentially what my code
does, and I could remove some workarounds if we get it in core.
> I wouldn't be surprised if the fact we allow % today could be exploited
one way to leak some parameter that should be present in the WHERE clause
for example.
I did try to fiddle with that before deciding whether to go to the
security team first. This had been on my medium term tinker list for a
while and finally opened an issue today because I saw a similar issue for
oracle in ticket:36147 waiting for a reproducer. (I was surprised to see
the annotation "just work" on Oracle -- this is how I noticed that backend
replaces `%` for you.)
Do we need to worry about a deprecation path for non-postgres backends?
--
Ticket URL: <
https://code.djangoproject.com/ticket/36152#comment:3>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.