Page MenuHomePhabricator

No results on CheckUser query from 127.0.0.1 on PostgreSQL
Open, NormalPublic

Description

When asked for username IP addresses or edits CheckUser might return entries for 127.0.0.1 (for internally generated entries via FauxRequest etc.).

When asked for users on 127.0.0.1 no results are shown, however.

select * from cu_changes where cuc_ip_hex = '7F000001';

returns no results

It seems like 127.0.0.1 entries are stored like this:

# select * from cu_changes where cuc_ip_hex='0';

-[ RECORD 1 ]--+--------------------------------
cuc_id         | 68
cuc_namespace  | 90
cuc_title      | Dyskusja_użytkownika:Saper/test
cuc_user       | 1
cuc_user_text  | Saper
cuc_actiontext | 
cuc_comment    | Nowy wątek  test
cuc_minor      | 1
cuc_page_id    | 1717
cuc_this_oldid | 63082
cuc_last_oldid | 0
cuc_type       | 1
cuc_timestamp  | 2012-05-07 23:21:58+02
cuc_ip         | 127.0.0.1/32
cuc_ip_hex     | 0
cuc_xff        | 
cuc_xff_hex    | 
cuc_agent      |

and have cuc_ip_hex stored as zero instead of 7F0001

For MySQL 127.0.0.1 entries are correct:

        cuc_id: 22
 cuc_namespace: 4
     cuc_title: Książki/Moja_książka
      cuc_user: 1
 cuc_user_text: Saper
cuc_actiontext: 
   cuc_comment: Utworzył nową stronę „{{zapisane_książki}}  == Moja książka == === test === :[[Strona główna]]  [[Kategoria:Książki|Książki/Moja książka]]”
     cuc_minor: 0
   cuc_page_id: 8
cuc_this_oldid: 15
cuc_last_oldid: 0
      cuc_type: 1
 cuc_timestamp: 20120301052308
        cuc_ip: 127.0.0.1
    cuc_ip_hex: 7F000001
       cuc_xff: 
   cuc_xff_hex: NULL
     cuc_agent: 
4 rows in set (0.00 sec)

Version: master
Severity: normal

Details

Reference
bz37971

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 12:29 AM
bzimport added a project: CheckUser.
bzimport set Reference to bz37971.
saper created this task.Jun 26 2012, 9:00 PM

overlordq wrote:

If I had to hazard a guess it's because toHex/toUnsigned in the IP class isn't stripping off the prefix size before passing it to ip2long, which then returns false and there's no error checking.

saper added a comment.Jul 3 2012, 3:56 PM

Yes, looks something like that. What wonders me is why other IPv4 addresses work :)

overlordq wrote:

Meh, my first commit in a while, pushed to gerrit.

https://gerrit.wikimedia.org/r/14068

saper moved this task from Backlog to Patches in review on the CheckUser board.Apr 5 2015, 11:13 PM
Krenair added a subscriber: Krenair.Feb 7 2016, 5:33 AM

"in review" is not quite the right status here as it's been abandoned since 2013

Restricted Application added subscribers: JEumerus, Aklapper. · View Herald TranscriptFeb 7 2016, 5:33 AM
Krenair set Security to None.
Krenair moved this task from Patches in review to Backlog on the CheckUser board.
Meno25 removed a subscriber: Meno25.Feb 8 2016, 7:37 PM
Peachey88 updated the task description. (Show Details)Jul 24 2016, 1:18 AM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.