#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070194adad5721-98c7b0ba-4083-4dc8-b7a5-460d6e98d162-000000%40eu-central-1.amazonses.com.

Reply via email to